mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-24 07:28:37 +00:00
Merge pull request #4344 from matrix/metal_core_update_1
update Metal implementation and fix module 30601
This commit is contained in:
commit
fcd98d8f59
@ -32,7 +32,6 @@ typedef enum metalDeviceAttribute
|
||||
MTL_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK,
|
||||
MTL_DEVICE_ATTRIBUTE_CLOCK_RATE,
|
||||
MTL_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK,
|
||||
MTL_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY,
|
||||
MTL_DEVICE_ATTRIBUTE_MAX_TRANSFER_RATE,
|
||||
MTL_DEVICE_ATTRIBUTE_HEADLESS,
|
||||
MTL_DEVICE_ATTRIBUTE_LOW_POWER,
|
||||
@ -71,47 +70,47 @@ typedef struct hc_metal
|
||||
|
||||
typedef hc_metal_t MTL_PTR;
|
||||
|
||||
int mtl_init (void *hashcat_ctx);
|
||||
void mtl_close (void *hashcat_ctx);
|
||||
int mtl_init (void *hashcat_ctx);
|
||||
void mtl_close (void *hashcat_ctx);
|
||||
|
||||
int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str, size_t *size);
|
||||
int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str, size_t *size);
|
||||
|
||||
int hc_mtlDeviceGetCount (void *hashcat_ctx, int *count);
|
||||
int hc_mtlDeviceGet (void *hashcat_ctx, mtl_device_id *metal_device, int ordinal);
|
||||
int hc_mtlDeviceGetName (void *hashcat_ctx, char *name, size_t len, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t attrib, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceTotalMem (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceMaxMemAlloc (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
|
||||
int hc_mtlMemGetInfo (void *hashcat_ctx, size_t *mem_free, size_t *mem_total);
|
||||
int hc_mtlDeviceGetCount (void *hashcat_ctx, int *count);
|
||||
int hc_mtlDeviceGet (void *hashcat_ctx, mtl_device_id *metal_device, int ordinal);
|
||||
int hc_mtlDeviceGetName (void *hashcat_ctx, char *name, size_t len, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t attrib, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceTotalMem (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
|
||||
int hc_mtlDeviceMaxMemAlloc (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
|
||||
int hc_mtlMemGetInfo (void *hashcat_ctx, size_t *mem_free, size_t *mem_total);
|
||||
|
||||
int hc_mtlCreateCommandQueue (void *hashcat_ctx, mtl_device_id metal_device, mtl_command_queue *command_queue);
|
||||
int hc_mtlCreateBuffer (void *hashcat_ctx, mtl_device_id metal_device, size_t size, void *ptr, mtl_mem *metal_buffer);
|
||||
|
||||
int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_library metal_library, const char *func_name, mtl_function *metal_function, mtl_pipeline *metal_pipeline);
|
||||
int hc_mtlCreateCommandQueue (void *hashcat_ctx, mtl_device_id metal_device, mtl_command_queue *command_queue);
|
||||
int hc_mtlCreateBuffer (void *hashcat_ctx, mtl_device_id metal_device, size_t size, void *ptr, mtl_mem *metal_buffer);
|
||||
int hc_mtlCreateKernel (void *hashcat_ctx, mtl_device_id metal_device, mtl_library metal_library, const char *func_name, mtl_function *metal_function, mtl_pipeline *metal_pipeline);
|
||||
|
||||
int hc_mtlGetMaxTotalThreadsPerThreadgroup (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *maxTotalThreadsPerThreadgroup);
|
||||
int hc_mtlGetThreadExecutionWidth (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *threadExecutionWidth);
|
||||
int hc_mtlGetThreadExecutionWidth (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *threadExecutionWidth);
|
||||
int hc_mtlGetStaticThreadgroupMemoryLength (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *staticThreadgroupMemoryLength);
|
||||
|
||||
// copy buffer
|
||||
int hc_mtlMemcpyDtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_mem buf_dst, size_t buf_dst_off, mtl_mem buf_src, size_t buf_src_off, size_t buf_size);
|
||||
int hc_mtlMemcpyDtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_mem buf_dst, size_t buf_dst_off, mtl_mem buf_src, size_t buf_src_off, size_t buf_size);
|
||||
// write
|
||||
int hc_mtlMemcpyHtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_mem buf_dst, size_t buf_dst_off, const void *buf_src, size_t buf_size);
|
||||
int hc_mtlMemcpyHtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_mem buf_dst, size_t buf_dst_off, const void *buf_src, size_t buf_size);
|
||||
// read
|
||||
int hc_mtlMemcpyDtoH (void *hashcat_ctx, mtl_command_queue command_queue, void *buf_dst, mtl_mem buf_src, size_t buf_src_off, size_t buf_size);
|
||||
int hc_mtlMemcpyDtoH (void *hashcat_ctx, mtl_command_queue command_queue, void *buf_dst, mtl_mem buf_src, size_t buf_src_off, size_t buf_size);
|
||||
|
||||
int hc_mtlReleaseMemObject (void *hashcat_ctx, mtl_mem metal_buffer);
|
||||
int hc_mtlReleaseFunction (void *hashcat_ctx, mtl_function metal_function);
|
||||
int hc_mtlReleaseLibrary (void *hashcat_ctx, mtl_function metal_library);
|
||||
int hc_mtlReleaseCommandQueue (void *hashcat_ctx, mtl_command_queue command_queue);
|
||||
int hc_mtlReleaseDevice (void *hashcat_ctx, mtl_device_id metal_device);
|
||||
int hc_mtlReleaseMemObject (void *hashcat_ctx, mtl_mem metal_buffer);
|
||||
int hc_mtlReleaseFunction (void *hashcat_ctx, mtl_function metal_function);
|
||||
int hc_mtlReleaseLibrary (void *hashcat_ctx, mtl_function metal_library);
|
||||
int hc_mtlReleaseCommandQueue (void *hashcat_ctx, mtl_command_queue command_queue);
|
||||
int hc_mtlReleaseDevice (void *hashcat_ctx, mtl_device_id metal_device);
|
||||
|
||||
int hc_mtlCreateLibraryWithSource (void *hashcat_ctx, mtl_device_id metal_device, const char *kernel_sources, const char *build_options_buf, const char *include_path, mtl_library *metal_library);
|
||||
int hc_mtlCreateLibraryWithFile (void *hashcat_ctx, mtl_device_id metal_device, const char *cached_file, mtl_library *metal_library);
|
||||
int hc_mtlCreateLibraryWithSource (void *hashcat_ctx, mtl_device_id metal_device, const char *kernel_sources, const char *build_options_buf, const char *include_path, mtl_library *metal_library);
|
||||
int hc_mtlCreateLibraryWithFile (void *hashcat_ctx, mtl_device_id metal_device, const char *cached_file, mtl_library *metal_library);
|
||||
|
||||
int hc_mtlEncodeComputeCommand_pre (void *hashcat_ctx, mtl_pipeline metal_pipeline, mtl_command_queue metal_command_queue, mtl_command_buffer *metal_command_buffer, mtl_command_encoder *metal_command_encoder);
|
||||
int hc_mtlSetCommandEncoderArg (void *hashcat_ctx, mtl_command_encoder metal_command_encoder, size_t off, size_t idx, mtl_mem buf, void *host_data, size_t host_data_size);
|
||||
int hc_mtlEncodeComputeCommand_pre (void *hashcat_ctx, mtl_pipeline metal_pipeline, mtl_command_queue metal_command_queue, mtl_command_buffer *metal_command_buffer, mtl_command_encoder *metal_command_encoder);
|
||||
int hc_mtlSetCommandEncoderArg (void *hashcat_ctx, mtl_command_encoder metal_command_encoder, size_t off, size_t idx, mtl_mem buf, void *host_data, size_t host_data_size);
|
||||
|
||||
int hc_mtlEncodeComputeCommand (void *hashcat_ctx, mtl_command_encoder metal_command_encoder, mtl_command_buffer metal_command_buffer, const unsigned int work_dim, const size_t global_work_size[3], const size_t local_work_size[3], double *ms);
|
||||
int hc_mtlEncodeComputeCommand (void *hashcat_ctx, mtl_command_encoder metal_command_encoder, mtl_command_buffer metal_command_buffer, const unsigned int work_dim, const size_t global_work_size[3], const size_t local_work_size[3], double *ms);
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
|
336
src/backend.c
336
src/backend.c
@ -119,6 +119,32 @@ static const int kern_run_all[] =
|
||||
KERN_RUN_AUX4,
|
||||
};
|
||||
|
||||
#if defined (__APPLE__)
|
||||
static mtl_pipeline metal_pipeline_with_id (hc_device_param_t *device_param, const int kern_run)
|
||||
{
|
||||
switch (kern_run)
|
||||
{
|
||||
case KERN_RUN_1: return device_param->metal_pipeline1; break;
|
||||
case KERN_RUN_12: return device_param->metal_pipeline12; break;
|
||||
case KERN_RUN_2P: return device_param->metal_pipeline2p; break;
|
||||
case KERN_RUN_2: return device_param->metal_pipeline2; break;
|
||||
case KERN_RUN_2E: return device_param->metal_pipeline2e; break;
|
||||
case KERN_RUN_23: return device_param->metal_pipeline23; break;
|
||||
case KERN_RUN_3: return device_param->metal_pipeline3; break;
|
||||
case KERN_RUN_4: return device_param->metal_pipeline4; break;
|
||||
case KERN_RUN_INIT2: return device_param->metal_pipeline_init2; break;
|
||||
case KERN_RUN_LOOP2P: return device_param->metal_pipeline_loop2p; break;
|
||||
case KERN_RUN_LOOP2: return device_param->metal_pipeline_loop2; break;
|
||||
case KERN_RUN_AUX1: return device_param->metal_pipeline_aux1; break;
|
||||
case KERN_RUN_AUX2: return device_param->metal_pipeline_aux1; break;
|
||||
case KERN_RUN_AUX3: return device_param->metal_pipeline_aux1; break;
|
||||
case KERN_RUN_AUX4: return device_param->metal_pipeline_aux1; break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static cl_kernel opencl_kernel_with_id (hc_device_param_t *device_param, const int kern_run)
|
||||
{
|
||||
switch (kern_run)
|
||||
@ -191,6 +217,30 @@ static CUfunction cuda_function_with_id (hc_device_param_t *device_param, const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined (__APPLE__)
|
||||
int metal_query_max_local_size_bytes (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
{
|
||||
size_t max_local_size_bytes = 0;
|
||||
|
||||
for (int kern_run_idx = 0; kern_run_idx < kern_run_cnt; kern_run_idx++)
|
||||
{
|
||||
mtl_pipeline pipeline = metal_pipeline_with_id (device_param, kern_run_all[kern_run_idx]);
|
||||
|
||||
if (pipeline == NULL) continue;
|
||||
|
||||
size_t local_size_bytes = 0;
|
||||
|
||||
if (hc_mtlGetStaticThreadgroupMemoryLength (hashcat_ctx, pipeline, (unsigned int *) &local_size_bytes) == -1) return -1;
|
||||
|
||||
if (local_size_bytes == 0) continue;
|
||||
|
||||
max_local_size_bytes = MAX (max_local_size_bytes, local_size_bytes);
|
||||
}
|
||||
|
||||
return (int) max_local_size_bytes;
|
||||
}
|
||||
#endif
|
||||
|
||||
int opencl_query_threads_per_block (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_kernel kernel)
|
||||
{
|
||||
size_t threads_per_block = 0;
|
||||
@ -6591,31 +6641,6 @@ static void backend_ctx_devices_init_metal (hashcat_ctx_t *hashcat_ctx, MAYBE_UN
|
||||
device_param->opencl_device_vendor = strdup ("Apple");
|
||||
device_param->opencl_device_c_version = "";
|
||||
|
||||
/* unused and deprecated
|
||||
|
||||
// sm_minor, sm_major
|
||||
|
||||
int mtl_major = 0;
|
||||
int mtl_minor = 0;
|
||||
|
||||
if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_major, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, metal_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlDeviceGetAttribute (hashcat_ctx, &mtl_minor, MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, metal_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->mtl_major = mtl_major;
|
||||
device_param->mtl_minor = mtl_minor;
|
||||
*/
|
||||
|
||||
// device_name
|
||||
|
||||
char *device_name = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
@ -6813,23 +6838,7 @@ static void backend_ctx_devices_init_metal (hashcat_ctx_t *hashcat_ctx, MAYBE_UN
|
||||
|
||||
device_param->device_local_mem_size = max_shared_memory_per_block;
|
||||
|
||||
// device_max_constant_buffer_size
|
||||
|
||||
int device_max_constant_buffer_size = 0;
|
||||
|
||||
if (hc_mtlDeviceGetAttribute (hashcat_ctx, &device_max_constant_buffer_size, MTL_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, metal_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_max_constant_buffer_size < 65536)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "* Device #%u: This device's local mem size is too small.", device_id + 1);
|
||||
|
||||
device_param->skipped = true;
|
||||
}
|
||||
// no device_max_constant_buffer_size on Metal
|
||||
|
||||
// gpu properties
|
||||
|
||||
@ -9349,6 +9358,23 @@ static int get_hip_kernel_local_mem_size (hashcat_ctx_t *hashcat_ctx, hipFunctio
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined (__APPLE__)
|
||||
static int get_metal_kernel_wgs (hashcat_ctx_t *hashcat_ctx, mtl_pipeline pipeline, u32 *result)
|
||||
{
|
||||
return hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, pipeline, result);
|
||||
}
|
||||
|
||||
static int get_metal_kernel_preferred_wgs_multiple (hashcat_ctx_t *hashcat_ctx, mtl_pipeline pipeline, u32 *result)
|
||||
{
|
||||
return hc_mtlGetThreadExecutionWidth (hashcat_ctx, pipeline, result);
|
||||
}
|
||||
|
||||
static int get_metal_kernel_local_mem_size (hashcat_ctx_t *hashcat_ctx, mtl_pipeline pipeline, u64 *result)
|
||||
{
|
||||
return hc_mtlGetStaticThreadgroupMemoryLength (hashcat_ctx, pipeline, (unsigned int *) result);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int get_opencl_kernel_wgs (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_kernel kernel, u32 *result)
|
||||
{
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
@ -10732,19 +10758,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
else if (device_param->is_metal == true)
|
||||
{
|
||||
// metal: todo - remove this section after below section is implemented
|
||||
|
||||
const u32 native_threads = device_param->kernel_preferred_wgs_multiple;
|
||||
|
||||
if ((native_threads >= device_param->kernel_threads_min) && (native_threads <= device_param->kernel_threads_max))
|
||||
{
|
||||
device_param->kernel_threads_min = native_threads;
|
||||
device_param->kernel_threads_max = native_threads;
|
||||
}
|
||||
else
|
||||
{
|
||||
// abort?
|
||||
}
|
||||
// we will find this after loading the kernel with suppport of runtime api
|
||||
}
|
||||
}
|
||||
|
||||
@ -11447,11 +11461,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_memset, &device_param->kernel_wgs_memset) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_memset, &device_param->kernel_wgs_memset) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_memset, &device_param->kernel_local_mem_size_memset) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_memset, &device_param->kernel_preferred_wgs_multiple_memset) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_memset = 0;
|
||||
device_param->kernel_dynamic_local_mem_size_memset = 0;
|
||||
device_param->kernel_preferred_wgs_multiple_memset = device_param->metal_warp_size;
|
||||
|
||||
// GPU bzero
|
||||
|
||||
@ -11465,11 +11481,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_bzero, &device_param->kernel_wgs_bzero) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_bzero, &device_param->kernel_wgs_bzero) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_bzero, &device_param->kernel_local_mem_size_bzero) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_bzero, &device_param->kernel_preferred_wgs_multiple_bzero) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_bzero = 0;
|
||||
device_param->kernel_dynamic_local_mem_size_bzero = 0;
|
||||
device_param->kernel_preferred_wgs_multiple_bzero = device_param->metal_warp_size;
|
||||
|
||||
// GPU autotune init
|
||||
|
||||
@ -11483,11 +11501,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_atinit, &device_param->kernel_wgs_atinit) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_atinit, &device_param->kernel_wgs_atinit) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_atinit, &device_param->kernel_local_mem_size_atinit) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_atinit, &device_param->kernel_preferred_wgs_multiple_atinit) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_atinit = 0;
|
||||
device_param->kernel_dynamic_local_mem_size_atinit = 0;
|
||||
device_param->kernel_preferred_wgs_multiple_atinit = device_param->metal_warp_size;
|
||||
|
||||
// GPU decompress
|
||||
|
||||
@ -11501,11 +11521,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_decompress, &device_param->kernel_wgs_decompress) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_decompress, &device_param->kernel_wgs_decompress) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_decompress, &device_param->kernel_local_mem_size_decompress) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_decompress, &device_param->kernel_preferred_wgs_multiple_decompress) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_decompress = 0;
|
||||
device_param->kernel_dynamic_local_mem_size_decompress = 0;
|
||||
device_param->kernel_preferred_wgs_multiple_decompress = device_param->metal_warp_size;
|
||||
|
||||
// GPU utf8 to utf16le conversion
|
||||
|
||||
@ -11519,11 +11541,13 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_utf8toutf16le, &device_param->kernel_wgs_utf8toutf16le) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_utf8toutf16le, &device_param->kernel_wgs_utf8toutf16le) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_utf8toutf16le, &device_param->kernel_local_mem_size_utf8toutf16le) == -1) return -1;
|
||||
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_utf8toutf16le, &device_param->kernel_preferred_wgs_multiple_utf8toutf16le) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_utf8toutf16le = 0;
|
||||
device_param->kernel_dynamic_local_mem_size_utf8toutf16le = 0;
|
||||
device_param->kernel_preferred_wgs_multiple_utf8toutf16le = device_param->metal_warp_size;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -14511,11 +14535,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_local_mem_size1) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size1 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size1 = 0;
|
||||
|
||||
@ -14533,11 +14557,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_local_mem_size2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size2 = 0;
|
||||
|
||||
@ -14555,11 +14579,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_local_mem_size3) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size3 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size3 = 0;
|
||||
}
|
||||
@ -14579,11 +14603,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_wgs4) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_wgs4) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_preferred_wgs_multiple4) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_local_mem_size4) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size4 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_preferred_wgs_multiple4) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size4 = 0;
|
||||
}
|
||||
@ -14606,11 +14630,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_local_mem_size1) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size1 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size1 = 0;
|
||||
|
||||
@ -14628,11 +14652,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_local_mem_size2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size2 = 0;
|
||||
|
||||
@ -14650,11 +14674,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_local_mem_size3) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size3 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size3 = 0;
|
||||
}
|
||||
@ -14674,11 +14698,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_wgs4) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_wgs4) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_preferred_wgs_multiple4) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_local_mem_size4) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size4 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline4, &device_param->kernel_preferred_wgs_multiple4) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size4 = 0;
|
||||
}
|
||||
@ -14705,11 +14729,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_tm, &device_param->kernel_wgs_tm) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_tm, &device_param->kernel_wgs_tm) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_tm, &device_param->kernel_preferred_wgs_multiple_tm) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_tm, &device_param->kernel_local_mem_size_tm) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_tm = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_tm, &device_param->kernel_preferred_wgs_multiple_tm) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_tm = 0;
|
||||
}
|
||||
@ -14732,11 +14756,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_wgs1) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_local_mem_size1) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size1 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline1, &device_param->kernel_preferred_wgs_multiple1) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size1 = 0;
|
||||
|
||||
@ -14754,11 +14778,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_wgs2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_local_mem_size2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline2, &device_param->kernel_preferred_wgs_multiple2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size2 = 0;
|
||||
|
||||
@ -14776,11 +14800,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_wgs3) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_local_mem_size3) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size3 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline3, &device_param->kernel_preferred_wgs_multiple3) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size3 = 0;
|
||||
|
||||
@ -14800,11 +14824,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline2p, &device_param->kernel_wgs2p) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline2p, &device_param->kernel_wgs2p) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline2p, &device_param->kernel_preferred_wgs_multiple2p) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline2p, &device_param->kernel_local_mem_size2p) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size2p = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline2p, &device_param->kernel_preferred_wgs_multiple2p) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size2p = 0;
|
||||
}
|
||||
@ -14825,11 +14849,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline2e, &device_param->kernel_wgs2e) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline2e, &device_param->kernel_wgs2e) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline2e, &device_param->kernel_preferred_wgs_multiple2e) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline2e, &device_param->kernel_local_mem_size2e) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size2e = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline2e, &device_param->kernel_preferred_wgs_multiple2e) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size2e = 0;
|
||||
}
|
||||
@ -14850,11 +14874,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline12, &device_param->kernel_wgs12) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline12, &device_param->kernel_wgs12) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline12, &device_param->kernel_preferred_wgs_multiple12) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline12, &device_param->kernel_local_mem_size12) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size12 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline12, &device_param->kernel_preferred_wgs_multiple12) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size12 = 0;
|
||||
}
|
||||
@ -14875,11 +14899,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline23, &device_param->kernel_wgs23) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline23, &device_param->kernel_wgs23) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline23, &device_param->kernel_preferred_wgs_multiple23) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline23, &device_param->kernel_local_mem_size23) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size23 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline23, &device_param->kernel_preferred_wgs_multiple23) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size23 = 0;
|
||||
}
|
||||
@ -14900,11 +14924,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_init2, &device_param->kernel_wgs_init2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_init2, &device_param->kernel_wgs_init2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_init2, &device_param->kernel_preferred_wgs_multiple_init2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_init2, &device_param->kernel_local_mem_size_init2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_init2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_init2, &device_param->kernel_preferred_wgs_multiple_init2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_init2 = 0;
|
||||
}
|
||||
@ -14925,11 +14949,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_loop2p, &device_param->kernel_wgs_loop2p) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_loop2p, &device_param->kernel_wgs_loop2p) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_loop2p, &device_param->kernel_preferred_wgs_multiple_loop2p) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_loop2p, &device_param->kernel_local_mem_size_loop2p) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_loop2p = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_loop2p, &device_param->kernel_preferred_wgs_multiple_loop2p) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_loop2p = 0;
|
||||
}
|
||||
@ -14950,11 +14974,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_loop2, &device_param->kernel_wgs_loop2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_loop2, &device_param->kernel_wgs_loop2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_loop2, &device_param->kernel_preferred_wgs_multiple_loop2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_loop2, &device_param->kernel_local_mem_size_loop2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_loop2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_loop2, &device_param->kernel_preferred_wgs_multiple_loop2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_loop2 = 0;
|
||||
}
|
||||
@ -14975,11 +14999,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_aux1, &device_param->kernel_wgs_aux1) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_aux1, &device_param->kernel_wgs_aux1) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_aux1, &device_param->kernel_preferred_wgs_multiple_aux1) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_aux1, &device_param->kernel_local_mem_size_aux1) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_aux1 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_aux1, &device_param->kernel_preferred_wgs_multiple_aux1) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_aux1 = 0;
|
||||
}
|
||||
@ -15000,11 +15024,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_aux2, &device_param->kernel_wgs_aux2) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_aux2, &device_param->kernel_wgs_aux2) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_aux2, &device_param->kernel_preferred_wgs_multiple_aux2) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_aux2, &device_param->kernel_local_mem_size_aux2) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_aux2 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_aux2, &device_param->kernel_preferred_wgs_multiple_aux2) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_aux2 = 0;
|
||||
}
|
||||
@ -15025,11 +15049,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_aux3, &device_param->kernel_wgs_aux3) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_aux3, &device_param->kernel_wgs_aux3) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_aux3, &device_param->kernel_preferred_wgs_multiple_aux3) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_aux3, &device_param->kernel_local_mem_size_aux3) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_aux3 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_aux3, &device_param->kernel_preferred_wgs_multiple_aux3) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_aux3 = 0;
|
||||
}
|
||||
@ -15050,11 +15074,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_aux4, &device_param->kernel_wgs_aux4) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_aux4, &device_param->kernel_wgs_aux4) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_aux4, &device_param->kernel_preferred_wgs_multiple_aux4) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_aux4, &device_param->kernel_local_mem_size_aux4) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_aux4 = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_aux4, &device_param->kernel_preferred_wgs_multiple_aux4) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_aux4 = 0;
|
||||
}
|
||||
@ -15081,11 +15105,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_mp_l, &device_param->kernel_wgs_mp_l) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_mp_l, &device_param->kernel_wgs_mp_l) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_mp_l, &device_param->kernel_preferred_wgs_multiple_mp_l) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_mp_l, &device_param->kernel_local_mem_size_mp_l) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_mp_l = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_mp_l, &device_param->kernel_preferred_wgs_multiple_mp_l) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_mp_l = 0;
|
||||
|
||||
@ -15101,11 +15125,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_mp_r, &device_param->kernel_wgs_mp_r) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_mp_r, &device_param->kernel_wgs_mp_r) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_mp_r, &device_param->kernel_preferred_wgs_multiple_mp_r) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_mp_r, &device_param->kernel_local_mem_size_mp_r) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_mp_r = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_mp_r, &device_param->kernel_preferred_wgs_multiple_mp_r) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_mp_r = 0;
|
||||
}
|
||||
@ -15123,11 +15147,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_wgs_mp) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_wgs_mp) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_preferred_wgs_multiple_mp) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_local_mem_size_mp) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_mp = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_preferred_wgs_multiple_mp) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_mp = 0;
|
||||
}
|
||||
@ -15145,11 +15169,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_wgs_mp) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_wgs_mp) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_preferred_wgs_multiple_mp) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_local_mem_size_mp) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_mp = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_mp, &device_param->kernel_preferred_wgs_multiple_mp) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_mp = 0;
|
||||
}
|
||||
@ -15178,11 +15202,11 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_mtlGetMaxTotalThreadsPerThreadgroup (hashcat_ctx, device_param->metal_pipeline_amp, &device_param->kernel_wgs_amp) == -1) return -1;
|
||||
if (get_metal_kernel_wgs (hashcat_ctx, device_param->metal_pipeline_amp, &device_param->kernel_wgs_amp) == -1) return -1;
|
||||
|
||||
if (hc_mtlGetThreadExecutionWidth (hashcat_ctx, device_param->metal_pipeline_amp, &device_param->kernel_preferred_wgs_multiple_amp) == -1) return -1;
|
||||
if (get_metal_kernel_local_mem_size (hashcat_ctx, device_param->metal_pipeline_amp, &device_param->kernel_local_mem_size_amp) == -1) return -1;
|
||||
|
||||
device_param->kernel_local_mem_size_amp = 0;
|
||||
if (get_metal_kernel_preferred_wgs_multiple (hashcat_ctx, device_param->metal_pipeline_amp, &device_param->kernel_preferred_wgs_multiple_amp) == -1) return -1;
|
||||
|
||||
device_param->kernel_dynamic_local_mem_size_amp = 0;
|
||||
}
|
||||
@ -16299,7 +16323,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
if (device_param->is_cuda == true) local_size_bytes = cuda_query_max_local_size_bytes (hashcat_ctx, device_param);
|
||||
if (device_param->is_hip == true) local_size_bytes = hip_query_max_local_size_bytes (hashcat_ctx, device_param);
|
||||
if (device_param->is_opencl == true) local_size_bytes = opencl_query_max_local_size_bytes (hashcat_ctx, device_param);
|
||||
// metal todo
|
||||
#if defined(__APPLE__)
|
||||
if (device_param->is_metal == true) local_size_bytes = metal_query_max_local_size_bytes (hashcat_ctx, device_param);
|
||||
#endif
|
||||
}
|
||||
|
||||
const u64 size_device_extra1234 = size_extra_buffer1 + size_extra_buffer2 + size_extra_buffer3 + size_extra_buffer4;
|
||||
|
201
src/ext_metal.m
201
src/ext_metal.m
@ -17,21 +17,9 @@
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <Metal/Metal.h>
|
||||
|
||||
/*
|
||||
typedef NS_ENUM(NSUInteger, hc_mtlFeatureSet)
|
||||
{
|
||||
MTL_FEATURESET_MACOS_GPUFAMILY_1_V1 = 10000,
|
||||
MTL_FEATURESET_MACOS_GPUFAMILY_1_V2 = 10001,
|
||||
MTL_FEATURESET_MACOS_GPUFAMILY_1_V3 = 10003,
|
||||
MTL_FEATURESET_MACOS_GPUFAMILY_1_V4 = 10004,
|
||||
MTL_FEATURESET_MACOS_GPUFAMILY_2_V1 = 10005,
|
||||
|
||||
} metalDeviceFeatureSet_macOS_t;
|
||||
*/
|
||||
|
||||
typedef NS_ENUM(NSUInteger, hc_mtlLanguageVersion)
|
||||
{
|
||||
MTL_LANGUAGEVERSION_1_0 = (1 << 16),
|
||||
//MTL_LANGUAGEVERSION_1_0 = (1 << 16),
|
||||
MTL_LANGUAGEVERSION_1_1 = (1 << 16) + 1,
|
||||
MTL_LANGUAGEVERSION_1_2 = (1 << 16) + 2,
|
||||
MTL_LANGUAGEVERSION_2_0 = (2 << 16),
|
||||
@ -39,6 +27,9 @@ typedef NS_ENUM(NSUInteger, hc_mtlLanguageVersion)
|
||||
MTL_LANGUAGEVERSION_2_2 = (2 << 16) + 2,
|
||||
MTL_LANGUAGEVERSION_2_3 = (2 << 16) + 3,
|
||||
MTL_LANGUAGEVERSION_2_4 = (2 << 16) + 4,
|
||||
MTL_LANGUAGEVERSION_3_0 = (3 << 16),
|
||||
MTL_LANGUAGEVERSION_3_1 = (3 << 16) + 1,
|
||||
MTL_LANGUAGEVERSION_3_2 = (3 << 16) + 2
|
||||
|
||||
} metalLanguageVersion_t;
|
||||
|
||||
@ -110,12 +101,14 @@ static int hc_mtlBuildOptionsToDict (void *hashcat_ctx, const char *build_option
|
||||
if (build_options_buf == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): build_options_buf is NULL", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (build_options_dict == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): build_options_dict is NULL", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -126,6 +119,7 @@ static int hc_mtlBuildOptionsToDict (void *hashcat_ctx, const char *build_option
|
||||
if (options == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): stringWithCString failed", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -136,6 +130,7 @@ static int hc_mtlBuildOptionsToDict (void *hashcat_ctx, const char *build_option
|
||||
if (options == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): stringByReplacingOccurrencesOfString(-D) failed", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -146,6 +141,7 @@ static int hc_mtlBuildOptionsToDict (void *hashcat_ctx, const char *build_option
|
||||
if (options == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): stringByReplacingOccurrencesOfString(-I OpenCL) failed", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -245,14 +241,17 @@ void mtl_close (void *hashcat_ctx)
|
||||
if (mtl->devices)
|
||||
{
|
||||
int count = (int) CFArrayGetCount (mtl->devices);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
mtl_device_id device = (mtl_device_id) CFArrayGetValueAtIndex (mtl->devices, i);
|
||||
|
||||
if (device != nil)
|
||||
{
|
||||
hc_mtlReleaseDevice (hashcat_ctx, device);
|
||||
}
|
||||
}
|
||||
|
||||
mtl->devices = nil;
|
||||
}
|
||||
|
||||
@ -423,44 +422,6 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
*pi = 32;
|
||||
break;
|
||||
|
||||
/* unused and deprecated
|
||||
case MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR:
|
||||
*pi = 0;
|
||||
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_2_V1] == true) *pi = 2;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V4] == true) *pi = 1;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V3] == true) *pi = 1;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V2] == true) *pi = 1;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V1] == true) *pi = 1;
|
||||
|
||||
if (*pi == 0)
|
||||
{
|
||||
//event_log_error (hashcat_ctx, "%s(): no feature sets supported", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
*/
|
||||
|
||||
/* unused and deprecated
|
||||
case MTL_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR:
|
||||
*pi = 0;
|
||||
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_2_V1] == true) *pi = 1;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V4] == true) *pi = 4;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V3] == true) *pi = 3;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V2] == true) *pi = 2;
|
||||
if (*pi == 0 && [metal_device supportsFeatureSet:MTL_FEATURESET_MACOS_GPUFAMILY_1_V1] == true) *pi = 1;
|
||||
|
||||
if (*pi == 0)
|
||||
{
|
||||
//event_log_error (hashcat_ctx, "%s(): no feature sets supported", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
*/
|
||||
|
||||
case MTL_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK:
|
||||
// M1 max is 1024
|
||||
// [MTLComputePipelineState maxTotalThreadsPerThreadgroup]
|
||||
@ -474,16 +435,21 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
|
||||
case MTL_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK:
|
||||
// 32k
|
||||
*pi = 32768;
|
||||
break;
|
||||
*pi = 0;
|
||||
|
||||
valULong = 0;
|
||||
|
||||
SEL maxThreadgroupMemoryLengthSelector = NSSelectorFromString (@"maxThreadgroupMemoryLength");
|
||||
|
||||
hc_mtlInvocationHelper (metal_device, maxThreadgroupMemoryLengthSelector, &valULong);
|
||||
|
||||
*pi = valULong;
|
||||
|
||||
case MTL_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY:
|
||||
// Maximum function memory allocation for a buffer in the constant address space
|
||||
// 64k
|
||||
*pi = 64 * 1024;
|
||||
break;
|
||||
|
||||
case MTL_DEVICE_ATTRIBUTE_MAX_TRANSFER_RATE:
|
||||
*pi = 0;
|
||||
|
||||
val64 = 0;
|
||||
|
||||
SEL maxTransferRateSelector = NSSelectorFromString (@"maxTransferRate");
|
||||
@ -516,9 +482,10 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_PHYSICAL_LOCATION:
|
||||
*pi = 0;
|
||||
|
||||
SEL locationSelector = NSSelectorFromString (@"location");
|
||||
valULong = 0;
|
||||
|
||||
SEL locationSelector = NSSelectorFromString (@"location");
|
||||
|
||||
hc_mtlInvocationHelper (metal_device, locationSelector, &valULong);
|
||||
|
||||
*pi = valULong;
|
||||
@ -528,9 +495,10 @@ int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t
|
||||
case MTL_DEVICE_ATTRIBUTE_LOCATION_NUMBER:
|
||||
*pi = 0;
|
||||
|
||||
valULong = 0;
|
||||
|
||||
SEL locationNumberSelector = NSSelectorFromString (@"locationNumber");
|
||||
|
||||
valULong = 0;
|
||||
hc_mtlInvocationHelper (metal_device, locationNumberSelector, &valULong);
|
||||
|
||||
*pi = valULong;
|
||||
@ -839,6 +807,26 @@ int hc_mtlGetThreadExecutionWidth (void *hashcat_ctx, mtl_pipeline metal_pipelin
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hc_mtlGetStaticThreadgroupMemoryLength (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *staticThreadgroupMemoryLength)
|
||||
{
|
||||
backend_ctx_t *backend_ctx = ((hashcat_ctx_t *) hashcat_ctx)->backend_ctx;
|
||||
|
||||
MTL_PTR *mtl = (MTL_PTR *) backend_ctx->mtl;
|
||||
|
||||
if (mtl == NULL) return -1;
|
||||
|
||||
if (metal_pipeline == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): invalid pipeline", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
*staticThreadgroupMemoryLength = [metal_pipeline staticThreadgroupMemoryLength];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hc_mtlCreateBuffer (void *hashcat_ctx, mtl_device_id metal_device, size_t size, void *ptr, mtl_mem *metal_buffer)
|
||||
{
|
||||
backend_ctx_t *backend_ctx = ((hashcat_ctx_t *) hashcat_ctx)->backend_ctx;
|
||||
@ -966,36 +954,56 @@ int hc_mtlMemcpyDtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_me
|
||||
if (command_queue == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal command queue is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal src buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src_off < 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): src buffer offset is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal dst buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst_off < 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): dst buffer offset is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_size <= 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): buffer size is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src_off + buf_size > [buf_src length])
|
||||
{
|
||||
event_log_error(hashcat_ctx, "%s(): src buffer offset + size out of bounds", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst_off + buf_size > [buf_dst length])
|
||||
{
|
||||
event_log_error(hashcat_ctx, "%s(): dst buffer offset + size out of bounds", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1012,6 +1020,7 @@ int hc_mtlMemcpyDtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_me
|
||||
if (blit_encoder == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): failed to create a blit command encoder", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1038,30 +1047,42 @@ int hc_mtlMemcpyHtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_me
|
||||
if (command_queue == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal command queue is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal src buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): host dst buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_size <= 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): buffer size is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst_off < 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): buffer dst offset is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst_off + buf_size > [buf_dst length])
|
||||
{
|
||||
event_log_error(hashcat_ctx, "%s(): buffer offset + size out of bounds", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1081,6 +1102,8 @@ int hc_mtlMemcpyHtoD (void *hashcat_ctx, mtl_command_queue command_queue, mtl_me
|
||||
return -1;
|
||||
}
|
||||
|
||||
// On macOS Intel, for Managed storage, notify GPU of modified range. Not on Apple Silicon
|
||||
|
||||
[buf_dst didModifyRange: NSMakeRange (buf_dst_off, buf_size)];
|
||||
|
||||
return 0;
|
||||
@ -1093,24 +1116,35 @@ int hc_mtlMemcpyDtoH (void *hashcat_ctx, mtl_command_queue command_queue, void *
|
||||
if (command_queue == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal command queue is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): metal src buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_dst == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): host dst buffer is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_size <= 0)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): buffer size is invalid", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf_src_off + buf_size > [buf_src length])
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): buffer offset + size out of bounds", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1119,11 +1153,14 @@ int hc_mtlMemcpyDtoH (void *hashcat_ctx, mtl_command_queue command_queue, void *
|
||||
if (command_buffer == nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): failed to create a new command buffer", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
id<MTLBlitCommandEncoder> blit_encoder = [command_buffer blitCommandEncoder];
|
||||
|
||||
// On macOS Intel, for Managed storage, synchronizeResource. Not on Apple Silicon
|
||||
|
||||
[blit_encoder synchronizeResource: buf_src];
|
||||
|
||||
// Finish encoding and start the data transfer to the CPU
|
||||
@ -1198,6 +1235,7 @@ int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str,
|
||||
|
||||
CFRelease (plist_stream);
|
||||
CFRelease (plist_url);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1209,7 +1247,9 @@ int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str,
|
||||
{
|
||||
CFIndex len = CFStringGetLength (runtime_version_str);
|
||||
CFIndex maxSize = CFStringGetMaximumSizeForEncoding (len, kCFStringEncodingUTF8) + 1;
|
||||
|
||||
*size = maxSize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1359,22 +1399,22 @@ int hc_mtlEncodeComputeCommand (void *hashcat_ctx, mtl_command_encoder metal_com
|
||||
[metal_command_encoder dispatchThreadgroups: threadgroupsPerGrid threadsPerThreadgroup: threadsPerThreadgroup];
|
||||
|
||||
[metal_command_encoder endEncoding];
|
||||
|
||||
// using completition handler to get GPU timing
|
||||
|
||||
__block CFTimeInterval elapsed = 0;
|
||||
|
||||
[metal_command_buffer addCompletedHandler:^(id<MTLCommandBuffer> cb) {
|
||||
CFTimeInterval gpuStart = cb.GPUStartTime;
|
||||
CFTimeInterval gpuEnd = cb.GPUEndTime;
|
||||
elapsed = gpuEnd - gpuStart;
|
||||
|
||||
*ms = elapsed * 1000.0;
|
||||
}];
|
||||
|
||||
[metal_command_buffer commit];
|
||||
[metal_command_buffer waitUntilCompleted];
|
||||
|
||||
CFTimeInterval myGPUStartTime = 0;
|
||||
CFTimeInterval myGPUEndTime = 0;
|
||||
|
||||
SEL myGPUStartTimeSelector = NSSelectorFromString (@"GPUStartTime");
|
||||
SEL myGPUEndTimeSelector = NSSelectorFromString (@"GPUEndTime");
|
||||
|
||||
if (hc_mtlInvocationHelper (metal_command_buffer, myGPUStartTimeSelector, &myGPUStartTime) == -1) return -1;
|
||||
if (hc_mtlInvocationHelper (metal_command_buffer, myGPUEndTimeSelector, &myGPUEndTime) == -1) return -1;
|
||||
|
||||
CFTimeInterval elapsed = myGPUEndTime - myGPUStartTime;
|
||||
|
||||
*ms = (1000.0 * elapsed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1409,6 +1449,7 @@ int hc_mtlCreateLibraryWithFile (void *hashcat_ctx, mtl_device_id metal_device,
|
||||
if (error != nil)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s(): failed to create metal library from metallib, %s", __func__, [[error localizedDescription] UTF8String]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1444,6 +1485,7 @@ int hc_mtlCreateLibraryWithSource (void *hashcat_ctx, mtl_device_id metal_device
|
||||
event_log_error (hashcat_ctx, "%s(): failed to build options dictionary", __func__);
|
||||
|
||||
[build_options_dict release];
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1454,14 +1496,25 @@ int hc_mtlCreateLibraryWithSource (void *hashcat_ctx, mtl_device_id metal_device
|
||||
compileOptions.mathMode = MTLMathModeSafe;
|
||||
// compileOptions.mathMode = MTLMathModeRelaxed;
|
||||
// compileOptions.enableLogging = true;
|
||||
// compileOptions.fastMathEnabled = false;
|
||||
*/
|
||||
}
|
||||
|
||||
// todo: detect current os version and choose the right
|
||||
// compileOptions.languageVersion = MTL_LANGUAGEVERSION_2_3;
|
||||
/*
|
||||
if (@available(macOS 12.0, *))
|
||||
if (@available(macOS 15.0, *))
|
||||
{
|
||||
compileOptions.languageVersion = MTL_LANGUAGEVERSION_3_2;
|
||||
}
|
||||
else if (@available(macOS 14.0, *))
|
||||
{
|
||||
compileOptions.languageVersion = MTL_LANGUAGEVERSION_3_1;
|
||||
}
|
||||
else if (@available(macOS 13.0, *))
|
||||
{
|
||||
compileOptions.languageVersion = MTL_LANGUAGEVERSION_3_0;
|
||||
}
|
||||
else if (@available(macOS 12.0, *))
|
||||
{
|
||||
compileOptions.languageVersion = MTL_LANGUAGEVERSION_2_4;
|
||||
}
|
||||
|
@ -1731,31 +1731,29 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
const hc_device_param_t *device_param = backend_ctx->devices_param + backend_devices_idx;
|
||||
|
||||
int device_id = device_param->device_id;
|
||||
//int device_mtl_maj = device_param->mtl_major;
|
||||
//int device_mtl_min = device_param->mtl_minor;
|
||||
int device_max_transfer_rate = device_param->device_max_transfer_rate;
|
||||
int device_physical_location = device_param->device_physical_location;
|
||||
int device_location_number = device_param->device_location_number;
|
||||
int device_registryID = device_param->device_registryID;
|
||||
int device_is_headless = device_param->device_is_headless;
|
||||
int device_is_low_power = device_param->device_is_low_power;
|
||||
int device_is_removable = device_param->device_is_removable;
|
||||
int device_id = device_param->device_id;
|
||||
int device_max_transfer_rate = device_param->device_max_transfer_rate;
|
||||
int device_physical_location = device_param->device_physical_location;
|
||||
int device_location_number = device_param->device_location_number;
|
||||
int device_registryID = device_param->device_registryID;
|
||||
int device_is_headless = device_param->device_is_headless;
|
||||
int device_is_low_power = device_param->device_is_low_power;
|
||||
int device_is_removable = device_param->device_is_removable;
|
||||
|
||||
char *device_name = device_param->device_name;
|
||||
char *device_name = device_param->device_name;
|
||||
|
||||
u32 device_processors = device_param->device_processors;
|
||||
u32 device_processors = device_param->device_processors;
|
||||
|
||||
u64 device_global_mem = device_param->device_global_mem;
|
||||
u64 device_maxmem_alloc = device_param->device_maxmem_alloc;
|
||||
u64 device_available_mem = device_param->device_available_mem;
|
||||
u64 device_local_mem_size = device_param->device_local_mem_size;
|
||||
int device_host_unified_memory = device_param->device_host_unified_memory;
|
||||
u32 kernel_preferred_wgs_multiple = device_param->kernel_preferred_wgs_multiple;
|
||||
u64 device_global_mem = device_param->device_global_mem;
|
||||
u64 device_maxmem_alloc = device_param->device_maxmem_alloc;
|
||||
u64 device_available_mem = device_param->device_available_mem;
|
||||
u64 device_local_mem_size = device_param->device_local_mem_size;
|
||||
int device_host_unified_memory = device_param->device_host_unified_memory;
|
||||
u32 kernel_preferred_wgs_multiple = device_param->kernel_preferred_wgs_multiple;
|
||||
|
||||
cl_device_type opencl_device_type = device_param->opencl_device_type;
|
||||
cl_uint opencl_device_vendor_id = device_param->opencl_device_vendor_id;
|
||||
char *opencl_device_vendor = device_param->opencl_device_vendor;
|
||||
cl_device_type opencl_device_type = device_param->opencl_device_type;
|
||||
cl_uint opencl_device_vendor_id = device_param->opencl_device_vendor_id;
|
||||
char *opencl_device_vendor = device_param->opencl_device_vendor;
|
||||
|
||||
if (device_param->device_id_alias_cnt)
|
||||
{
|
||||
@ -1792,6 +1790,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
event_log_info (hashcat_ctx, " Clock..........: N/A");
|
||||
event_log_info (hashcat_ctx, " Memory.Total...: %" PRIu64 " MB (limited to %" PRIu64 " MB allocatable in one block)", device_global_mem / 1024 / 1024, device_maxmem_alloc / 1024 / 1024);
|
||||
event_log_info (hashcat_ctx, " Memory.Free....: %" PRIu64 " MB", device_available_mem / 1024 / 1024);
|
||||
event_log_info (hashcat_ctx, " Memory.Unified.: %d", device_host_unified_memory);
|
||||
event_log_info (hashcat_ctx, " Local.Memory...: %" PRIu64 " KB", device_local_mem_size / 1024);
|
||||
}
|
||||
else
|
||||
@ -1806,6 +1805,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
printf ("\"MemoryTotal\": \"%" PRIu64 " MB\", ", device_global_mem / 1024 / 1024);
|
||||
printf ("\"MemoryAllocPerBlock\": \"%" PRIu64 " MB\", ", device_maxmem_alloc / 1024 / 1024);
|
||||
printf ("\"MemoryFree\": \"%" PRIu64 " MB\", ", device_available_mem / 1024 / 1024);
|
||||
printf ("\"MemoryUnified\": \"%d\", ", device_host_unified_memory);
|
||||
printf ("\"LocalMemory\": \"%" PRIu64 " MB\", ", device_local_mem_size / 1024);
|
||||
}
|
||||
|
||||
@ -1868,17 +1868,6 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
if (device_mtl_maj > 0 && device_mtl_min > 0)
|
||||
{
|
||||
event_log_info (hashcat_ctx, " Feature.Set....: macOS GPU Family %u v%u", device_mtl_maj, device_mtl_min);
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_info (hashcat_ctx, " Feature.Set....: N/A");
|
||||
}
|
||||
*/
|
||||
|
||||
if (user_options->machine_readable == false)
|
||||
{
|
||||
event_log_info (hashcat_ctx, " Registry.ID....: %u", device_registryID);
|
||||
@ -2080,6 +2069,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
printf ("\"VendorID\": \"%u\", ", opencl_device_vendor_id);
|
||||
printf ("\"Vendor\": \"%s\", ", opencl_device_vendor);
|
||||
printf ("\"Name\": \"%s\", ", device_name);
|
||||
printf ("\"Version\": \"%s\", ", opencl_device_version);
|
||||
printf ("\"Processors\": \"%u\", ", device_processors);
|
||||
printf ("\"PreferredThreadSize\": \"%u\", ", kernel_preferred_wgs_multiple);
|
||||
printf ("\"Clock\": \"%u\", ", device_maxclock_frequency);
|
||||
@ -2089,7 +2079,7 @@ void backend_info (hashcat_ctx_t *hashcat_ctx)
|
||||
printf ("\"MemoryUnified\": \"%d\", ", device_host_unified_memory);
|
||||
printf ("\"LocalMemory\": \"%" PRIu64 " MB\", ", device_local_mem_size / 1024);
|
||||
printf ("\"OpenCLVersion\": \"%s\", ", opencl_device_c_version);
|
||||
printf ("\"DriverVersion\": \"%s\" ", opencl_device_version);
|
||||
printf ("\"DriverVersion\": \"%s\" ", opencl_driver_version);
|
||||
}
|
||||
|
||||
if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
|
Loading…
Reference in New Issue
Block a user