blob: 8aa9b2bc1e7e68454f187ea362069deb1d6aba80 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Ramy Elgammala7db3562023-04-19 18:49:44 +01002 * Copyright (c) 2017-2023 Arm Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
Michalis Spyrou6bff1952019-10-02 17:22:11 +010025#pragma GCC diagnostic push
26#pragma GCC diagnostic ignored "-Wunused-parameter"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027#include "arm_compute/core/CL/OpenCL.h"
Michalis Spyrou6bff1952019-10-02 17:22:11 +010028#pragma GCC diagnostic pop
Anthony Barbier6ff3b192017-09-04 18:44:23 +010029
Pablo Tellodb8485a2019-09-24 11:03:47 +010030#include "arm_compute/core/Error.h"
31
Ramy Elgammala7db3562023-04-19 18:49:44 +010032#include <algorithm>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010033#include <dlfcn.h>
34#include <iostream>
Ramy Elgammala7db3562023-04-19 18:49:44 +010035#include <sstream>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036
Moritz Pflanzer725788e2017-07-07 15:35:56 +010037namespace arm_compute
Anthony Barbier6ff3b192017-09-04 18:44:23 +010038{
Georgios Pinitas0b192e82020-02-20 17:09:28 +000039CLSymbols::CLSymbols() noexcept(false)
40 : _loaded(
41{
42 false, false
Georgios Pinitas42bd2652021-03-12 18:40:30 +000043})
Georgios Pinitas0b192e82020-02-20 17:09:28 +000044{
45}
46
Moritz Pflanzer725788e2017-07-07 15:35:56 +010047CLSymbols &CLSymbols::get()
48{
49 static CLSymbols symbols;
50 return symbols;
51}
52
53bool CLSymbols::load_default()
54{
Ramy Elgammala7db3562023-04-19 18:49:44 +010055 static const std::vector<std::string> libraries_filenames{ "libOpenCL.so", "libGLES_mali.so", "libmali.so" };
Moritz Pflanzer725788e2017-07-07 15:35:56 +010056
57 if(_loaded.first)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010058 {
Moritz Pflanzer725788e2017-07-07 15:35:56 +010059 return _loaded.second;
60 }
61
62 // Indicate that default loading has been tried
63 _loaded.first = true;
64
Ramy Elgammala7db3562023-04-19 18:49:44 +010065 if(load(libraries_filenames, /* use_loader */ false))
Moritz Pflanzer725788e2017-07-07 15:35:56 +010066 {
Ramy Elgammala7db3562023-04-19 18:49:44 +010067 ARM_COMPUTE_ERROR_ON_MSG(this->clBuildProgram_ptr == nullptr, "Failed to load OpenCL symbols from shared library");
68 return true;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010069 }
70
ohadagoogle3efdfb32022-06-20 16:16:13 +000071#ifdef __ANDROID__
72 // When running in NDK environment, the above libraries are not accessible.
Ramy Elgammala7db3562023-04-19 18:49:44 +010073 static const std::vector<std::string> android_libraries_filenames{ "libOpenCL-pixel.so", "libOpenCL-car.so" };
ohadagoogle3efdfb32022-06-20 16:16:13 +000074
Ramy Elgammala7db3562023-04-19 18:49:44 +010075 if(load(android_libraries_filenames, /* use_loader */ true))
ohadagoogle3efdfb32022-06-20 16:16:13 +000076 {
Ramy Elgammala7db3562023-04-19 18:49:44 +010077 ARM_COMPUTE_ERROR_ON_MSG(this->clBuildProgram_ptr == nullptr, "Failed to load OpenCL symbols from android shared library");
78 return true;
ohadagoogle3efdfb32022-06-20 16:16:13 +000079 }
Ramy Elgammala7db3562023-04-19 18:49:44 +010080#endif // __ANDROID__
ohadagoogle3efdfb32022-06-20 16:16:13 +000081
Ramy Elgammala7db3562023-04-19 18:49:44 +010082 // If not returned till here then libraries not found
83 std::stringstream ss;
84 std::for_each(libraries_filenames.begin(), libraries_filenames.end(), [&ss](const std::string & s)
85 {
86 ss << s << " ";
87 });
88#ifdef __ANDROID__
89 std::for_each(android_libraries_filenames.begin(), android_libraries_filenames.end(), [&ss](const std::string & s)
90 {
91 ss << s << " ";
92 });
93#endif // __ANDROID__
94 std::cerr << "Couldn't find any of the following OpenCL library: " << ss.str() << std::endl;
Moritz Pflanzer725788e2017-07-07 15:35:56 +010095 return false;
96}
97
Ramy Elgammala7db3562023-04-19 18:49:44 +010098bool CLSymbols::load(const std::vector<std::string> &libraries_filenames, bool use_loader)
Moritz Pflanzer725788e2017-07-07 15:35:56 +010099{
Ramy Elgammala7db3562023-04-19 18:49:44 +0100100 void *handle = nullptr;
101 unsigned int index = 0;
102 for(index = 0; index < libraries_filenames.size(); ++index)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100103 {
Ramy Elgammala7db3562023-04-19 18:49:44 +0100104 handle = dlopen(libraries_filenames[index].c_str(), RTLD_LAZY | RTLD_LOCAL);
105 if(handle != nullptr)
106 {
107 break;
108 }
109 }
Omar Al Khatibf15c6152023-05-17 08:42:28 +0000110 if(index == libraries_filenames.size())
Ramy Elgammala7db3562023-04-19 18:49:44 +0100111 {
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100112 // Set status of loading to failed
113 _loaded.second = false;
114 return false;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100115 }
116
ohadagoogle3efdfb32022-06-20 16:16:13 +0000117#ifdef __ANDROID__
118 typedef void* (*loadOpenCLPointer_t)(const char* name);
119 loadOpenCLPointer_t loadOpenCLPointer;
120 if (use_loader) {
121 typedef void (*enableOpenCL_t)();
122 enableOpenCL_t enableOpenCL =
123 reinterpret_cast<enableOpenCL_t>(dlsym(handle, "enableOpenCL"));
124 enableOpenCL();
125
126 loadOpenCLPointer = reinterpret_cast<loadOpenCLPointer_t>(
127 dlsym(handle, "loadOpenCLPointer"));
128 } else {
129 loadOpenCLPointer = nullptr;
130 }
131#define LOAD_FUNCTION_PTR(func_name, _handle) \
132 func_name##_ptr = reinterpret_cast<decltype(func_name) *>( use_loader ? \
133 loadOpenCLPointer(#func_name) : dlsym(handle, #func_name));
134#else /* __ANDROID__ */
135 (void)use_loader; // Avoid unused warning
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000136#define LOAD_FUNCTION_PTR(func_name, handle) \
137 func_name##_ptr = reinterpret_cast<decltype(func_name) *>(dlsym(handle, #func_name));
ohadagoogle3efdfb32022-06-20 16:16:13 +0000138#endif /* __ANDROID__ */
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000139
Georgios Pinitas42bd2652021-03-12 18:40:30 +0000140 LOAD_FUNCTION_PTR(clCreateContext, handle);
141 LOAD_FUNCTION_PTR(clCreateContextFromType, handle);
142 LOAD_FUNCTION_PTR(clCreateCommandQueue, handle);
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000143 LOAD_FUNCTION_PTR(clCreateCommandQueueWithProperties, handle);
Georgios Pinitas42bd2652021-03-12 18:40:30 +0000144 LOAD_FUNCTION_PTR(clGetContextInfo, handle);
145 LOAD_FUNCTION_PTR(clBuildProgram, handle);
146 LOAD_FUNCTION_PTR(clEnqueueNDRangeKernel, handle);
147 LOAD_FUNCTION_PTR(clSetKernelArg, handle);
148 LOAD_FUNCTION_PTR(clReleaseKernel, handle);
149 LOAD_FUNCTION_PTR(clCreateProgramWithSource, handle);
150 LOAD_FUNCTION_PTR(clCreateBuffer, handle);
151 LOAD_FUNCTION_PTR(clRetainKernel, handle);
152 LOAD_FUNCTION_PTR(clCreateKernel, handle);
153 LOAD_FUNCTION_PTR(clGetProgramInfo, handle);
154 LOAD_FUNCTION_PTR(clFlush, handle);
155 LOAD_FUNCTION_PTR(clFinish, handle);
156 LOAD_FUNCTION_PTR(clReleaseProgram, handle);
157 LOAD_FUNCTION_PTR(clRetainContext, handle);
158 LOAD_FUNCTION_PTR(clCreateProgramWithBinary, handle);
159 LOAD_FUNCTION_PTR(clReleaseCommandQueue, handle);
160 LOAD_FUNCTION_PTR(clEnqueueMapBuffer, handle);
161 LOAD_FUNCTION_PTR(clRetainProgram, handle);
162 LOAD_FUNCTION_PTR(clGetProgramBuildInfo, handle);
163 LOAD_FUNCTION_PTR(clEnqueueReadBuffer, handle);
164 LOAD_FUNCTION_PTR(clEnqueueWriteBuffer, handle);
165 LOAD_FUNCTION_PTR(clReleaseEvent, handle);
166 LOAD_FUNCTION_PTR(clReleaseContext, handle);
167 LOAD_FUNCTION_PTR(clRetainCommandQueue, handle);
168 LOAD_FUNCTION_PTR(clEnqueueUnmapMemObject, handle);
169 LOAD_FUNCTION_PTR(clRetainMemObject, handle);
170 LOAD_FUNCTION_PTR(clReleaseMemObject, handle);
171 LOAD_FUNCTION_PTR(clGetDeviceInfo, handle);
172 LOAD_FUNCTION_PTR(clGetDeviceIDs, handle);
173 LOAD_FUNCTION_PTR(clGetMemObjectInfo, handle);
174 LOAD_FUNCTION_PTR(clRetainEvent, handle);
Michalis Spyrou402740d2021-04-20 11:26:21 +0100175 LOAD_FUNCTION_PTR(clGetPlatformInfo, handle);
Georgios Pinitas42bd2652021-03-12 18:40:30 +0000176 LOAD_FUNCTION_PTR(clGetPlatformIDs, handle);
177 LOAD_FUNCTION_PTR(clGetKernelWorkGroupInfo, handle);
178 LOAD_FUNCTION_PTR(clGetCommandQueueInfo, handle);
179 LOAD_FUNCTION_PTR(clGetKernelInfo, handle);
180 LOAD_FUNCTION_PTR(clGetEventProfilingInfo, handle);
181 LOAD_FUNCTION_PTR(clSVMAlloc, handle);
182 LOAD_FUNCTION_PTR(clSVMFree, handle);
183 LOAD_FUNCTION_PTR(clEnqueueSVMMap, handle);
184 LOAD_FUNCTION_PTR(clEnqueueSVMUnmap, handle);
185 LOAD_FUNCTION_PTR(clEnqueueMarker, handle);
186 LOAD_FUNCTION_PTR(clWaitForEvents, handle);
187 LOAD_FUNCTION_PTR(clCreateImage, handle);
188 LOAD_FUNCTION_PTR(clSetKernelExecInfo, handle);
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000189
Georgios Pinitas4d0351c2019-04-03 15:11:16 +0100190 // Third-party extensions
Georgios Pinitas42bd2652021-03-12 18:40:30 +0000191 LOAD_FUNCTION_PTR(clImportMemoryARM, handle);
Georgios Pinitas4d0351c2019-04-03 15:11:16 +0100192
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000193#undef LOAD_FUNCTION_PTR
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100194
Georgios Pinitas42bd2652021-03-12 18:40:30 +0000195 //Don't call dlclose(handle) or all the symbols will be unloaded !
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100196
197 // Disable default loading and set status to successful
198 _loaded = std::make_pair(true, true);
199
200 return true;
201}
202
203bool opencl_is_available()
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100204{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100205 CLSymbols::get().load_default();
Marco Antognini4a5f73d2021-03-23 16:59:08 +0000206
207 // Using static objects that rely on OpenCL in their constructor or
208 // destructor is implementation defined according to the OpenCL API
209 // Specification. These objects include CLScheduler.
210 //
211 // For compatibility with OpenCL runtimes that also use static objects to
212 // hold their state, we call a harmless OpenCL function (clGetPlatformIDs
213 // with invalid parameters must result in CL_INVALID_VALUE) to ensure the
214 // runtimes have a chance to initialize their static objects first. Thanks
ramelg01b2eba7f2021-12-23 08:32:08 +0000215 // to C++11 rules about normal program completion (cf [basic.start]), this
Marco Antognini4a5f73d2021-03-23 16:59:08 +0000216 // ensures their static objects are destroyed last, i.e. after the
217 // singleton CLScheduler is destroyed.
218 //
219 // When OpenCL is not available, this call results in CL_OUT_OF_RESOURCES,
220 // which is equally harmless.
221 (void)clGetPlatformIDs(0, nullptr, nullptr);
222
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000223 return CLSymbols::get().clBuildProgram_ptr != nullptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100224}
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100225} // namespace arm_compute
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100226
Georgios Pinitasd9eb2752018-04-03 13:44:29 +0100227cl_int clEnqueueMarker(cl_command_queue command_queue,
228 cl_event *event)
229{
230 arm_compute::CLSymbols::get().load_default();
231 auto func = arm_compute::CLSymbols::get().clEnqueueMarker_ptr;
232 if(func != nullptr)
233 {
234 return func(command_queue, event);
235 }
236 else
237 {
238 return CL_OUT_OF_RESOURCES;
239 }
240}
241
242cl_int clWaitForEvents(cl_uint num_events,
243 const cl_event *event_list)
244{
245 arm_compute::CLSymbols::get().load_default();
246 auto func = arm_compute::CLSymbols::get().clWaitForEvents_ptr;
247 if(func != nullptr)
248 {
249 return func(num_events, event_list);
250 }
251 else
252 {
253 return CL_OUT_OF_RESOURCES;
254 }
255}
256
Pablo Telloe86a09f2018-01-11 15:44:48 +0000257cl_int clEnqueueSVMMap(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void *svm_ptr,
258 size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
259{
260 arm_compute::CLSymbols::get().load_default();
261 auto func = arm_compute::CLSymbols::get().clEnqueueSVMMap_ptr;
262 if(func != nullptr)
263 {
264 return func(command_queue, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_list, event);
265 }
266 else
267 {
268 return CL_OUT_OF_RESOURCES;
269 }
270}
271
272cl_int clEnqueueSVMUnmap(cl_command_queue command_queue, void *svm_ptr, cl_uint num_events_in_wait_list,
273 const cl_event *event_wait_list, cl_event *event)
274{
275 arm_compute::CLSymbols::get().load_default();
276 auto func = arm_compute::CLSymbols::get().clEnqueueSVMUnmap_ptr;
277 if(func != nullptr)
278 {
279 return func(command_queue, svm_ptr, num_events_in_wait_list, event_wait_list, event);
280 }
281 else
282 {
283 return CL_OUT_OF_RESOURCES;
284 }
285}
286
287void *clSVMAlloc(cl_context context, cl_svm_mem_flags_arm flags, size_t size, cl_uint alignment)
288{
289 arm_compute::CLSymbols::get().load_default();
290 auto func = arm_compute::CLSymbols::get().clSVMAlloc_ptr;
291 if(func != nullptr)
292 {
293 return func(context, flags, size, alignment);
294 }
295 else
296 {
297 return nullptr;
298 }
299}
300
301void clSVMFree(cl_context context, void *svm_pointer)
302{
303 arm_compute::CLSymbols::get().load_default();
304 auto func = arm_compute::CLSymbols::get().clSVMFree_ptr;
305 if(func != nullptr)
306 {
307 func(context, svm_pointer);
308 }
309}
310
Anthony Barbiera9e15332017-12-22 16:37:30 +0000311cl_int clGetContextInfo(cl_context context,
312 cl_context_info param_name,
313 size_t param_value_size,
314 void *param_value,
315 size_t *param_value_size_ret)
316{
317 arm_compute::CLSymbols::get().load_default();
318 auto func = arm_compute::CLSymbols::get().clGetContextInfo_ptr;
319 if(func != nullptr)
320 {
321 return func(context, param_name, param_value_size, param_value, param_value_size_ret);
322 }
323 else
324 {
325 return CL_OUT_OF_RESOURCES;
326 }
327}
328
329cl_command_queue clCreateCommandQueue(cl_context context,
330 cl_device_id device,
331 cl_command_queue_properties properties,
332 cl_int *errcode_ret)
333{
334 arm_compute::CLSymbols::get().load_default();
335 auto func = arm_compute::CLSymbols::get().clCreateCommandQueue_ptr;
336 if(func != nullptr)
337 {
338 return func(context, device, properties, errcode_ret);
339 }
340 else
341 {
342 return nullptr;
343 }
344}
345
Georgios Pinitasc3c352e2021-03-18 10:59:40 +0000346cl_command_queue clCreateCommandQueueWithProperties(cl_context context,
347 cl_device_id device,
348 const cl_queue_properties *properties,
349 cl_int *errcode_ret)
350{
351 arm_compute::CLSymbols::get().load_default();
352 auto func = arm_compute::CLSymbols::get().clCreateCommandQueueWithProperties_ptr;
353 if(func != nullptr)
354 {
355 return func(context, device, properties, errcode_ret);
356 }
357 else
358 {
359 return nullptr;
360 }
361}
362
Anthony Barbierb6eb3532018-08-08 13:20:04 +0100363cl_context clCreateContext(
364 const cl_context_properties *properties,
365 cl_uint num_devices,
366 const cl_device_id *devices,
367 void (*pfn_notify)(const char *, const void *, size_t, void *),
368 void *user_data,
369 cl_int *errcode_ret)
370{
371 arm_compute::CLSymbols::get().load_default();
372 auto func = arm_compute::CLSymbols::get().clCreateContext_ptr;
373 if(func != nullptr)
374 {
375 return func(properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
376 }
377 else
378 {
379 return nullptr;
380 }
381}
382
Anthony Barbiera9e15332017-12-22 16:37:30 +0000383cl_context clCreateContextFromType(const cl_context_properties *properties,
384 cl_device_type device_type,
385 void (*pfn_notify)(const char *, const void *, size_t, void *),
386 void *user_data,
387 cl_int *errcode_ret)
388{
389 arm_compute::CLSymbols::get().load_default();
390 auto func = arm_compute::CLSymbols::get().clCreateContextFromType_ptr;
391 if(func != nullptr)
392 {
393 return func(properties, device_type, pfn_notify, user_data, errcode_ret);
394 }
395 else
396 {
397 return nullptr;
398 }
399}
400
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100401cl_int clBuildProgram(
402 cl_program program,
403 cl_uint num_devices,
404 const cl_device_id *device_list,
405 const char *options,
406 void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
407 void *user_data)
408{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100409 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000410 auto func = arm_compute::CLSymbols::get().clBuildProgram_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100411 if(func != nullptr)
412 {
413 return func(program, num_devices, device_list, options, pfn_notify, user_data);
414 }
415 else
416 {
417 return CL_OUT_OF_RESOURCES;
418 }
419}
420
421cl_int clEnqueueNDRangeKernel(
422 cl_command_queue command_queue,
423 cl_kernel kernel,
424 cl_uint work_dim,
425 const size_t *global_work_offset,
426 const size_t *global_work_size,
427 const size_t *local_work_size,
428 cl_uint num_events_in_wait_list,
429 const cl_event *event_wait_list,
430 cl_event *event)
431{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100432 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000433 auto func = arm_compute::CLSymbols::get().clEnqueueNDRangeKernel_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100434 if(func != nullptr)
435 {
436 return func(command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event);
437 }
438 else
439 {
440 return CL_OUT_OF_RESOURCES;
441 }
442}
443
444cl_int clSetKernelArg(
445 cl_kernel kernel,
446 cl_uint arg_index,
447 size_t arg_size,
448 const void *arg_value)
449{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100450 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000451 auto func = arm_compute::CLSymbols::get().clSetKernelArg_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100452 if(func != nullptr)
453 {
454 return func(kernel, arg_index, arg_size, arg_value);
455 }
456 else
457 {
458 return CL_OUT_OF_RESOURCES;
459 }
460}
461
Georgios Pinitasbaf174e2017-09-08 19:47:30 +0100462cl_int clRetainMemObject(cl_mem memobj)
463{
464 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000465 auto func = arm_compute::CLSymbols::get().clRetainMemObject_ptr;
Georgios Pinitasbaf174e2017-09-08 19:47:30 +0100466 if(func != nullptr)
467 {
468 return func(memobj);
469 }
470 else
471 {
472 return CL_OUT_OF_RESOURCES;
473 }
474}
475
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100476cl_int clReleaseMemObject(cl_mem memobj)
477{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100478 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000479 auto func = arm_compute::CLSymbols::get().clReleaseMemObject_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100480 if(func != nullptr)
481 {
482 return func(memobj);
483 }
484 else
485 {
486 return CL_OUT_OF_RESOURCES;
487 }
488}
489
490cl_int clEnqueueUnmapMemObject(
491 cl_command_queue command_queue,
492 cl_mem memobj,
493 void *mapped_ptr,
494 cl_uint num_events_in_wait_list,
495 const cl_event *event_wait_list,
496 cl_event *event)
497{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100498 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000499 auto func = arm_compute::CLSymbols::get().clEnqueueUnmapMemObject_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100500 if(func != nullptr)
501 {
502 return func(command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
503 }
504 else
505 {
506 return CL_OUT_OF_RESOURCES;
507 }
508}
509
510cl_int clRetainCommandQueue(cl_command_queue command_queue)
511{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100512 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000513 auto func = arm_compute::CLSymbols::get().clRetainCommandQueue_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100514 if(func != nullptr)
515 {
516 return func(command_queue);
517 }
518 else
519 {
520 return CL_OUT_OF_RESOURCES;
521 }
522}
523
524cl_int clReleaseContext(cl_context context)
525{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100526 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000527 auto func = arm_compute::CLSymbols::get().clReleaseContext_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100528 if(func != nullptr)
529 {
530 return func(context);
531 }
532 else
533 {
534 return CL_OUT_OF_RESOURCES;
535 }
536}
537cl_int clReleaseEvent(cl_event event)
538{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100539 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000540 auto func = arm_compute::CLSymbols::get().clReleaseEvent_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100541 if(func != nullptr)
542 {
543 return func(event);
544 }
545 else
546 {
547 return CL_OUT_OF_RESOURCES;
548 }
549}
550
551cl_int clEnqueueWriteBuffer(
552 cl_command_queue command_queue,
553 cl_mem buffer,
554 cl_bool blocking_write,
555 size_t offset,
556 size_t size,
557 const void *ptr,
558 cl_uint num_events_in_wait_list,
559 const cl_event *event_wait_list,
560 cl_event *event)
561{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100562 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000563 auto func = arm_compute::CLSymbols::get().clEnqueueWriteBuffer_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100564 if(func != nullptr)
565 {
566 return func(command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
567 }
568 else
569 {
570 return CL_OUT_OF_RESOURCES;
571 }
572}
573
574cl_int clEnqueueReadBuffer(
575 cl_command_queue command_queue,
576 cl_mem buffer,
577 cl_bool blocking_read,
578 size_t offset,
579 size_t size,
580 void *ptr,
581 cl_uint num_events_in_wait_list,
582 const cl_event *event_wait_list,
583 cl_event *event)
584{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100585 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000586 auto func = arm_compute::CLSymbols::get().clEnqueueReadBuffer_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100587 if(func != nullptr)
588 {
589 return func(command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
590 }
591 else
592 {
593 return CL_OUT_OF_RESOURCES;
594 }
595}
596
597cl_int clGetProgramBuildInfo(
598 cl_program program,
599 cl_device_id device,
600 cl_program_build_info param_name,
601 size_t param_value_size,
602 void *param_value,
603 size_t *param_value_size_ret)
604{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100605 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000606 auto func = arm_compute::CLSymbols::get().clGetProgramBuildInfo_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100607 if(func != nullptr)
608 {
609 return func(program, device, param_name, param_value_size, param_value, param_value_size_ret);
610 }
611 else
612 {
613 return CL_OUT_OF_RESOURCES;
614 }
615}
616
617cl_int clRetainProgram(cl_program program)
618{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100619 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000620 auto func = arm_compute::CLSymbols::get().clRetainProgram_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100621 if(func != nullptr)
622 {
623 return func(program);
624 }
625 else
626 {
627 return CL_OUT_OF_RESOURCES;
628 }
629}
630
631void *clEnqueueMapBuffer(
632 cl_command_queue command_queue,
633 cl_mem buffer,
634 cl_bool blocking_map,
635 cl_map_flags map_flags,
636 size_t offset,
637 size_t size,
638 cl_uint num_events_in_wait_list,
639 const cl_event *event_wait_list,
640 cl_event *event,
641 cl_int *errcode_ret)
642{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100643 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000644 auto func = arm_compute::CLSymbols::get().clEnqueueMapBuffer_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100645 if(func != nullptr)
646 {
647 return func(command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret);
648 }
649 else
650 {
651 if(errcode_ret != nullptr)
652 {
653 *errcode_ret = CL_OUT_OF_RESOURCES;
654 }
655 return nullptr;
656 }
657}
658
659cl_int clReleaseCommandQueue(cl_command_queue command_queue)
660{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100661 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000662 auto func = arm_compute::CLSymbols::get().clReleaseCommandQueue_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100663 if(func != nullptr)
664 {
665 return func(command_queue);
666 }
667 else
668 {
669 return CL_OUT_OF_RESOURCES;
670 }
671}
672
673cl_program clCreateProgramWithBinary(
674 cl_context context,
675 cl_uint num_devices,
676 const cl_device_id *device_list,
677 const size_t *lengths,
678 const unsigned char **binaries,
679 cl_int *binary_status,
680 cl_int *errcode_ret)
681{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100682 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000683 auto func = arm_compute::CLSymbols::get().clCreateProgramWithBinary_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100684 if(func != nullptr)
685 {
686 return func(context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret);
687 }
688 else
689 {
690 if(errcode_ret != nullptr)
691 {
692 *errcode_ret = CL_OUT_OF_RESOURCES;
693 }
694 return nullptr;
695 }
696}
697
698cl_int clRetainContext(cl_context context)
699{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100700 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000701 auto func = arm_compute::CLSymbols::get().clRetainContext_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100702 if(func != nullptr)
703 {
704 return func(context);
705 }
706 else
707 {
708 return CL_OUT_OF_RESOURCES;
709 }
710}
711
712cl_int clReleaseProgram(cl_program program)
713{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100714 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000715 auto func = arm_compute::CLSymbols::get().clReleaseProgram_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100716 if(func != nullptr)
717 {
718 return func(program);
719 }
720 else
721 {
722 return CL_OUT_OF_RESOURCES;
723 }
724}
725
726cl_int clFlush(cl_command_queue command_queue)
727{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100728 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000729 auto func = arm_compute::CLSymbols::get().clFlush_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100730 if(func != nullptr)
731 {
732 return func(command_queue);
733 }
734 else
735 {
736 return CL_OUT_OF_RESOURCES;
737 }
738}
739
Gian Marco Iodice63d76a72017-08-11 11:56:52 +0100740cl_int clFinish(cl_command_queue command_queue)
741{
742 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000743 auto func = arm_compute::CLSymbols::get().clFinish_ptr;
Gian Marco Iodice63d76a72017-08-11 11:56:52 +0100744 if(func != nullptr)
745 {
746 return func(command_queue);
747 }
748 else
749 {
750 return CL_OUT_OF_RESOURCES;
751 }
752}
753
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100754cl_int clGetProgramInfo(
755 cl_program program,
756 cl_program_info param_name,
757 size_t param_value_size,
758 void *param_value,
759 size_t *param_value_size_ret)
760{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100761 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000762 auto func = arm_compute::CLSymbols::get().clGetProgramInfo_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100763 if(func != nullptr)
764 {
765 return func(program, param_name, param_value_size, param_value, param_value_size_ret);
766 }
767 else
768 {
769 return CL_OUT_OF_RESOURCES;
770 }
771}
772
773cl_kernel clCreateKernel(
774 cl_program program,
775 const char *kernel_name,
776 cl_int *errcode_ret)
777{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100778 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000779 auto func = arm_compute::CLSymbols::get().clCreateKernel_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100780 if(func != nullptr)
781 {
782 return func(program, kernel_name, errcode_ret);
783 }
784 else
785 {
786 if(errcode_ret != nullptr)
787 {
788 *errcode_ret = CL_OUT_OF_RESOURCES;
789 }
790 return nullptr;
791 }
792}
793
794cl_int clRetainKernel(cl_kernel kernel)
795{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100796 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000797 auto func = arm_compute::CLSymbols::get().clRetainKernel_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100798 if(func != nullptr)
799 {
800 return func(kernel);
801 }
802 else
803 {
804 return CL_OUT_OF_RESOURCES;
805 }
806}
807
808cl_mem clCreateBuffer(
809 cl_context context,
810 cl_mem_flags flags,
811 size_t size,
812 void *host_ptr,
813 cl_int *errcode_ret)
814{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100815 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000816 auto func = arm_compute::CLSymbols::get().clCreateBuffer_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100817 if(func != nullptr)
818 {
819 return func(context, flags, size, host_ptr, errcode_ret);
820 }
821 else
822 {
823 if(errcode_ret != nullptr)
824 {
825 *errcode_ret = CL_OUT_OF_RESOURCES;
826 }
827 return nullptr;
828 }
829}
830
831cl_program clCreateProgramWithSource(
832 cl_context context,
833 cl_uint count,
834 const char **strings,
835 const size_t *lengths,
836 cl_int *errcode_ret)
837{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100838 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000839 auto func = arm_compute::CLSymbols::get().clCreateProgramWithSource_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100840 if(func != nullptr)
841 {
842 return func(context, count, strings, lengths, errcode_ret);
843 }
844 else
845 {
846 if(errcode_ret != nullptr)
847 {
848 *errcode_ret = CL_OUT_OF_RESOURCES;
849 }
850 return nullptr;
851 }
852}
853
854cl_int clReleaseKernel(cl_kernel kernel)
855{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100856 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000857 auto func = arm_compute::CLSymbols::get().clReleaseKernel_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100858 if(func != nullptr)
859 {
860 return func(kernel);
861 }
862 else
863 {
864 return CL_OUT_OF_RESOURCES;
865 }
866}
867
868cl_int clGetDeviceIDs(cl_platform_id platform,
869 cl_device_type device_type,
870 cl_uint num_entries,
871 cl_device_id *devices,
872 cl_uint *num_devices)
873{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100874 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000875 auto func = arm_compute::CLSymbols::get().clGetDeviceIDs_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100876 if(func != nullptr)
877 {
878 return func(platform, device_type, num_entries, devices, num_devices);
879 }
880 else
881 {
882 return CL_OUT_OF_RESOURCES;
883 }
884}
885
886cl_int clGetDeviceInfo(cl_device_id device,
887 cl_device_info param_name,
888 size_t param_value_size,
889 void *param_value,
890 size_t *param_value_size_ret)
891{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100892 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000893 auto func = arm_compute::CLSymbols::get().clGetDeviceInfo_ptr;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100894 if(func != nullptr)
895 {
896 return func(device, param_name, param_value_size, param_value, param_value_size_ret);
897 }
898 else
899 {
900 return CL_OUT_OF_RESOURCES;
901 }
902}
Giorgio Arena9fe41442017-08-23 16:36:24 +0100903
Georgios Pinitasdf310362018-11-14 13:16:56 +0000904cl_int clGetMemObjectInfo(cl_mem memobj,
905 cl_mem_info param_name,
906 size_t param_value_size,
907 void *param_value,
908 size_t *param_value_size_ret)
909{
910 arm_compute::CLSymbols::get().load_default();
911 auto func = arm_compute::CLSymbols::get().clGetMemObjectInfo_ptr;
912 if(func != nullptr)
913 {
914 return func(memobj, param_name, param_value_size, param_value, param_value_size_ret);
915 }
916 else
917 {
918 return CL_OUT_OF_RESOURCES;
919 }
920}
921
Giorgio Arena9fe41442017-08-23 16:36:24 +0100922cl_int clRetainEvent(cl_event event)
923{
Moritz Pflanzer159b6da2017-09-20 16:03:35 +0100924 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000925 auto func = arm_compute::CLSymbols::get().clRetainEvent_ptr;
Giorgio Arena9fe41442017-08-23 16:36:24 +0100926 if(func != nullptr)
927 {
928 return func(event);
929 }
930 else
931 {
932 return CL_OUT_OF_RESOURCES;
933 }
934}
steniu01f01f9de2017-09-27 17:00:11 +0100935
Michalis Spyrou402740d2021-04-20 11:26:21 +0100936cl_int clGetPlatformInfo(cl_platform_id platform,
937 cl_platform_info param_name,
938 size_t param_value_size,
939 void *param_value,
940 size_t *param_value_size_ret)
941{
942 arm_compute::CLSymbols::get().load_default();
943 auto func = arm_compute::CLSymbols::get().clGetPlatformInfo_ptr;
944 if(func != nullptr)
945 {
946 return func(platform, param_name, param_value_size, param_value, param_value_size_ret);
947 }
948 else
949 {
950 return CL_OUT_OF_RESOURCES;
951 }
952}
953
steniu01f01f9de2017-09-27 17:00:11 +0100954cl_int clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)
955{
956 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000957 auto func = arm_compute::CLSymbols::get().clGetPlatformIDs_ptr;
steniu01f01f9de2017-09-27 17:00:11 +0100958 if(func != nullptr)
959 {
960 return func(num_entries, platforms, num_platforms);
961 }
962 else
963 {
964 return CL_OUT_OF_RESOURCES;
965 }
966}
Abel Bernabeu5a6e0532017-09-28 09:53:45 +0100967
968cl_int
969clGetKernelWorkGroupInfo(cl_kernel kernel,
970 cl_device_id device,
971 cl_kernel_work_group_info param_name,
972 size_t param_value_size,
973 void *param_value,
974 size_t *param_value_size_ret)
975{
976 arm_compute::CLSymbols::get().load_default();
Anthony Barbier58c4ff12017-11-09 09:15:32 +0000977 auto func = arm_compute::CLSymbols::get().clGetKernelWorkGroupInfo_ptr;
Abel Bernabeu5a6e0532017-09-28 09:53:45 +0100978 if(func != nullptr)
979 {
980 return func(kernel, device, param_name, param_value_size, param_value, param_value_size_ret);
981 }
982 else
983 {
984 return CL_OUT_OF_RESOURCES;
985 }
986}
Gian Marco85e6f512018-02-01 16:57:48 +0000987
988cl_int
989clGetCommandQueueInfo(cl_command_queue command_queue,
990 cl_command_queue_info param_name,
991 size_t param_value_size,
992 void *param_value,
993 size_t *param_value_size_ret)
994{
995 arm_compute::CLSymbols::get().load_default();
996 auto func = arm_compute::CLSymbols::get().clGetCommandQueueInfo_ptr;
997 if(func != nullptr)
998 {
999 return func(command_queue, param_name, param_value_size, param_value, param_value_size_ret);
1000 }
1001 else
1002 {
1003 return CL_OUT_OF_RESOURCES;
1004 }
1005}
1006
1007cl_int
1008clGetKernelInfo(cl_kernel kernel,
1009 cl_kernel_info param_name,
1010 size_t param_value_size,
1011 void *param_value,
1012 size_t *param_value_size_ret)
1013{
1014 arm_compute::CLSymbols::get().load_default();
1015 auto func = arm_compute::CLSymbols::get().clGetKernelInfo_ptr;
1016 if(func != nullptr)
1017 {
1018 return func(kernel, param_name, param_value_size, param_value, param_value_size_ret);
1019 }
1020 else
1021 {
1022 return CL_OUT_OF_RESOURCES;
1023 }
1024}
1025
1026cl_int
1027clGetEventProfilingInfo(cl_event event,
1028 cl_profiling_info param_name,
1029 size_t param_value_size,
1030 void *param_value,
1031 size_t *param_value_size_ret)
1032{
1033 arm_compute::CLSymbols::get().load_default();
1034 auto func = arm_compute::CLSymbols::get().clGetEventProfilingInfo_ptr;
1035 if(func != nullptr)
1036 {
1037 return func(event, param_name, param_value_size, param_value, param_value_size_ret);
1038 }
1039 else
1040 {
1041 return CL_OUT_OF_RESOURCES;
1042 }
Anthony Barbierf5dcf792018-02-28 18:04:45 +00001043}
Georgios Pinitas4d0351c2019-04-03 15:11:16 +01001044
1045cl_mem
Gian Marco Iodicea98dee22020-06-02 12:12:35 +01001046clCreateImage(cl_context context,
1047 cl_mem_flags flags,
1048 const cl_image_format *image_format,
1049 const cl_image_desc *image_desc,
1050 void *host_ptr,
1051 cl_int *errcode_ret)
1052{
1053 arm_compute::CLSymbols::get().load_default();
1054 auto func = arm_compute::CLSymbols::get().clCreateImage_ptr;
1055 if(func != nullptr)
1056 {
1057 return func(context, flags, image_format, image_desc, host_ptr, errcode_ret);
1058 }
1059 else
1060 {
1061 if(errcode_ret != nullptr)
1062 {
1063 *errcode_ret = CL_OUT_OF_RESOURCES;
1064 }
1065 return nullptr;
1066 }
1067}
1068
Manuel Bottinibe9f9f92021-01-25 15:07:17 +00001069cl_int clSetKernelExecInfo(cl_kernel kernel,
1070 cl_kernel_exec_info param_name,
1071 size_t param_value_size,
1072 const void *param_value)
1073{
1074 arm_compute::CLSymbols::get().load_default();
1075 auto func = arm_compute::CLSymbols::get().clSetKernelExecInfo_ptr;
1076 if(func != nullptr)
1077 {
1078 return func(kernel, param_name, param_value_size, param_value);
1079 }
1080 else
1081 {
1082 return CL_OUT_OF_RESOURCES;
1083 }
1084}
1085
Gian Marco Iodicea98dee22020-06-02 12:12:35 +01001086cl_mem
Georgios Pinitas4d0351c2019-04-03 15:11:16 +01001087clImportMemoryARM(cl_context context,
1088 cl_mem_flags flags,
1089 const cl_import_properties_arm *properties,
1090 void *memory,
1091 size_t size,
1092 cl_int *errcode_ret)
1093{
1094 arm_compute::CLSymbols::get().load_default();
1095 auto func = arm_compute::CLSymbols::get().clImportMemoryARM_ptr;
1096 if(func != nullptr)
1097 {
1098 return func(context, flags, properties, memory, size, errcode_ret);
1099 }
1100 else
1101 {
1102 if(errcode_ret != nullptr)
1103 {
1104 *errcode_ret = CL_OUT_OF_RESOURCES;
1105 }
1106 return nullptr;
1107 }
Pablo Tellodb8485a2019-09-24 11:03:47 +01001108}