mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Update hwmon to easier distinguish between CPU and GPU for OpenCL backend
This commit is contained in:
parent
47848d2b64
commit
71c0ea44b7
@ -44,6 +44,7 @@
|
||||
|
||||
- Alias Devices: Show a warning in case the user specifically listed a device to use which in a later step is skipped because it is an alias of another active device
|
||||
- Backend Information: Added new column showing the PCI Address per CUDA/OpenCL device to easier identify broken cards
|
||||
- CPU Affinity: Allow mask up to 64 processors in Windows and remove call to SetThreadAffinityMask as SetProcessAffinityMask limits all threads in process
|
||||
- Debug Rules: HEX-ify rules debug non-rules outputs that contain colons
|
||||
- KeePass: Increase supported size for KeePass 1 databases from 300kB to 16MB
|
||||
- Potfile: Disable potfile for hash-mode 99999
|
||||
|
121
src/hwmon.c
121
src/hwmon.c
@ -97,8 +97,8 @@ int hm_get_threshold_slowdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -143,6 +143,7 @@ int hm_get_threshold_slowdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].threshold_slowdown_get_supported = false;
|
||||
|
||||
@ -177,8 +178,8 @@ int hm_get_threshold_shutdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -211,6 +212,7 @@ int hm_get_threshold_shutdown_with_devices_idx (hashcat_ctx_t *hashcat_ctx, cons
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].threshold_shutdown_get_supported = false;
|
||||
|
||||
@ -244,6 +246,8 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
}
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_platform_vendor_id == VENDOR_ID_APPLE)
|
||||
@ -252,18 +256,7 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
{
|
||||
double temperature = 0.0;
|
||||
|
||||
char *key = NULL;
|
||||
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) key = HM_IOKIT_SMC_CPU_PROXIMITY;
|
||||
else
|
||||
{
|
||||
key = HM_IOKIT_SMC_GPU_PROXIMITY;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_INTEL_BEIGNET)
|
||||
{
|
||||
key = HM_IOKIT_SMC_PECI_GPU;
|
||||
}
|
||||
}
|
||||
char *key = HM_IOKIT_SMC_CPU_PROXIMITY;
|
||||
|
||||
if (hm_IOKIT_SMCGetTemperature(hashcat_ctx, key, &temperature) == -1)
|
||||
{
|
||||
@ -275,8 +268,35 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
return (int) temperature;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
#if defined (__APPLE__)
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_platform_vendor_id == VENDOR_ID_APPLE)
|
||||
{
|
||||
if (hwmon_ctx->hm_iokit)
|
||||
{
|
||||
double temperature = 0.0;
|
||||
|
||||
char *key = HM_IOKIT_SMC_GPU_PROXIMITY;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_INTEL_BEIGNET)
|
||||
{
|
||||
key = HM_IOKIT_SMC_PECI_GPU;
|
||||
}
|
||||
|
||||
if (hm_IOKIT_SMCGetTemperature (hashcat_ctx, key, &temperature) == -1)
|
||||
{
|
||||
hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (int) temperature;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
@ -346,6 +366,7 @@ int hm_get_temperature_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].temperature_get_supported = false;
|
||||
|
||||
@ -368,8 +389,8 @@ int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -411,6 +432,7 @@ int hm_get_fanpolicy_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].fanpolicy_get_supported = false;
|
||||
hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false;
|
||||
@ -465,8 +487,8 @@ int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -540,6 +562,7 @@ int hm_get_fanspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].fanspeed_get_supported = false;
|
||||
|
||||
@ -574,8 +597,8 @@ int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -626,6 +649,7 @@ int hm_get_buslanes_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].buslanes_get_supported = false;
|
||||
|
||||
@ -660,8 +684,8 @@ int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -712,6 +736,7 @@ int hm_get_utilization_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].utilization_get_supported = false;
|
||||
|
||||
@ -746,8 +771,8 @@ int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -798,6 +823,7 @@ int hm_get_memoryspeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int b
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].memoryspeed_get_supported = false;
|
||||
|
||||
@ -832,8 +858,8 @@ int hm_get_corespeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (hwmon_ctx->hm_adl)
|
||||
@ -884,6 +910,7 @@ int hm_get_corespeed_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int bac
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].corespeed_get_supported = false;
|
||||
|
||||
@ -947,8 +974,8 @@ int hm_get_throttle_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].is_opencl == true)
|
||||
{
|
||||
if ((backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) return -1;
|
||||
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (backend_ctx->devices_param[backend_device_idx].opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
}
|
||||
@ -999,6 +1026,7 @@ int hm_get_throttle_with_devices_idx (hashcat_ctx_t *hashcat_ctx, const int back
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hwmon_ctx->hm_device[backend_device_idx].throttle_get_supported = false;
|
||||
|
||||
@ -1485,6 +1513,32 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
|
||||
if (device_param->is_opencl == true)
|
||||
{
|
||||
if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE)
|
||||
{
|
||||
if (hwmon_ctx->hm_iokit)
|
||||
{
|
||||
hwmon_ctx->hm_device[backend_devices_idx].iokit = hm_adapters_iokit[device_id].iokit;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].buslanes_get_supported |= hm_adapters_iokit[device_id].buslanes_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].corespeed_get_supported |= hm_adapters_iokit[device_id].corespeed_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].fanspeed_get_supported |= hm_adapters_iokit[device_id].fanspeed_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].fanpolicy_get_supported |= hm_adapters_iokit[device_id].fanpolicy_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].memoryspeed_get_supported |= hm_adapters_iokit[device_id].memoryspeed_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].temperature_get_supported |= hm_adapters_iokit[device_id].temperature_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].threshold_shutdown_get_supported |= hm_adapters_iokit[device_id].threshold_shutdown_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].threshold_slowdown_get_supported |= hm_adapters_iokit[device_id].threshold_slowdown_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].throttle_get_supported |= hm_adapters_iokit[device_id].throttle_get_supported;
|
||||
hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_iokit[device_id].utilization_get_supported;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
if (device_param->opencl_platform_vendor_id == VENDOR_ID_APPLE)
|
||||
@ -1504,8 +1558,6 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hwmon_ctx->hm_device[backend_devices_idx].utilization_get_supported |= hm_adapters_iokit[device_id].utilization_get_supported;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if ((device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) == 0) continue;
|
||||
#endif
|
||||
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
@ -1578,6 +1630,7 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// by calling the different functions here this will disable them in case they will error out
|
||||
// this will also reduce the error itself printed to the user to a single print on startup
|
||||
|
Loading…
Reference in New Issue
Block a user