OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] Don't assume work-group collective functions on sub-CL3.0 builds (#37008)
Aleksandr Voronacc01ed80b25
diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cppindex 33742f5e64e..0b9db4324aa 100644--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_device.cpp@@ -260,20 +260,18 @@ device_info init_device_info(const cl::Device& device, const cl::Context& contexinfo.supports_queue_families = extensions.find("cl_intel_command_queue_families ") != std::string::npos;-#if CL_HPP_TARGET_OPENCL_VERSION >= 300- // refer: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_C.html#optional-functionality- // These flags are supported from OPENCL_300: CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT, CL_DEVICE_OPENCL_C_FEATURES- // OpenCL C3.0: work_group_<ops> are optional. It should be checked 'work group collective functions' are supported in OpenCL C 3.0.- info.supports_work_group_collective_functions = device.getInfo<CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT>();- info.supports_non_uniform_work_group = device.getInfo<CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT>();-#elif CL_HPP_TARGET_OPENCL_VERSION >= 200- // OpenCL C2.0: work_group_<ops> are mandatory.- info.supports_work_group_collective_functions = true;- info.supports_non_uniform_work_group = true;-#else- info.supports_work_group_collective_functions = false;- info.supports_non_uniform_work_group = false;-#endif+ auto query_device_bool = [&](cl_device_info param) -> bool {+ cl_bool value = CL_FALSE;+ try {+ if (device.getInfo(param, &value) != CL_SUCCESS)+ return false;+ } catch (const cl::Error&) {+ return false;+ }+ return value == CL_TRUE;+ };+ info.supports_work_group_collective_functions = query_device_bool(CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT);+ info.supports_non_uniform_work_group = query_device_bool(CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT);if (info.supports_intel_required_subgroup_size) {info.supported_simd_sizes = device.getInfo<CL_DEVICE_SUB_GROUP_SIZES_INTEL>();diff --git a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hppindex 10266003a47..058a6e7b787 100644--- a/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp+++ b/src/plugins/intel_gpu/src/runtime/ocl/ocl_ext.hpp@@ -59,6 +59,14 @@ CL_HPP_DECLARE_PARAM_TRAITS_(cl_device_info, CL_DEVICE_SUB_GROUP_SIZES_INTEL, cl#endif // OPENVINO_CLHPP_HEADERS_ARE_OLDER_THAN_V2024_10_24+#if !defined(CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT)+#define CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT 0x1065+#endif++#if !defined(CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT)+#define CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT 0x1068+#endif+/**************************************************************** cl_intel_command_queue_families***************************************************************/