blob: 085e186543ea0d1b9ff122c9ba8514cd4f8da1b4 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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
25#include "arm_compute/core/CL/OpenCL.h"
26
27#include <dlfcn.h>
28#include <iostream>
29
Moritz Pflanzer725788e2017-07-07 15:35:56 +010030namespace arm_compute
Anthony Barbier6ff3b192017-09-04 18:44:23 +010031{
Moritz Pflanzer725788e2017-07-07 15:35:56 +010032CLSymbols &CLSymbols::get()
33{
34 static CLSymbols symbols;
35 return symbols;
36}
37
38bool CLSymbols::load_default()
39{
40 static const std::vector<std::string> libraries{ "libOpenCL.so", "libGLES_mali.so", "libmali.so" };
41
42 if(_loaded.first)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010043 {
Moritz Pflanzer725788e2017-07-07 15:35:56 +010044 return _loaded.second;
45 }
46
47 // Indicate that default loading has been tried
48 _loaded.first = true;
49
50 for(const auto &lib : libraries)
51 {
52 if(load(lib))
Anthony Barbier6ff3b192017-09-04 18:44:23 +010053 {
Moritz Pflanzer725788e2017-07-07 15:35:56 +010054 return true;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010055 }
56 }
57
Moritz Pflanzer725788e2017-07-07 15:35:56 +010058 std::cerr << "Couldn't find any OpenCL library.\n";
59 return false;
60}
61
62bool CLSymbols::load(const std::string &library)
63{
64 void *handle = dlopen(library.c_str(), RTLD_LAZY | RTLD_LOCAL);
65
66 if(handle == nullptr)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010067 {
Moritz Pflanzer725788e2017-07-07 15:35:56 +010068 std::cerr << "Can't load " << library << ": " << dlerror() << "\n";
69 // Set status of loading to failed
70 _loaded.second = false;
71 return false;
Anthony Barbier6ff3b192017-09-04 18:44:23 +010072 }
73
Moritz Pflanzer725788e2017-07-07 15:35:56 +010074 clBuildProgram = reinterpret_cast<clBuildProgram_func>(dlsym(handle, "clBuildProgram"));
75 clEnqueueNDRangeKernel = reinterpret_cast<clEnqueueNDRangeKernel_func>(dlsym(handle, "clEnqueueNDRangeKernel"));
76 clSetKernelArg = reinterpret_cast<clSetKernelArg_func>(dlsym(handle, "clSetKernelArg"));
77 clReleaseKernel = reinterpret_cast<clReleaseKernel_func>(dlsym(handle, "clReleaseKernel"));
78 clCreateProgramWithSource = reinterpret_cast<clCreateProgramWithSource_func>(dlsym(handle, "clCreateProgramWithSource"));
79 clCreateBuffer = reinterpret_cast<clCreateBuffer_func>(dlsym(handle, "clCreateBuffer"));
80 clRetainKernel = reinterpret_cast<clRetainKernel_func>(dlsym(handle, "clRetainKernel"));
81 clCreateKernel = reinterpret_cast<clCreateKernel_func>(dlsym(handle, "clCreateKernel"));
82 clGetProgramInfo = reinterpret_cast<clGetProgramInfo_func>(dlsym(handle, "clGetProgramInfo"));
83 clFlush = reinterpret_cast<clFlush_func>(dlsym(handle, "clFlush"));
Gian Marco Iodice63d76a72017-08-11 11:56:52 +010084 clFinish = reinterpret_cast<clFinish_func>(dlsym(handle, "clFinish"));
Moritz Pflanzer725788e2017-07-07 15:35:56 +010085 clReleaseProgram = reinterpret_cast<clReleaseProgram_func>(dlsym(handle, "clReleaseProgram"));
86 clRetainContext = reinterpret_cast<clRetainContext_func>(dlsym(handle, "clRetainContext"));
87 clCreateProgramWithBinary = reinterpret_cast<clCreateProgramWithBinary_func>(dlsym(handle, "clCreateProgramWithBinary"));
88 clReleaseCommandQueue = reinterpret_cast<clReleaseCommandQueue_func>(dlsym(handle, "clReleaseCommandQueue"));
89 clEnqueueMapBuffer = reinterpret_cast<clEnqueueMapBuffer_func>(dlsym(handle, "clEnqueueMapBuffer"));
90 clRetainProgram = reinterpret_cast<clRetainProgram_func>(dlsym(handle, "clRetainProgram"));
91 clGetProgramBuildInfo = reinterpret_cast<clGetProgramBuildInfo_func>(dlsym(handle, "clGetProgramBuildInfo"));
92 clEnqueueReadBuffer = reinterpret_cast<clEnqueueReadBuffer_func>(dlsym(handle, "clEnqueueReadBuffer"));
93 clEnqueueWriteBuffer = reinterpret_cast<clEnqueueWriteBuffer_func>(dlsym(handle, "clEnqueueWriteBuffer"));
94 clReleaseEvent = reinterpret_cast<clReleaseEvent_func>(dlsym(handle, "clReleaseEvent"));
95 clReleaseContext = reinterpret_cast<clReleaseContext_func>(dlsym(handle, "clReleaseContext"));
96 clRetainCommandQueue = reinterpret_cast<clRetainCommandQueue_func>(dlsym(handle, "clRetainCommandQueue"));
97 clEnqueueUnmapMemObject = reinterpret_cast<clEnqueueUnmapMemObject_func>(dlsym(handle, "clEnqueueUnmapMemObject"));
98 clReleaseMemObject = reinterpret_cast<clReleaseMemObject_func>(dlsym(handle, "clReleaseMemObject"));
99 clGetDeviceInfo = reinterpret_cast<clGetDeviceInfo_func>(dlsym(handle, "clGetDeviceInfo"));
100 clGetDeviceIDs = reinterpret_cast<clGetDeviceIDs_func>(dlsym(handle, "clGetDeviceIDs"));
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100101
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100102 dlclose(handle);
103
104 // Disable default loading and set status to successful
105 _loaded = std::make_pair(true, true);
106
107 return true;
108}
109
110bool opencl_is_available()
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100111{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100112 CLSymbols::get().load_default();
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100113 return CLSymbols::get().clBuildProgram != nullptr;
114}
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100115} // namespace arm_compute
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100116
117cl_int clBuildProgram(
118 cl_program program,
119 cl_uint num_devices,
120 const cl_device_id *device_list,
121 const char *options,
122 void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
123 void *user_data)
124{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100125 arm_compute::CLSymbols::get().load_default();
126 auto func = arm_compute::CLSymbols::get().clBuildProgram;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100127 if(func != nullptr)
128 {
129 return func(program, num_devices, device_list, options, pfn_notify, user_data);
130 }
131 else
132 {
133 return CL_OUT_OF_RESOURCES;
134 }
135}
136
137cl_int clEnqueueNDRangeKernel(
138 cl_command_queue command_queue,
139 cl_kernel kernel,
140 cl_uint work_dim,
141 const size_t *global_work_offset,
142 const size_t *global_work_size,
143 const size_t *local_work_size,
144 cl_uint num_events_in_wait_list,
145 const cl_event *event_wait_list,
146 cl_event *event)
147{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100148 arm_compute::CLSymbols::get().load_default();
149 auto func = arm_compute::CLSymbols::get().clEnqueueNDRangeKernel;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100150 if(func != nullptr)
151 {
152 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);
153 }
154 else
155 {
156 return CL_OUT_OF_RESOURCES;
157 }
158}
159
160cl_int clSetKernelArg(
161 cl_kernel kernel,
162 cl_uint arg_index,
163 size_t arg_size,
164 const void *arg_value)
165{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100166 arm_compute::CLSymbols::get().load_default();
167 auto func = arm_compute::CLSymbols::get().clSetKernelArg;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100168 if(func != nullptr)
169 {
170 return func(kernel, arg_index, arg_size, arg_value);
171 }
172 else
173 {
174 return CL_OUT_OF_RESOURCES;
175 }
176}
177
178cl_int clReleaseMemObject(cl_mem memobj)
179{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100180 arm_compute::CLSymbols::get().load_default();
181 auto func = arm_compute::CLSymbols::get().clReleaseMemObject;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100182 if(func != nullptr)
183 {
184 return func(memobj);
185 }
186 else
187 {
188 return CL_OUT_OF_RESOURCES;
189 }
190}
191
192cl_int clEnqueueUnmapMemObject(
193 cl_command_queue command_queue,
194 cl_mem memobj,
195 void *mapped_ptr,
196 cl_uint num_events_in_wait_list,
197 const cl_event *event_wait_list,
198 cl_event *event)
199{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100200 arm_compute::CLSymbols::get().load_default();
201 auto func = arm_compute::CLSymbols::get().clEnqueueUnmapMemObject;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100202 if(func != nullptr)
203 {
204 return func(command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
205 }
206 else
207 {
208 return CL_OUT_OF_RESOURCES;
209 }
210}
211
212cl_int clRetainCommandQueue(cl_command_queue command_queue)
213{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100214 arm_compute::CLSymbols::get().load_default();
215 auto func = arm_compute::CLSymbols::get().clRetainCommandQueue;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100216 if(func != nullptr)
217 {
218 return func(command_queue);
219 }
220 else
221 {
222 return CL_OUT_OF_RESOURCES;
223 }
224}
225
226cl_int clReleaseContext(cl_context context)
227{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100228 arm_compute::CLSymbols::get().load_default();
229 auto func = arm_compute::CLSymbols::get().clReleaseContext;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100230 if(func != nullptr)
231 {
232 return func(context);
233 }
234 else
235 {
236 return CL_OUT_OF_RESOURCES;
237 }
238}
239cl_int clReleaseEvent(cl_event event)
240{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100241 arm_compute::CLSymbols::get().load_default();
242 auto func = arm_compute::CLSymbols::get().clReleaseEvent;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100243 if(func != nullptr)
244 {
245 return func(event);
246 }
247 else
248 {
249 return CL_OUT_OF_RESOURCES;
250 }
251}
252
253cl_int clEnqueueWriteBuffer(
254 cl_command_queue command_queue,
255 cl_mem buffer,
256 cl_bool blocking_write,
257 size_t offset,
258 size_t size,
259 const void *ptr,
260 cl_uint num_events_in_wait_list,
261 const cl_event *event_wait_list,
262 cl_event *event)
263{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100264 arm_compute::CLSymbols::get().load_default();
265 auto func = arm_compute::CLSymbols::get().clEnqueueWriteBuffer;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100266 if(func != nullptr)
267 {
268 return func(command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
269 }
270 else
271 {
272 return CL_OUT_OF_RESOURCES;
273 }
274}
275
276cl_int clEnqueueReadBuffer(
277 cl_command_queue command_queue,
278 cl_mem buffer,
279 cl_bool blocking_read,
280 size_t offset,
281 size_t size,
282 void *ptr,
283 cl_uint num_events_in_wait_list,
284 const cl_event *event_wait_list,
285 cl_event *event)
286{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100287 arm_compute::CLSymbols::get().load_default();
288 auto func = arm_compute::CLSymbols::get().clEnqueueReadBuffer;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100289 if(func != nullptr)
290 {
291 return func(command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
292 }
293 else
294 {
295 return CL_OUT_OF_RESOURCES;
296 }
297}
298
299cl_int clGetProgramBuildInfo(
300 cl_program program,
301 cl_device_id device,
302 cl_program_build_info param_name,
303 size_t param_value_size,
304 void *param_value,
305 size_t *param_value_size_ret)
306{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100307 arm_compute::CLSymbols::get().load_default();
308 auto func = arm_compute::CLSymbols::get().clGetProgramBuildInfo;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100309 if(func != nullptr)
310 {
311 return func(program, device, param_name, param_value_size, param_value, param_value_size_ret);
312 }
313 else
314 {
315 return CL_OUT_OF_RESOURCES;
316 }
317}
318
319cl_int clRetainProgram(cl_program program)
320{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100321 arm_compute::CLSymbols::get().load_default();
322 auto func = arm_compute::CLSymbols::get().clRetainProgram;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100323 if(func != nullptr)
324 {
325 return func(program);
326 }
327 else
328 {
329 return CL_OUT_OF_RESOURCES;
330 }
331}
332
333void *clEnqueueMapBuffer(
334 cl_command_queue command_queue,
335 cl_mem buffer,
336 cl_bool blocking_map,
337 cl_map_flags map_flags,
338 size_t offset,
339 size_t size,
340 cl_uint num_events_in_wait_list,
341 const cl_event *event_wait_list,
342 cl_event *event,
343 cl_int *errcode_ret)
344{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100345 arm_compute::CLSymbols::get().load_default();
346 auto func = arm_compute::CLSymbols::get().clEnqueueMapBuffer;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100347 if(func != nullptr)
348 {
349 return func(command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret);
350 }
351 else
352 {
353 if(errcode_ret != nullptr)
354 {
355 *errcode_ret = CL_OUT_OF_RESOURCES;
356 }
357 return nullptr;
358 }
359}
360
361cl_int clReleaseCommandQueue(cl_command_queue command_queue)
362{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100363 arm_compute::CLSymbols::get().load_default();
364 auto func = arm_compute::CLSymbols::get().clReleaseCommandQueue;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100365 if(func != nullptr)
366 {
367 return func(command_queue);
368 }
369 else
370 {
371 return CL_OUT_OF_RESOURCES;
372 }
373}
374
375cl_program clCreateProgramWithBinary(
376 cl_context context,
377 cl_uint num_devices,
378 const cl_device_id *device_list,
379 const size_t *lengths,
380 const unsigned char **binaries,
381 cl_int *binary_status,
382 cl_int *errcode_ret)
383{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100384 arm_compute::CLSymbols::get().load_default();
385 auto func = arm_compute::CLSymbols::get().clCreateProgramWithBinary;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100386 if(func != nullptr)
387 {
388 return func(context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret);
389 }
390 else
391 {
392 if(errcode_ret != nullptr)
393 {
394 *errcode_ret = CL_OUT_OF_RESOURCES;
395 }
396 return nullptr;
397 }
398}
399
400cl_int clRetainContext(cl_context context)
401{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100402 arm_compute::CLSymbols::get().load_default();
403 auto func = arm_compute::CLSymbols::get().clRetainContext;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100404 if(func != nullptr)
405 {
406 return func(context);
407 }
408 else
409 {
410 return CL_OUT_OF_RESOURCES;
411 }
412}
413
414cl_int clReleaseProgram(cl_program program)
415{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100416 arm_compute::CLSymbols::get().load_default();
417 auto func = arm_compute::CLSymbols::get().clReleaseProgram;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100418 if(func != nullptr)
419 {
420 return func(program);
421 }
422 else
423 {
424 return CL_OUT_OF_RESOURCES;
425 }
426}
427
428cl_int clFlush(cl_command_queue command_queue)
429{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100430 arm_compute::CLSymbols::get().load_default();
431 auto func = arm_compute::CLSymbols::get().clFlush;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100432 if(func != nullptr)
433 {
434 return func(command_queue);
435 }
436 else
437 {
438 return CL_OUT_OF_RESOURCES;
439 }
440}
441
Gian Marco Iodice63d76a72017-08-11 11:56:52 +0100442cl_int clFinish(cl_command_queue command_queue)
443{
444 arm_compute::CLSymbols::get().load_default();
445 auto func = arm_compute::CLSymbols::get().clFinish;
446 if(func != nullptr)
447 {
448 return func(command_queue);
449 }
450 else
451 {
452 return CL_OUT_OF_RESOURCES;
453 }
454}
455
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100456cl_int clGetProgramInfo(
457 cl_program program,
458 cl_program_info param_name,
459 size_t param_value_size,
460 void *param_value,
461 size_t *param_value_size_ret)
462{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100463 arm_compute::CLSymbols::get().load_default();
464 auto func = arm_compute::CLSymbols::get().clGetProgramInfo;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100465 if(func != nullptr)
466 {
467 return func(program, param_name, param_value_size, param_value, param_value_size_ret);
468 }
469 else
470 {
471 return CL_OUT_OF_RESOURCES;
472 }
473}
474
475cl_kernel clCreateKernel(
476 cl_program program,
477 const char *kernel_name,
478 cl_int *errcode_ret)
479{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100480 arm_compute::CLSymbols::get().load_default();
481 auto func = arm_compute::CLSymbols::get().clCreateKernel;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100482 if(func != nullptr)
483 {
484 return func(program, kernel_name, errcode_ret);
485 }
486 else
487 {
488 if(errcode_ret != nullptr)
489 {
490 *errcode_ret = CL_OUT_OF_RESOURCES;
491 }
492 return nullptr;
493 }
494}
495
496cl_int clRetainKernel(cl_kernel kernel)
497{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100498 arm_compute::CLSymbols::get().load_default();
499 auto func = arm_compute::CLSymbols::get().clRetainKernel;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100500 if(func != nullptr)
501 {
502 return func(kernel);
503 }
504 else
505 {
506 return CL_OUT_OF_RESOURCES;
507 }
508}
509
510cl_mem clCreateBuffer(
511 cl_context context,
512 cl_mem_flags flags,
513 size_t size,
514 void *host_ptr,
515 cl_int *errcode_ret)
516{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100517 arm_compute::CLSymbols::get().load_default();
518 auto func = arm_compute::CLSymbols::get().clCreateBuffer;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100519 if(func != nullptr)
520 {
521 return func(context, flags, size, host_ptr, errcode_ret);
522 }
523 else
524 {
525 if(errcode_ret != nullptr)
526 {
527 *errcode_ret = CL_OUT_OF_RESOURCES;
528 }
529 return nullptr;
530 }
531}
532
533cl_program clCreateProgramWithSource(
534 cl_context context,
535 cl_uint count,
536 const char **strings,
537 const size_t *lengths,
538 cl_int *errcode_ret)
539{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100540 arm_compute::CLSymbols::get().load_default();
541 auto func = arm_compute::CLSymbols::get().clCreateProgramWithSource;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100542 if(func != nullptr)
543 {
544 return func(context, count, strings, lengths, errcode_ret);
545 }
546 else
547 {
548 if(errcode_ret != nullptr)
549 {
550 *errcode_ret = CL_OUT_OF_RESOURCES;
551 }
552 return nullptr;
553 }
554}
555
556cl_int clReleaseKernel(cl_kernel kernel)
557{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100558 arm_compute::CLSymbols::get().load_default();
559 auto func = arm_compute::CLSymbols::get().clReleaseKernel;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100560 if(func != nullptr)
561 {
562 return func(kernel);
563 }
564 else
565 {
566 return CL_OUT_OF_RESOURCES;
567 }
568}
569
570cl_int clGetDeviceIDs(cl_platform_id platform,
571 cl_device_type device_type,
572 cl_uint num_entries,
573 cl_device_id *devices,
574 cl_uint *num_devices)
575{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100576 arm_compute::CLSymbols::get().load_default();
577 auto func = arm_compute::CLSymbols::get().clGetDeviceIDs;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100578 if(func != nullptr)
579 {
580 return func(platform, device_type, num_entries, devices, num_devices);
581 }
582 else
583 {
584 return CL_OUT_OF_RESOURCES;
585 }
586}
587
588cl_int clGetDeviceInfo(cl_device_id device,
589 cl_device_info param_name,
590 size_t param_value_size,
591 void *param_value,
592 size_t *param_value_size_ret)
593{
Moritz Pflanzer725788e2017-07-07 15:35:56 +0100594 arm_compute::CLSymbols::get().load_default();
595 auto func = arm_compute::CLSymbols::get().clGetDeviceInfo;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100596 if(func != nullptr)
597 {
598 return func(device, param_name, param_value_size, param_value, param_value_size_ret);
599 }
600 else
601 {
602 return CL_OUT_OF_RESOURCES;
603 }
604}