diff options
Diffstat (limited to 'src/core/CL')
-rw-r--r-- | src/core/CL/CLCompileContext.cpp | 12 | ||||
-rw-r--r-- | src/core/CL/CLHelpers.cpp | 17 |
2 files changed, 21 insertions, 8 deletions
diff --git a/src/core/CL/CLCompileContext.cpp b/src/core/CL/CLCompileContext.cpp index 2fed76555b..81eb748ab8 100644 --- a/src/core/CL/CLCompileContext.cpp +++ b/src/core/CL/CLCompileContext.cpp @@ -232,6 +232,8 @@ void CLCompileContext::set_context(cl::Context context) std::string CLCompileContext::generate_build_options(const StringSet &build_options_set, const std::string &kernel_path) const { std::string concat_str; + bool ext_supported = false; + std::string ext_buildopts; #if defined(ARM_COMPUTE_DEBUG_ENABLED) // Enable debug properties in CL kernels @@ -257,13 +259,11 @@ std::string CLCompileContext::generate_build_options(const StringSet &build_opti concat_str += " -DARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED=1 "; } - if(_device.version() == CLVersion::CL20) - { - concat_str += " -cl-std=CL2.0 "; - } - else if(_device.supported("cl_arm_non_uniform_work_group_size")) + std::tie(ext_supported, ext_buildopts) = _device.is_non_uniform_workgroup_supported(); + + if(ext_supported) { - concat_str += " -cl-arm-non-uniform-work-group-size "; + concat_str += ext_buildopts; } else { diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp index 8685180b7f..5172a7730a 100644 --- a/src/core/CL/CLHelpers.cpp +++ b/src/core/CL/CLHelpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2021 Arm Limited. + * Copyright (c) 2016-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -256,7 +256,11 @@ bool dot8_acc_supported(const cl::Device &device) CLVersion get_cl_version(const cl::Device &device) { std::string version_str = device.getInfo<CL_DEVICE_VERSION>(); - if(version_str.find("OpenCL 2") != std::string::npos) + if(version_str.find("OpenCL 3") != std::string::npos) + { + return CLVersion::CL30; + } + else if(version_str.find("OpenCL 2") != std::string::npos) { return CLVersion::CL20; } @@ -388,6 +392,15 @@ size_t get_cl_image_pitch_alignment(const cl::Device &device) } } +bool get_cl_non_uniform_work_group_supported(const cl::Device &device) +{ + cl_bool supported = CL_FALSE; + + cl_int err = clGetDeviceInfo(device(), CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, sizeof(cl_bool), &supported, nullptr); + + return (err == CL_SUCCESS && supported == CL_TRUE); +} + cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set<std::string> &build_opts) { opencl::ClKernelLibrary &klib = opencl::ClKernelLibrary::get(); |