mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Add OPTS_TYPE_NATIVE_THREADS for use by plugin developer to enforce native thread count (useful for scrypt)
This commit is contained in:
parent
67d189e10a
commit
ff96015f53
@ -435,6 +435,7 @@ typedef enum opts_type
|
||||
OPTS_TYPE_DYNAMIC_SHARED = (1ULL << 48), // use dynamic shared memory (note: needs special kernel changes)
|
||||
OPTS_TYPE_SELF_TEST_DISABLE = (1ULL << 49), // some algos use JiT in combinations with a salt or create too much startup time
|
||||
OPTS_TYPE_MP_MULTI_DISABLE = (1ULL << 50), // do not multiply the kernel-accel with the multiprocessor count per device to allow more fine-tuned workload settings
|
||||
OPTS_TYPE_NATIVE_THREADS = (1ULL << 51), // forces "native" thread count: CPU=1, GPU-Intel=8, GPU-AMD=64 (wavefront), GPU-NV=32 (warps)
|
||||
|
||||
} opts_type_t;
|
||||
|
||||
|
@ -8166,6 +8166,62 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
const u32 device_processors = device_param->device_processors;
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE)
|
||||
{
|
||||
u32 native_accel = device_processors;
|
||||
|
||||
if ((native_accel >= device_param->kernel_accel_min) && (native_accel <= device_param->kernel_accel_max))
|
||||
{
|
||||
device_param->kernel_accel_min = native_accel;
|
||||
device_param->kernel_accel_max = native_accel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* device threads
|
||||
*/
|
||||
|
||||
if (hashconfig->opts_type & OPTS_TYPE_NATIVE_THREADS)
|
||||
{
|
||||
u32 native_threads = 0;
|
||||
|
||||
if (device_param->opencl_device_type & CL_DEVICE_TYPE_CPU)
|
||||
{
|
||||
native_threads = 1;
|
||||
}
|
||||
else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU)
|
||||
{
|
||||
// for GPU we need to distinguish by vendor
|
||||
|
||||
if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK)
|
||||
{
|
||||
native_threads = 8;
|
||||
}
|
||||
else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
native_threads = 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
native_threads = 32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// abort?
|
||||
}
|
||||
|
||||
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?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create context for each device
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user