mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-26 00:18:36 +00:00
Add support for clUnloadPlatformCompiler()
This commit is contained in:
parent
59459d0e5b
commit
0c2afde83b
@ -113,6 +113,7 @@ int hc_clReleaseMemObject (hashcat_ctx_t *hashcat_ctx, cl_mem mem);
|
||||
int hc_clReleaseProgram (hashcat_ctx_t *hashcat_ctx, cl_program program);
|
||||
int hc_clSetKernelArg (hashcat_ctx_t *hashcat_ctx, cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value);
|
||||
int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events, const cl_event *event_list);
|
||||
int hc_clUnloadPlatformCompiler (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform);
|
||||
|
||||
int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
|
||||
|
||||
|
@ -70,6 +70,7 @@ typedef cl_int (CL_API_CALL *OCL_CLRELEASEKERNEL) (cl_kernel
|
||||
typedef cl_int (CL_API_CALL *OCL_CLRELEASEMEMOBJECT) (cl_mem);
|
||||
typedef cl_int (CL_API_CALL *OCL_CLRELEASEPROGRAM) (cl_program);
|
||||
typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *);
|
||||
typedef cl_int (CL_API_CALL *OCL_CLUNLOADPLATFORMCOMPILER) (cl_platform_id);
|
||||
typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *);
|
||||
|
||||
typedef struct hc_opencl_lib
|
||||
@ -109,6 +110,7 @@ typedef struct hc_opencl_lib
|
||||
OCL_CLRELEASEMEMOBJECT clReleaseMemObject;
|
||||
OCL_CLRELEASEPROGRAM clReleaseProgram;
|
||||
OCL_CLSETKERNELARG clSetKernelArg;
|
||||
OCL_CLUNLOADPLATFORMCOMPILER clUnloadPlatformCompiler;
|
||||
OCL_CLWAITFOREVENTS clWaitForEvents;
|
||||
|
||||
} hc_opencl_lib_t;
|
||||
|
@ -2216,6 +2216,7 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx)
|
||||
HC_LOAD_FUNC (ocl, clWaitForEvents, OCL_CLWAITFOREVENTS, OpenCL, 1);
|
||||
HC_LOAD_FUNC (ocl, clGetEventProfilingInfo, OCL_CLGETEVENTPROFILINGINFO, OpenCL, 1);
|
||||
HC_LOAD_FUNC (ocl, clReleaseEvent, OCL_CLRELEASEEVENT, OpenCL, 1);
|
||||
HC_LOAD_FUNC (ocl, clUnloadPlatformCompiler, OCL_CLUNLOADPLATFORMCOMPILER, OpenCL, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2867,6 +2868,24 @@ int hc_clReleaseEvent (hashcat_ctx_t *hashcat_ctx, cl_event event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hc_clUnloadPlatformCompiler (hashcat_ctx_t *hashcat_ctx, cl_platform_id platform)
|
||||
{
|
||||
backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
||||
|
||||
OCL_PTR *ocl = (OCL_PTR *) backend_ctx->ocl;
|
||||
|
||||
const cl_int CL_err = ocl->clUnloadPlatformCompiler (platform);
|
||||
|
||||
if (CL_err != CL_SUCCESS)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "clUnloadPlatformCompiler(): %s", val2cstr_cl (CL_err));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Backend
|
||||
|
||||
int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw)
|
||||
@ -8869,6 +8888,19 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* no more need for the compiler. cuda doesn't offer this function.
|
||||
* from opencl specs:
|
||||
* Calls to clBuildProgram, clCompileProgram or clLinkProgram after clUnloadPlatformCompiler will reload the compiler, if necessary, to build the appropriate program executable.
|
||||
*/
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
cl_platform_id platform_id = backend_ctx->opencl_platforms[device_param->opencl_platform_id];
|
||||
|
||||
if (hc_clUnloadPlatformCompiler (hashcat_ctx, platform_id) == -1) return -1;
|
||||
}
|
||||
|
||||
hcfree (device_name_chksum);
|
||||
hcfree (device_name_chksum_amp_mp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user