diff --git a/src/interface.c b/src/interface.c index b9d90dc38..b8165a3f2 100644 --- a/src/interface.c +++ b/src/interface.c @@ -25957,17 +25957,6 @@ u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx) u32 kernel_threads = 0; - // DES kernels needs to have a minimum thread count only - // because of the bitsliced kernel and the workgroup division done on it - - if (hashconfig->hash_mode == 1500) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 3000) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 3100) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 8500) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 14000) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 14100) kernel_threads = 64; // DES - if (hashconfig->hash_mode == 16000) kernel_threads = 64; // DES - // this should have a kernel hint attribute in the kernel files // __attribute__((reqd_work_group_size(X, 1, 1))) @@ -25991,7 +25980,8 @@ u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx) u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const user_options_t *user_options = hashcat_ctx->user_options; // a kernel can force a fixed value @@ -25999,9 +25989,19 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p if (forced_kernel_threads) return forced_kernel_threads; - // for CPU we just do 1 + // for CPU we just do 1 ... - if (device_param->device_type & CL_DEVICE_TYPE_CPU) return 1; + if (device_param->device_type & CL_DEVICE_TYPE_CPU) + { + // ... as long as it is not a bitsliced kernel, as they have a fixed 2nd dimension size of 32 in run_kernel + + if ((hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE) && (user_options->attack_mode == ATTACK_MODE_BF)) + { + return 32; + } + + return 1; + } // this is an upper limit, a good start, since our strategy is to reduce thread counts only diff --git a/src/opencl.c b/src/opencl.c index 96d0f9032..ae3b22331 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -3947,9 +3947,11 @@ static int get_kernel_wgs (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device if (CL_rc == -1) return -1; - if (compile_work_group_size[0] > 0) + const size_t cwgs_total = compile_work_group_size[0] * compile_work_group_size[1] * compile_work_group_size[2]; + + if (cwgs_total > 0) { - kernel_threads = MIN (kernel_threads, (u32) compile_work_group_size[0]); + kernel_threads = MIN (kernel_threads, (u32) cwgs_total); } *result = kernel_threads;