| 234 | } |
| 235 | |
| 236 | bool opencl_is_available() |
| 237 | { |
| 238 | CLSymbols::get().load_default(); |
| 239 | |
| 240 | // Using static objects that rely on OpenCL in their constructor or |
| 241 | // destructor is implementation defined according to the OpenCL API |
| 242 | // Specification. These objects include CLScheduler. |
| 243 | // |
| 244 | // For compatibility with OpenCL runtimes that also use static objects to |
| 245 | // hold their state, we call a harmless OpenCL function (clGetPlatformIDs |
| 246 | // with invalid parameters must result in CL_INVALID_VALUE) to ensure the |
| 247 | // runtimes have a chance to initialize their static objects first. Thanks |
| 248 | // to C++11 rules about normal program completion (cf [basic.start]), this |
| 249 | // ensures their static objects are destroyed last, i.e. after the |
| 250 | // singleton CLScheduler is destroyed. |
| 251 | // |
| 252 | // When OpenCL is not available, this call results in CL_OUT_OF_RESOURCES, |
| 253 | // which is equally harmless. |
| 254 | (void)clGetPlatformIDs(0, nullptr, nullptr); |
| 255 | |
| 256 | return CLSymbols::get().clBuildProgram_ptr != nullptr; |
| 257 | } |
| 258 | } // namespace arm_compute |
| 259 | |
| 260 | cl_int clEnqueueMarker(cl_command_queue command_queue, cl_event *event) |
no test coverage detected