aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/OpenCL.cpp
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2017-12-22 16:37:30 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:42:33 +0000
commita9e153398e4a998ee01623eb78c4604bbd8d34e7 (patch)
tree8a07b58dc044e37311387dc7ef771b5f2bb4bb55 /src/core/CL/OpenCL.cpp
parent77eb21f7d9c6e34e985dfa96152fb8b6c40f9a8a (diff)
downloadComputeLibrary-a9e153398e4a998ee01623eb78c4604bbd8d34e7.tar.gz
COMPMID-766 Allow graph examples to run without OpenCL being present on the platform
Change-Id: I4142e0720ecb58549a08d4e86ad21abb882f5f37 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114552 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/CL/OpenCL.cpp')
-rw-r--r--src/core/CL/OpenCL.cpp58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/core/CL/OpenCL.cpp b/src/core/CL/OpenCL.cpp
index 157b6d6820..726279c6ea 100644
--- a/src/core/CL/OpenCL.cpp
+++ b/src/core/CL/OpenCL.cpp
@@ -74,8 +74,9 @@ bool CLSymbols::load(const std::string &library)
#define LOAD_FUNCTION_PTR(func_name, handle) \
func_name##_ptr = reinterpret_cast<decltype(func_name) *>(dlsym(handle, #func_name));
- LOAD_FUNCTION_PTR(clBuildProgram, handle);
- LOAD_FUNCTION_PTR(clEnqueueNDRangeKernel, handle);
+ LOAD_FUNCTION_PTR(clCreateContextFromType, handle);
+ LOAD_FUNCTION_PTR(clCreateCommandQueue, handle);
+ LOAD_FUNCTION_PTR(clGetContextInfo, handle);
LOAD_FUNCTION_PTR(clBuildProgram, handle);
LOAD_FUNCTION_PTR(clEnqueueNDRangeKernel, handle);
LOAD_FUNCTION_PTR(clSetKernelArg, handle);
@@ -125,6 +126,59 @@ bool opencl_is_available()
}
} // namespace arm_compute
+cl_int clGetContextInfo(cl_context context,
+ cl_context_info param_name,
+ size_t param_value_size,
+ void *param_value,
+ size_t *param_value_size_ret)
+{
+ arm_compute::CLSymbols::get().load_default();
+ auto func = arm_compute::CLSymbols::get().clGetContextInfo_ptr;
+ if(func != nullptr)
+ {
+ return func(context, param_name, param_value_size, param_value, param_value_size_ret);
+ }
+ else
+ {
+ return CL_OUT_OF_RESOURCES;
+ }
+}
+
+cl_command_queue clCreateCommandQueue(cl_context context,
+ cl_device_id device,
+ cl_command_queue_properties properties,
+ cl_int *errcode_ret)
+{
+ arm_compute::CLSymbols::get().load_default();
+ auto func = arm_compute::CLSymbols::get().clCreateCommandQueue_ptr;
+ if(func != nullptr)
+ {
+ return func(context, device, properties, errcode_ret);
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+
+cl_context clCreateContextFromType(const cl_context_properties *properties,
+ cl_device_type device_type,
+ void (*pfn_notify)(const char *, const void *, size_t, void *),
+ void *user_data,
+ cl_int *errcode_ret)
+{
+ arm_compute::CLSymbols::get().load_default();
+ auto func = arm_compute::CLSymbols::get().clCreateContextFromType_ptr;
+ if(func != nullptr)
+ {
+ return func(properties, device_type, pfn_notify, user_data, errcode_ret);
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+
cl_int clBuildProgram(
cl_program program,
cl_uint num_devices,