|
|
|
@ -25970,6 +25970,66 @@ u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
|
return kernel_threads;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 hashconfig_limited_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param)
|
|
|
|
|
{
|
|
|
|
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
|
|
|
|
|
|
u32 kernel_threads = 0;
|
|
|
|
|
|
|
|
|
|
// sometimes there's a high kernel requirement for local memory (which is multiplied with threads)
|
|
|
|
|
|
|
|
|
|
u32 local_mem_per_thread = 0;
|
|
|
|
|
|
|
|
|
|
// basically the sum of all .local space of the _loop kernel
|
|
|
|
|
// see .ptx
|
|
|
|
|
|
|
|
|
|
if (hashconfig->hash_mode == 1800) local_mem_per_thread = 1024;
|
|
|
|
|
if (hashconfig->hash_mode == 12500) local_mem_per_thread = 3296;
|
|
|
|
|
if (hashconfig->hash_mode == 13400) local_mem_per_thread = 5360;
|
|
|
|
|
|
|
|
|
|
if (local_mem_per_thread)
|
|
|
|
|
{
|
|
|
|
|
const u32 device_local_mem_size = (const u32) device_param->device_local_mem_size;
|
|
|
|
|
|
|
|
|
|
kernel_threads = device_local_mem_size / local_mem_per_thread;
|
|
|
|
|
|
|
|
|
|
// there can be some very unaligned results from this, therefore round it down to next power of two
|
|
|
|
|
|
|
|
|
|
kernel_threads = power_of_two_floor_32 (kernel_threads);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// make sure to not underpower
|
|
|
|
|
|
|
|
|
|
if (kernel_threads)
|
|
|
|
|
{
|
|
|
|
|
if (device_param->device_type & CL_DEVICE_TYPE_CPU)
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MAX (kernel_threads, KERNEL_THREADS_NATIVE_CPU);
|
|
|
|
|
}
|
|
|
|
|
else if (device_param->device_type & CL_DEVICE_TYPE_GPU)
|
|
|
|
|
{
|
|
|
|
|
if (device_param->device_vendor_id == VENDOR_ID_NV)
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MAX (kernel_threads, KERNEL_THREADS_NATIVE_GPU_NV);
|
|
|
|
|
}
|
|
|
|
|
else if (device_param->device_vendor_id == VENDOR_ID_AMD)
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MAX (kernel_threads, KERNEL_THREADS_NATIVE_GPU_AMD);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MAX (kernel_threads, KERNEL_THREADS_NATIVE_GPU);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MAX (kernel_threads, KERNEL_THREADS_NATIVE_OTHER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return kernel_threads;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param)
|
|
|
|
|
{
|
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
@ -25980,13 +26040,22 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p
|
|
|
|
|
|
|
|
|
|
if (forced_kernel_threads) return forced_kernel_threads;
|
|
|
|
|
|
|
|
|
|
// otherwise it depends on the opencl device type
|
|
|
|
|
// it can also depends on the opencl device type
|
|
|
|
|
|
|
|
|
|
u32 kernel_threads = (const u32) device_param->device_maxworkgroup_size;
|
|
|
|
|
u32 kernel_threads = (u32) device_param->device_maxworkgroup_size;
|
|
|
|
|
|
|
|
|
|
if (device_param->device_type & CL_DEVICE_TYPE_CPU)
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MIN (kernel_threads, KERNEL_THREADS_MAX_CPU);
|
|
|
|
|
kernel_threads = MIN (kernel_threads, KERNEL_THREADS_NATIVE_CPU);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// or if it requires for example a lot of local memory
|
|
|
|
|
|
|
|
|
|
const u32 limited_kernel_threads = hashconfig_limited_kernel_threads (hashcat_ctx, device_param);
|
|
|
|
|
|
|
|
|
|
if (limited_kernel_threads)
|
|
|
|
|
{
|
|
|
|
|
kernel_threads = MIN (kernel_threads, limited_kernel_threads);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return kernel_threads;
|
|
|
|
@ -25994,7 +26063,7 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p
|
|
|
|
|
|
|
|
|
|
u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
|
{
|
|
|
|
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
|
|
u32 kernel_loops_fixed = 0;
|
|
|
|
|