mirror of
https://github.com/hashcat/hashcat
synced 2024-12-01 20:18:12 +01:00
switch to skip instead return -1 for all checks, moved cuda counter update to the end of loop
This commit is contained in:
parent
f4dbd46b71
commit
4c2605f7f2
321
src/backend.c
321
src/backend.c
@ -5482,7 +5482,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
CUdevice cuda_device;
|
||||
|
||||
if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx) == -1) return -1;
|
||||
if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->cuda_device = cuda_device;
|
||||
|
||||
@ -5498,7 +5502,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
char *device_name = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
if (hc_cuDeviceGetName (hashcat_ctx, device_name, HCBUFSIZ_TINY, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetName (hashcat_ctx, device_name, HCBUFSIZ_TINY, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_name = device_name;
|
||||
|
||||
@ -5510,7 +5518,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int device_processors = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_processors, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_processors, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_processors = device_processors;
|
||||
|
||||
@ -5518,7 +5530,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
size_t bytes = 0;
|
||||
|
||||
if (hc_cuDeviceTotalMem (hashcat_ctx, &bytes, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceTotalMem (hashcat_ctx, &bytes, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_global_mem = (u64) bytes;
|
||||
|
||||
@ -5530,7 +5546,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int cuda_warp_size = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &cuda_warp_size, CU_DEVICE_ATTRIBUTE_WARP_SIZE, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &cuda_warp_size, CU_DEVICE_ATTRIBUTE_WARP_SIZE, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->cuda_warp_size = cuda_warp_size;
|
||||
|
||||
@ -5539,9 +5559,17 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
int sm_major = 0;
|
||||
int sm_minor = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &sm_major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &sm_major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &sm_minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &sm_minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->sm_major = sm_major;
|
||||
device_param->sm_minor = sm_minor;
|
||||
@ -5550,7 +5578,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int device_maxworkgroup_size = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_maxworkgroup_size, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_maxworkgroup_size, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_maxworkgroup_size = device_maxworkgroup_size;
|
||||
|
||||
@ -5558,7 +5590,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int device_maxclock_frequency = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_maxclock_frequency, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_maxclock_frequency, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_maxclock_frequency = device_maxclock_frequency / 1000;
|
||||
|
||||
@ -5568,11 +5604,23 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
int pci_bus_id_nv = 0;
|
||||
int pci_slot_id_nv = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_domain_id_nv, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_domain_id_nv, CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_bus_id_nv, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_bus_id_nv, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_slot_id_nv, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &pci_slot_id_nv, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->pcie_domain = (u8) (pci_domain_id_nv);
|
||||
device_param->pcie_bus = (u8) (pci_bus_id_nv);
|
||||
@ -5583,7 +5631,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int kernel_exec_timeout = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &kernel_exec_timeout, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &kernel_exec_timeout, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->kernel_exec_timeout = kernel_exec_timeout;
|
||||
|
||||
@ -5591,7 +5643,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int max_shared_memory_per_block = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &max_shared_memory_per_block, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &max_shared_memory_per_block, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (max_shared_memory_per_block < 32768)
|
||||
{
|
||||
@ -5606,7 +5662,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
int device_max_constant_buffer_size = 0;
|
||||
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_max_constant_buffer_size, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, cuda_device) == -1) return -1;
|
||||
if (hc_cuDeviceGetAttribute (hashcat_ctx, &device_max_constant_buffer_size, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY, cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_max_constant_buffer_size < 65536)
|
||||
{
|
||||
@ -5684,11 +5744,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* activate device
|
||||
*/
|
||||
|
||||
cuda_devices_active++;
|
||||
// activate device moved below, at end
|
||||
}
|
||||
|
||||
// instruction set
|
||||
@ -5713,18 +5769,40 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
CUcontext cuda_context;
|
||||
|
||||
if (hc_cuCtxCreate (hashcat_ctx, &cuda_context, CU_CTX_SCHED_BLOCKING_SYNC, device_param->cuda_device) == -1) return -1;
|
||||
if (hc_cuCtxCreate (hashcat_ctx, &cuda_context, CU_CTX_SCHED_BLOCKING_SYNC, device_param->cuda_device) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_cuCtxSetCurrent (hashcat_ctx, cuda_context) == -1) return -1;
|
||||
if (hc_cuCtxSetCurrent (hashcat_ctx, cuda_context) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t free = 0;
|
||||
size_t total = 0;
|
||||
|
||||
if (hc_cuMemGetInfo (hashcat_ctx, &free, &total) == -1) return -1;
|
||||
if (hc_cuMemGetInfo (hashcat_ctx, &free, &total) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_available_mem = (u64) free;
|
||||
|
||||
if (hc_cuCtxDestroy (hashcat_ctx, cuda_context) == -1) return -1;
|
||||
if (hc_cuCtxDestroy (hashcat_ctx, cuda_context) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* activate device
|
||||
*/
|
||||
|
||||
if (device_param->skipped == false) cuda_devices_active++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5810,7 +5888,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_device_type opencl_device_type;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_TYPE, sizeof (opencl_device_type), &opencl_device_type, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_TYPE, sizeof (opencl_device_type), &opencl_device_type, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
opencl_device_type &= ~CL_DEVICE_TYPE_DEFAULT;
|
||||
|
||||
@ -5818,11 +5900,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
// device_name
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_NAME, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_NAME, 0, NULL, ¶m_value_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *device_name = (char *) hcmalloc (param_value_size);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_NAME, param_value_size, device_name, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_NAME, param_value_size, device_name, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_name = device_name;
|
||||
|
||||
@ -5832,11 +5922,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
// device_vendor
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VENDOR, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VENDOR, 0, NULL, ¶m_value_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *opencl_device_vendor = (char *) hcmalloc (param_value_size);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VENDOR, param_value_size, opencl_device_vendor, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VENDOR, param_value_size, opencl_device_vendor, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->opencl_device_vendor = opencl_device_vendor;
|
||||
|
||||
@ -5899,21 +5997,37 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
// device_version
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VERSION, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VERSION, 0, NULL, ¶m_value_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *opencl_device_version = (char *) hcmalloc (param_value_size);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VERSION, param_value_size, opencl_device_version, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_VERSION, param_value_size, opencl_device_version, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->opencl_device_version = opencl_device_version;
|
||||
|
||||
// opencl_device_c_version
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_OPENCL_C_VERSION, 0, NULL, ¶m_value_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *opencl_device_c_version = (char *) hcmalloc (param_value_size);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_OPENCL_C_VERSION, param_value_size, opencl_device_c_version, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_OPENCL_C_VERSION, param_value_size, opencl_device_c_version, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->opencl_device_c_version = opencl_device_c_version;
|
||||
|
||||
@ -5921,7 +6035,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_uint device_processors = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof (device_processors), &device_processors, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof (device_processors), &device_processors, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_processors = device_processors;
|
||||
|
||||
@ -5929,7 +6047,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_ulong device_global_mem = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof (device_global_mem), &device_global_mem, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof (device_global_mem), &device_global_mem, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_global_mem = device_global_mem;
|
||||
|
||||
@ -5939,7 +6061,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_ulong device_maxmem_alloc = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof (device_maxmem_alloc), &device_maxmem_alloc, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof (device_maxmem_alloc), &device_maxmem_alloc, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_maxmem_alloc = device_maxmem_alloc;
|
||||
|
||||
@ -5951,7 +6077,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
size_t device_maxworkgroup_size = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof (device_maxworkgroup_size), &device_maxworkgroup_size, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof (device_maxworkgroup_size), &device_maxworkgroup_size, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_maxworkgroup_size = device_maxworkgroup_size;
|
||||
|
||||
@ -5959,7 +6089,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_uint device_maxclock_frequency = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof (device_maxclock_frequency), &device_maxclock_frequency, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_CLOCK_FREQUENCY, sizeof (device_maxclock_frequency), &device_maxclock_frequency, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_maxclock_frequency = device_maxclock_frequency;
|
||||
|
||||
@ -5967,7 +6101,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_bool device_endian_little = CL_FALSE;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_ENDIAN_LITTLE, sizeof (device_endian_little), &device_endian_little, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_ENDIAN_LITTLE, sizeof (device_endian_little), &device_endian_little, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_endian_little == CL_FALSE)
|
||||
{
|
||||
@ -5980,7 +6118,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_bool device_available = CL_FALSE;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_AVAILABLE, sizeof (device_available), &device_available, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_AVAILABLE, sizeof (device_available), &device_available, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_available == CL_FALSE)
|
||||
{
|
||||
@ -5993,7 +6135,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_bool device_compiler_available = CL_FALSE;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPILER_AVAILABLE, sizeof (device_compiler_available), &device_compiler_available, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPILER_AVAILABLE, sizeof (device_compiler_available), &device_compiler_available, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_compiler_available == CL_FALSE)
|
||||
{
|
||||
@ -6006,7 +6152,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_device_exec_capabilities device_execution_capabilities;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXECUTION_CAPABILITIES, sizeof (device_execution_capabilities), &device_execution_capabilities, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXECUTION_CAPABILITIES, sizeof (device_execution_capabilities), &device_execution_capabilities, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((device_execution_capabilities & CL_EXEC_KERNEL) == 0)
|
||||
{
|
||||
@ -6019,11 +6169,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
size_t device_extensions_size;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, 0, NULL, &device_extensions_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, 0, NULL, &device_extensions_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *device_extensions = (char *) hcmalloc (device_extensions_size + 1);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, device_extensions_size, device_extensions, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_EXTENSIONS, device_extensions_size, device_extensions, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strstr (device_extensions, "base_atomics") == 0)
|
||||
{
|
||||
@ -6045,7 +6203,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_device_local_mem_type device_local_mem_type;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (device_local_mem_type), &device_local_mem_type, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_LOCAL_MEM_TYPE, sizeof (device_local_mem_type), &device_local_mem_type, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->device_local_mem_type = device_local_mem_type;
|
||||
|
||||
@ -6053,7 +6215,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_ulong device_max_constant_buffer_size;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof (device_max_constant_buffer_size), &device_max_constant_buffer_size, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, sizeof (device_max_constant_buffer_size), &device_max_constant_buffer_size, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_local_mem_type == CL_LOCAL)
|
||||
{
|
||||
@ -6069,7 +6235,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
cl_ulong device_local_mem_size = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_LOCAL_MEM_SIZE, sizeof (device_local_mem_size), &device_local_mem_size, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_LOCAL_MEM_SIZE, sizeof (device_local_mem_size), &device_local_mem_size, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_local_mem_type == CL_LOCAL)
|
||||
{
|
||||
@ -6228,11 +6398,19 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
|
||||
// driver_version
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DRIVER_VERSION, 0, NULL, ¶m_value_size) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DRIVER_VERSION, 0, NULL, ¶m_value_size) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *opencl_driver_version = (char *) hcmalloc (param_value_size);
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DRIVER_VERSION, param_value_size, opencl_driver_version, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DRIVER_VERSION, param_value_size, opencl_driver_version, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->opencl_driver_version = opencl_driver_version;
|
||||
|
||||
@ -6265,7 +6443,11 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
{
|
||||
cl_device_topology_amd amdtopo;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_TOPOLOGY_AMD, sizeof (amdtopo), &amdtopo, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_TOPOLOGY_AMD, sizeof (amdtopo), &amdtopo, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->pcie_domain = 0; // no attribute to query
|
||||
device_param->pcie_bus = amdtopo.pcie.bus;
|
||||
@ -6278,9 +6460,17 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
cl_uint pci_bus_id_nv; // is cl_uint the right type for them??
|
||||
cl_uint pci_slot_id_nv;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_PCI_BUS_ID_NV, sizeof (pci_bus_id_nv), &pci_bus_id_nv, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_PCI_BUS_ID_NV, sizeof (pci_bus_id_nv), &pci_bus_id_nv, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_PCI_SLOT_ID_NV, sizeof (pci_slot_id_nv), &pci_slot_id_nv, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_PCI_SLOT_ID_NV, sizeof (pci_slot_id_nv), &pci_slot_id_nv, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->pcie_domain = 0; // no attribute to query
|
||||
device_param->pcie_bus = (u8) (pci_bus_id_nv);
|
||||
@ -6290,16 +6480,28 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
int sm_minor = 0;
|
||||
int sm_major = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, sizeof (sm_minor), &sm_minor, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, sizeof (sm_minor), &sm_minor, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, sizeof (sm_major), &sm_major, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, sizeof (sm_major), &sm_major, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->sm_minor = sm_minor;
|
||||
device_param->sm_major = sm_major;
|
||||
|
||||
cl_uint kernel_exec_timeout = 0;
|
||||
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, sizeof (kernel_exec_timeout), &kernel_exec_timeout, NULL) == -1) return -1;
|
||||
if (hc_clGetDeviceInfo (hashcat_ctx, device_param->opencl_device, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, sizeof (kernel_exec_timeout), &kernel_exec_timeout, NULL) == -1)
|
||||
{
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
device_param->kernel_exec_timeout = kernel_exec_timeout;
|
||||
|
||||
@ -6416,7 +6618,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
||||
event_log_warning (hashcat_ctx, NULL);
|
||||
|
||||
return -1;
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6454,7 +6657,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
||||
event_log_warning (hashcat_ctx, NULL);
|
||||
|
||||
return -1;
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6503,7 +6707,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
||||
event_log_warning (hashcat_ctx, NULL);
|
||||
|
||||
return -1;
|
||||
device_param->skipped = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (device_param->sm_major < 5)
|
||||
|
Loading…
Reference in New Issue
Block a user