diff --git a/docs/changes.txt b/docs/changes.txt index 787f034a2..b5946a01a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -116,7 +116,6 @@ - OpenCL Runtime: Do not run shared- and constant-memory size checks if their memory type is of type global memory (typically CPU) - OpenCL Runtime: Improve ROCm detection and make sure to not confuse with recent AMDGPU drivers - OpenCL Runtime: Not using amd_bytealign (amd_bitalign is fine) on AMDGPU driver drastically reduces JiT segfaults -- OpenCL Runtime: Reenabled support for Intel GPU OpenCL runtime (Beignet and NEO) because a workaround was found (force -cl-std=CL2.0) - OpenCL Runtime: Unlocked maximum thread count for NVIDIA GPU - OpenCL Runtime: Update unstable mode warnings for Apple and AMDGPU drivers - OpenCL Runtime: Workaround JiT compiler error on AMDGPU driver compiling WPA-EAPOL-PBKDF2 OpenCL kernel diff --git a/include/types.h b/include/types.h index f59655f60..47eff8f28 100644 --- a/include/types.h +++ b/include/types.h @@ -1280,6 +1280,7 @@ typedef struct hc_device_param bool use_opencl12; bool use_opencl20; + bool use_opencl21; // AMD bool has_vadd; diff --git a/src/backend.c b/src/backend.c index 1622b652e..9b773076e 100644 --- a/src/backend.c +++ b/src/backend.c @@ -5364,6 +5364,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) device_param->use_opencl12 = false; device_param->use_opencl20 = false; + device_param->use_opencl21 = false; // device_name @@ -5648,12 +5649,14 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) cl_device_id **opencl_platforms_devices = backend_ctx->opencl_platforms_devices; cl_uint *opencl_platforms_devices_cnt = backend_ctx->opencl_platforms_devices_cnt; cl_uint *opencl_platforms_vendor_id = backend_ctx->opencl_platforms_vendor_id; + char **opencl_platforms_version = backend_ctx->opencl_platforms_version; for (u32 opencl_platforms_idx = 0; opencl_platforms_idx < opencl_platforms_cnt; opencl_platforms_idx++) { cl_device_id *opencl_platform_devices = opencl_platforms_devices[opencl_platforms_idx]; cl_uint opencl_platform_devices_cnt = opencl_platforms_devices_cnt[opencl_platforms_idx]; cl_uint opencl_platform_vendor_id = opencl_platforms_vendor_id[opencl_platforms_idx]; + char *opencl_platform_version = opencl_platforms_version[opencl_platforms_idx]; for (u32 opencl_platform_devices_idx = 0; opencl_platform_devices_idx < opencl_platform_devices_cnt; opencl_platform_devices_idx++, backend_devices_idx++, opencl_devices_cnt++) { @@ -5677,8 +5680,30 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) device_param->is_opencl = true; + // check OpenCL version + device_param->use_opencl12 = false; device_param->use_opencl20 = false; + device_param->use_opencl21 = false; + + int opencl_version_min = 0; + int opencl_version_maj = 0; + + if (sscanf (opencl_platform_version, "OpenCL %d.%d", &opencl_version_min, &opencl_version_maj) == 2) + { + if ((opencl_version_min == 1) && (opencl_version_maj == 2)) + { + device_param->use_opencl12 = true; + } + else if ((opencl_version_min == 2) && (opencl_version_maj == 0)) + { + device_param->use_opencl20 = true; + } + else if ((opencl_version_min == 2) && (opencl_version_maj == 1)) + { + device_param->use_opencl21 = true; + } + } size_t param_value_size = 0; @@ -5793,23 +5818,6 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) device_param->opencl_device_c_version = opencl_device_c_version; - // check OpenCL version - - int opencl_version_min = 0; - int opencl_version_maj = 0; - - if (sscanf (opencl_device_c_version, "OpenCL C %d.%d", &opencl_version_min, &opencl_version_maj) == 2) - { - if ((opencl_version_min == 1) && (opencl_version_maj == 2)) - { - device_param->use_opencl12 = true; - } - else if ((opencl_version_min == 2) && (opencl_version_maj == 0)) - { - device_param->use_opencl20 = true; - } - } - // max_compute_units cl_uint device_processors = 0; @@ -7740,8 +7748,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-D KERNEL_STATIC -I OpenCL -I %s ", folder_config->cpath_real); #endif - // workarounds reproduceable bugs on some OpenCL runtimes (Beignet and NEO) - // ex: remove empty code in m04, m08 and m16 in OpenCL/m05600_a3-optimized.cl will break s04 kernel (not cracking anymore) + /* currently disabled, hangs NEO drivers since 20.09. + was required for NEO driver 20.08 to workaround the same issue! + we go with the latest version if (device_param->is_opencl == true) { @@ -7753,7 +7762,12 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) { build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-cl-std=CL2.0 "); } + else if (device_param->use_opencl21 == true) + { + build_options_len += snprintf (build_options_buf + build_options_len, build_options_sz - build_options_len, "-cl-std=CL2.1 "); + } } + */ // we don't have sm_* on vendors not NV but it doesn't matter