Added support for Apple Silicon compute devices

pull/3058/head
Gabriele Gristina 3 years ago
parent e88122019b
commit 0fae3a4394

@ -5170,13 +5170,6 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi
// with apple GPU clEnqueueWriteBuffer() return CL_INVALID_VALUE, workaround
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE && \
(device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK || device_param->opencl_device_vendor_id == VENDOR_ID_APPLE) && \
device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
{
return run_opencl_kernel_memset (hashcat_ctx, device_param, buf, 0, 0, size);
}
if (num16d)
{
const u64 kernel_threads = device_param->kernel_wgs_bzero;
@ -5196,7 +5189,20 @@ int run_opencl_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *devi
if (num16m)
{
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, bzeros, 0, NULL, NULL) == -1) return -1;
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE && \
(device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK || device_param->opencl_device_vendor_id == VENDOR_ID_APPLE) && \
device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
{
u8 *bzeros_apple = (u8 *) hccalloc (num16m, sizeof (u8));
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_TRUE, num16d * 16, num16m, bzeros_apple, 0, NULL, NULL) == -1) return -1;
hcfree (bzeros_apple);
}
else
{
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, buf, CL_FALSE, num16d * 16, num16m, bzeros, 0, NULL, NULL) == -1) return -1;
}
}
return 0;
@ -10535,7 +10541,7 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p
// workaround opencl issue with Apple Silicon
if (strcmp (device_param->device_name, "Apple M") != 0)
if (strncmp (device_param->device_name, "Apple M", 7) == 0)
{
if (hc_clCreateProgramWithSource (hashcat_ctx, device_param->opencl_context, 1, (const char **) kernel_sources, NULL, opencl_program) == -1) return false;
@ -10562,7 +10568,7 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p
int rc_clGetProgramBuildInfo;
if (strcmp (device_param->device_name, "Apple M") != 0)
if (strncmp (device_param->device_name, "Apple M", 7) == 0)
{
rc_clGetProgramBuildInfo = hc_clGetProgramBuildInfo (hashcat_ctx, *opencl_program, device_param->opencl_device, CL_PROGRAM_BUILD_LOG, build_log_size, build_log, NULL);
}
@ -10589,10 +10595,7 @@ static bool load_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_p
// workaround opencl issue with Apple Silicon
if (strcmp (device_param->device_name, "Apple M") != 0)
{
}
else
if (strncmp (device_param->device_name, "Apple M", 7) != 0)
{
cl_program t2[1];

Loading…
Cancel
Save