From 44dbedd21a990bcd8221698fd5421b2899e9944c Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Sun, 25 Jul 2021 10:32:58 +0200 Subject: [PATCH] Use improved native threads derivation for RC4 based hash-modes --- src/modules/module_07500.c | 28 +++------------------------- src/modules/module_13100.c | 28 +++------------------------- src/modules/module_18200.c | 28 +++------------------------- src/modules/module_25400.c | 28 +++------------------------- 4 files changed, 12 insertions(+), 100 deletions(-) diff --git a/src/modules/module_07500.c b/src/modules/module_07500.c index 1681fb4a8..7cb6e04e4 100644 --- a/src/modules/module_07500.c +++ b/src/modules/module_07500.c @@ -65,35 +65,13 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) + if (device_param->device_local_mem_size < 49152) { - native_threads = 8; - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } + native_threads = MIN (device_param->kernel_preferred_wgs_multiple, 32); // We can't just set 32, because Intel GPU need 8 } else { - native_threads = 32; + native_threads = device_param->kernel_preferred_wgs_multiple; } } diff --git a/src/modules/module_13100.c b/src/modules/module_13100.c index fac5cb24c..2b4e0e846 100644 --- a/src/modules/module_13100.c +++ b/src/modules/module_13100.c @@ -64,35 +64,13 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) + if (device_param->device_local_mem_size < 49152) { - native_threads = 8; - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } + native_threads = MIN (device_param->kernel_preferred_wgs_multiple, 32); // We can't just set 32, because Intel GPU need 8 } else { - native_threads = 32; + native_threads = device_param->kernel_preferred_wgs_multiple; } } diff --git a/src/modules/module_18200.c b/src/modules/module_18200.c index e6596306b..f4d32695e 100644 --- a/src/modules/module_18200.c +++ b/src/modules/module_18200.c @@ -64,35 +64,13 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) + if (device_param->device_local_mem_size < 49152) { - native_threads = 8; - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } + native_threads = MIN (device_param->kernel_preferred_wgs_multiple, 32); // We can't just set 32, because Intel GPU need 8 } else { - native_threads = 32; + native_threads = device_param->kernel_preferred_wgs_multiple; } } diff --git a/src/modules/module_25400.c b/src/modules/module_25400.c index 341837786..6325bf737 100644 --- a/src/modules/module_25400.c +++ b/src/modules/module_25400.c @@ -103,35 +103,13 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY } else if (device_param->opencl_device_type & CL_DEVICE_TYPE_GPU) { - if (device_param->opencl_device_vendor_id == VENDOR_ID_INTEL_SDK) + if (device_param->device_local_mem_size < 49152) { - native_threads = 8; - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } - } - else if (device_param->opencl_device_vendor_id == VENDOR_ID_AMD_USE_HIP) - { - if (device_param->device_local_mem_size < 49152) - { - native_threads = 32; - } - else - { - native_threads = 64; - } + native_threads = MIN (device_param->kernel_preferred_wgs_multiple, 32); // We can't just set 32, because Intel GPU need 8 } else { - native_threads = 32; + native_threads = device_param->kernel_preferred_wgs_multiple; } }