diff --git a/OpenCL/inc_vendor.h b/OpenCL/inc_vendor.h index c39fce952..0916a30b3 100644 --- a/OpenCL/inc_vendor.h +++ b/OpenCL/inc_vendor.h @@ -12,7 +12,7 @@ #define IS_CUDA #elif defined __HIPCC__ #define IS_HIP -#elif defined __METAL_MACOS__ +#elif defined __METAL__ #define IS_METAL #else #define IS_OPENCL diff --git a/src/backend.c b/src/backend.c index 3c63882e1..8aa8c587c 100644 --- a/src/backend.c +++ b/src/backend.c @@ -4503,7 +4503,19 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) if (hc_mtlRuntimeGetVersionString (hashcat_ctx, backend_ctx->metal_runtimeVersionStr, &version_len) == -1) return -1; - // TODO: needs version check + if (atoi (backend_ctx->metal_runtimeVersionStr) < 300) + { + event_log_warning (hashcat_ctx, "Unsupported Apple Metal runtime version '%s' detected! Falling back to OpenCL...", backend_ctx->metal_runtimeVersionStr); + event_log_warning (hashcat_ctx, NULL); + + rc_metal_init = -1; + + backend_ctx->rc_metal_init = rc_metal_init; + + backend_ctx->mtl = NULL; + + mtl_close (hashcat_ctx); + } } else { @@ -4511,6 +4523,8 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx) backend_ctx->rc_metal_init = rc_metal_init; + backend_ctx->mtl = NULL; + mtl_close (hashcat_ctx); } } @@ -9265,8 +9279,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { // set some limits with Metal - device_param->kernel_threads_max = 128; + device_param->kernel_threads_max = 64; + device_param->kernel_threads_min = MIN (device_param->kernel_threads_min, device_param->kernel_threads_max); + device_param->kernel_loops_max = 1024; // autotune go over ... + device_param->kernel_loops_min = MIN (device_param->kernel_loops_min, device_param->kernel_loops_max); } #endif