aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/CLHelpers.cpp
diff options
context:
space:
mode:
authorMatthew Bentham <matthew.bentham@arm.com>2017-10-27 11:50:06 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit6f31f8c50a3d409b1ec587efba406454b53e9452 (patch)
treeb091ee680d135315f59a062ce22a172c82db18e3 /src/core/CL/CLHelpers.cpp
parentadaae7e453cc4cc07905daca68fa7b938555d581 (diff)
downloadComputeLibrary-6f31f8c50a3d409b1ec587efba406454b53e9452.tar.gz
Allow running without cl_khr_fp16
Change-Id: I0f5396c8f32acc28914e2ff9fe953f977a3077b9 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/93405 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'src/core/CL/CLHelpers.cpp')
-rw-r--r--src/core/CL/CLHelpers.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/core/CL/CLHelpers.cpp b/src/core/CL/CLHelpers.cpp
index 09ec329e4c..901ac3f39a 100644
--- a/src/core/CL/CLHelpers.cpp
+++ b/src/core/CL/CLHelpers.cpp
@@ -58,6 +58,13 @@ arm_compute::GPUTarget get_midgard_target(const std::string &version)
return arm_compute::GPUTarget::MIDGARD;
}
}
+
+bool extension_support(const cl::Device &device, const char *extension_name)
+{
+ std::string extensions = device.getInfo<CL_DEVICE_EXTENSIONS>();
+ auto pos = extensions.find(extension_name);
+ return (pos != std::string::npos);
+}
} // namespace
namespace arm_compute
@@ -206,21 +213,12 @@ GPUTarget get_arch_from_target(GPUTarget target)
bool non_uniform_workgroup_support(const cl::Device &device)
{
- std::vector<char> extension;
- size_t extension_size = 0;
- cl_int err = clGetDeviceInfo(device.get(), CL_DEVICE_EXTENSIONS, 0, nullptr, &extension_size);
- ARM_COMPUTE_ERROR_ON_MSG((err != 0) || (extension_size == 0), "clGetDeviceInfo failed to return valid information");
- ARM_COMPUTE_UNUSED(err);
- // Resize vector
- extension.resize(extension_size);
- // Query extension
- err = clGetDeviceInfo(device.get(), CL_DEVICE_EXTENSIONS, extension_size, extension.data(), nullptr);
- ARM_COMPUTE_ERROR_ON_MSG(err != 0, "clGetDeviceInfo failed to return valid information");
- ARM_COMPUTE_UNUSED(err);
+ return extension_support(device, "cl_arm_non_uniform_work_group_size");
+}
- std::string extension_str(extension.begin(), extension.end());
- auto pos = extension_str.find("cl_arm_non_uniform_work_group_size");
- return (pos != std::string::npos);
+bool fp16_support(const cl::Device &device)
+{
+ return extension_support(device, "cl_khr_fp16");
}
CLVersion get_cl_version(const cl::Device &device)