diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/CL/CLHelpers.h | 15 | ||||
-rw-r--r-- | arm_compute/core/CL/CLTypes.h | 10 | ||||
-rw-r--r-- | arm_compute/runtime/CL/CLScheduler.h | 10 |
3 files changed, 32 insertions, 3 deletions
diff --git a/arm_compute/core/CL/CLHelpers.h b/arm_compute/core/CL/CLHelpers.h index 5234ae192e..01980d9793 100644 --- a/arm_compute/core/CL/CLHelpers.h +++ b/arm_compute/core/CL/CLHelpers.h @@ -102,5 +102,20 @@ GPUTarget get_target_from_device(cl::Device &device); * @return the GPU target which shows the arch */ GPUTarget get_arch_from_target(GPUTarget target); + +/** Helper function to get the highest OpenCL version supported + * + * @param[in] device A CL device + * + * @return the highest OpenCL version supported + */ +CLVersion get_cl_version(const cl::Device &device); +/** Helper function to check whether the arm_non_uniform_work_group_size extension is supported + * + * @param[in] device A CL device + * + * @return True if the extension is supported + */ +bool non_uniform_workgroup_support(const cl::Device &device); } #endif /* __ARM_COMPUTE_CLHELPERS_H__ */ diff --git a/arm_compute/core/CL/CLTypes.h b/arm_compute/core/CL/CLTypes.h index c5643d8939..cf11f6ecd7 100644 --- a/arm_compute/core/CL/CLTypes.h +++ b/arm_compute/core/CL/CLTypes.h @@ -37,5 +37,15 @@ enum class GPUTarget T800 = 0x130, G70 = 0x210 }; + +/* Available OpenCL Version */ +enum class CLVersion +{ + CL10, /* the OpenCL 1.0 */ + CL11, /* the OpenCL 1.1 */ + CL12, /* the OpenCL 1.2 */ + CL20, /* the OpenCL 2.0 and above */ + UNKNOWN /* unkown version */ +}; } #endif /* __ARM_COMPUTE_CL_TYPES_H__ */ diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h index 8e80259b59..3f3a8de753 100644 --- a/arm_compute/runtime/CL/CLScheduler.h +++ b/arm_compute/runtime/CL/CLScheduler.h @@ -72,9 +72,10 @@ public: void init(cl::Context context = cl::Context::getDefault(), cl::CommandQueue queue = cl::CommandQueue::getDefault(), cl::Device device = cl::Device::getDefault()) { - _context = std::move(context); - _queue = std::move(queue); - _target = get_target_from_device(device); + _context = std::move(context); + _queue = std::move(queue); + _target = get_target_from_device(device); + _is_initialised = true; } /** Accessor for the associated CL context. @@ -83,6 +84,7 @@ public: */ cl::Context &context() { + ARM_COMPUTE_ERROR_ON(!_is_initialised); return _context; } @@ -101,6 +103,7 @@ public: */ cl::CommandQueue &queue() { + ARM_COMPUTE_ERROR_ON(!_is_initialised); return _queue; } @@ -153,6 +156,7 @@ private: cl::Context _context; cl::CommandQueue _queue; GPUTarget _target; + bool _is_initialised; }; } #endif /* __ARM_COMPUTE_CLSCHEDULER_H__ */ |