Skip to content

Commit fcd98d8

Browse files
authored
Merge pull request hashcat#4344 from matrix/metal_core_update_1
update Metal implementation and fix module 30601
2 parents 3973ec9 + c751424 commit fcd98d8

4 files changed

Lines changed: 360 additions & 292 deletions

File tree

include/ext_metal.h

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ typedef enum metalDeviceAttribute
3232
MTL_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK,
3333
MTL_DEVICE_ATTRIBUTE_CLOCK_RATE,
3434
MTL_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK,
35-
MTL_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY,
3635
MTL_DEVICE_ATTRIBUTE_MAX_TRANSFER_RATE,
3736
MTL_DEVICE_ATTRIBUTE_HEADLESS,
3837
MTL_DEVICE_ATTRIBUTE_LOW_POWER,
@@ -71,47 +70,47 @@ typedef struct hc_metal
7170

7271
typedef hc_metal_t MTL_PTR;
7372

74-
int mtl_init (void *hashcat_ctx);
75-
void mtl_close (void *hashcat_ctx);
73+
int mtl_init (void *hashcat_ctx);
74+
void mtl_close (void *hashcat_ctx);
7675

77-
int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str, size_t *size);
76+
int hc_mtlRuntimeGetVersionString (void *hashcat_ctx, char *runtimeVersion_str, size_t *size);
7877

79-
int hc_mtlDeviceGetCount (void *hashcat_ctx, int *count);
80-
int hc_mtlDeviceGet (void *hashcat_ctx, mtl_device_id *metal_device, int ordinal);
81-
int hc_mtlDeviceGetName (void *hashcat_ctx, char *name, size_t len, mtl_device_id metal_device);
82-
int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t attrib, mtl_device_id metal_device);
83-
int hc_mtlDeviceTotalMem (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
84-
int hc_mtlDeviceMaxMemAlloc (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
85-
int hc_mtlMemGetInfo (void *hashcat_ctx, size_t *mem_free, size_t *mem_total);
78+
int hc_mtlDeviceGetCount (void *hashcat_ctx, int *count);
79+
int hc_mtlDeviceGet (void *hashcat_ctx, mtl_device_id *metal_device, int ordinal);
80+
int hc_mtlDeviceGetName (void *hashcat_ctx, char *name, size_t len, mtl_device_id metal_device);
81+
int hc_mtlDeviceGetAttribute (void *hashcat_ctx, int *pi, metalDeviceAttribute_t attrib, mtl_device_id metal_device);
82+
int hc_mtlDeviceTotalMem (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
83+
int hc_mtlDeviceMaxMemAlloc (void *hashcat_ctx, size_t *bytes, mtl_device_id metal_device);
84+
int hc_mtlMemGetInfo (void *hashcat_ctx, size_t *mem_free, size_t *mem_total);
8685

87-
int hc_mtlCreateCommandQueue (void *hashcat_ctx, mtl_device_id metal_device, mtl_command_queue *command_queue);
88-
int hc_mtlCreateBuffer (void *hashcat_ctx, mtl_device_id metal_device, size_t size, void *ptr, mtl_mem *metal_buffer);
89-
90-
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);
86+
int hc_mtlCreateCommandQueue (void *hashcat_ctx, mtl_device_id metal_device, mtl_command_queue *command_queue);
87+
int hc_mtlCreateBuffer (void *hashcat_ctx, mtl_device_id metal_device, size_t size, void *ptr, mtl_mem *metal_buffer);
88+
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);
9189

9290
int hc_mtlGetMaxTotalThreadsPerThreadgroup (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *maxTotalThreadsPerThreadgroup);
93-
int hc_mtlGetThreadExecutionWidth (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *threadExecutionWidth);
91+
int hc_mtlGetThreadExecutionWidth (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *threadExecutionWidth);
92+
int hc_mtlGetStaticThreadgroupMemoryLength (void *hashcat_ctx, mtl_pipeline metal_pipeline, unsigned int *staticThreadgroupMemoryLength);
9493

9594
// copy buffer
96-
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);
95+
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);
9796
// write
98-
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);
97+
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);
9998
// read
100-
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);
99+
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);
101100

102-
int hc_mtlReleaseMemObject (void *hashcat_ctx, mtl_mem metal_buffer);
103-
int hc_mtlReleaseFunction (void *hashcat_ctx, mtl_function metal_function);
104-
int hc_mtlReleaseLibrary (void *hashcat_ctx, mtl_function metal_library);
105-
int hc_mtlReleaseCommandQueue (void *hashcat_ctx, mtl_command_queue command_queue);
106-
int hc_mtlReleaseDevice (void *hashcat_ctx, mtl_device_id metal_device);
101+
int hc_mtlReleaseMemObject (void *hashcat_ctx, mtl_mem metal_buffer);
102+
int hc_mtlReleaseFunction (void *hashcat_ctx, mtl_function metal_function);
103+
int hc_mtlReleaseLibrary (void *hashcat_ctx, mtl_function metal_library);
104+
int hc_mtlReleaseCommandQueue (void *hashcat_ctx, mtl_command_queue command_queue);
105+
int hc_mtlReleaseDevice (void *hashcat_ctx, mtl_device_id metal_device);
107106

108-
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);
109-
int hc_mtlCreateLibraryWithFile (void *hashcat_ctx, mtl_device_id metal_device, const char *cached_file, mtl_library *metal_library);
107+
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);
108+
int hc_mtlCreateLibraryWithFile (void *hashcat_ctx, mtl_device_id metal_device, const char *cached_file, mtl_library *metal_library);
110109

111-
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);
112-
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);
110+
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);
111+
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);
113112

114-
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);
113+
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);
115114

116115
#endif // __APPLE__
117116

0 commit comments

Comments
 (0)