From f0219b7bed8d60a710f7cb484d594b48eaf1af79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E5=89=91=E6=AD=A6?= Date: Mon, 4 Nov 2019 14:21:13 +0800 Subject: [PATCH] support OpenCL2.1 --- mace/core/runtime/opencl/opencl_runtime.cc | 8 +++++--- mace/core/runtime/opencl/opencl_runtime.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mace/core/runtime/opencl/opencl_runtime.cc b/mace/core/runtime/opencl/opencl_runtime.cc index 6d5f82e1..17f1dd5a 100644 --- a/mace/core/runtime/opencl/opencl_runtime.cc +++ b/mace/core/runtime/opencl/opencl_runtime.cc @@ -331,7 +331,7 @@ OpenCLRuntime::OpenCLRuntime( cl_int err; if (gpu_type_ == GPUType::QUALCOMM_ADRENO - && opencl_version_ == OpenCLVersion::CL_VER_2_0) { + && opencl_version_ >= OpenCLVersion::CL_VER_2_0) { std::vector context_properties; context_properties.reserve(5); GetAdrenoContextProperties(&context_properties, @@ -769,7 +769,7 @@ uint64_t OpenCLRuntime::GetKernelWaveSize(const cl::Kernel &kernel) { bool OpenCLRuntime::IsNonUniformWorkgroupsSupported() const { return (gpu_type_ == GPUType::QUALCOMM_ADRENO && - opencl_version_ == OpenCLVersion::CL_VER_2_0); + opencl_version_ >= OpenCLVersion::CL_VER_2_0); } GPUType OpenCLRuntime::gpu_type() const { @@ -786,7 +786,9 @@ OpenCLVersion OpenCLRuntime::ParseDeviceVersion( // OpenCL // auto words = Split(device_version, ' '); - if (words[1] == "2.0") { + if (words[1] == "2.1") { + return OpenCLVersion::CL_VER_2_1; + } else if (words[1] == "2.0") { return OpenCLVersion::CL_VER_2_0; } else if (words[1] == "1.2") { return OpenCLVersion::CL_VER_1_2; diff --git a/mace/core/runtime/opencl/opencl_runtime.h b/mace/core/runtime/opencl/opencl_runtime.h index ddc270b5..f06f313a 100644 --- a/mace/core/runtime/opencl/opencl_runtime.h +++ b/mace/core/runtime/opencl/opencl_runtime.h @@ -41,11 +41,12 @@ enum GPUType { }; enum OpenCLVersion { + CL_VER_UNKNOWN, CL_VER_1_0, CL_VER_1_1, CL_VER_1_2, CL_VER_2_0, - CL_VER_UNKNOWN, + CL_VER_2_1, }; -- GitLab