mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-04 13:52:40 +00:00
OpenCL Backend: added workaround to set device_available_memory from CUDA/HIP alias device
This commit is contained in:
parent
2af580b448
commit
12f1fe56aa
@ -130,6 +130,7 @@
|
||||
- Modules: Added support for non-zero IVs for -m 6800 (Lastpass). Also added `tools/lastpass2hashcat.py`
|
||||
- Modules: Updated module_unstable_warning
|
||||
- Open Document Format: Added support for small documents with content length < 1024
|
||||
- OpenCL Backend: added workaround to set device_available_memory from CUDA/HIP alias device
|
||||
- Status Code: Add specific return code for self-test fail (-11)
|
||||
- Scrypt: Increase buffer sizes in module for hash mode 8900 to allow longer scrypt digests
|
||||
- Unicode: Update UTF-8 to UTF-16 conversion to match RFC 3629
|
||||
|
@ -8363,6 +8363,56 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
}
|
||||
|
||||
// available device memory
|
||||
// first trying to check if we can get device_available_mem from cuda/hip alias device
|
||||
|
||||
bool updated_device_available_mem = false;
|
||||
|
||||
if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
if (device_param->opencl_platform_vendor_id == VENDOR_ID_NV)
|
||||
{
|
||||
if (backend_ctx->cuda_devices_cnt > 0 && backend_ctx->cuda_devices_active > 0)
|
||||
{
|
||||
for (int cuda_devices_idx = 0; cuda_devices_idx < backend_ctx->cuda_devices_cnt; cuda_devices_idx++)
|
||||
{
|
||||
const int tmp_backend_devices_idx = backend_ctx->backend_device_from_cuda[cuda_devices_idx];
|
||||
|
||||
hc_device_param_t *tmp_device_param = backend_ctx->devices_param + tmp_backend_devices_idx;
|
||||
|
||||
if (is_same_device (device_param, tmp_device_param))
|
||||
{
|
||||
device_param->device_available_mem = tmp_device_param->device_available_mem;
|
||||
updated_device_available_mem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (device_param->opencl_platform_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (backend_ctx->hip_devices_cnt > 0 && backend_ctx->hip_devices_active > 0)
|
||||
{
|
||||
for (int hip_devices_idx = 0; hip_devices_idx < backend_ctx->hip_devices_cnt; hip_devices_idx++)
|
||||
{
|
||||
const int tmp_backend_devices_idx = backend_ctx->backend_device_from_hip[hip_devices_idx];
|
||||
|
||||
hc_device_param_t *tmp_device_param = backend_ctx->devices_param + tmp_backend_devices_idx;
|
||||
|
||||
if (is_same_device (device_param, tmp_device_param))
|
||||
{
|
||||
device_param->device_available_mem = tmp_device_param->device_available_mem;
|
||||
updated_device_available_mem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if not found ... use old strategy
|
||||
|
||||
if (updated_device_available_mem == false)
|
||||
{
|
||||
// This test causes an GPU memory usage spike.
|
||||
// In case there are multiple hashcat instances starting at the same time this will cause GPU out of memory errors which otherwise would not exist.
|
||||
// We will simply not run it if that device was skipped by the user.
|
||||
@ -8473,6 +8523,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check again to catch error on OpenCL/Metal
|
||||
if (backend_ctx->backend_devices_active == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user