24 #ifndef __ARM_COMPUTE_CLSCHEDULER_H__ 25 #define __ARM_COMPUTE_CLSCHEDULER_H__ 35 #if defined(ARM_COMPUTE_DEBUG_ENABLED) 38 void printf_callback(
const char *
buffer,
unsigned int len,
size_t complete,
void *user_data)
40 printf(
"%.*s", len, buffer);
75 #if defined(ARM_COMPUTE_DEBUG_ENABLED) 77 cl_context_properties properties[] =
80 CL_PRINTF_CALLBACK_ARM,
reinterpret_cast<cl_context_properties
>(printf_callback),
83 CL_PRINTF_BUFFERSIZE_ARM, static_cast<cl_context_properties>(0x100000),
84 CL_CONTEXT_PLATFORM,
reinterpret_cast<cl_context_properties
>(cl::Platform::get()()),
87 cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT, properties));
88 #endif // defined(ARM_COMPUTE_DEBUG_ENABLED) 91 init(cl::Context::getDefault(), cl::CommandQueue::getDefault(), cl::Device::getDefault(), cl_tuner);
113 void init(cl::Context
context = cl::Context::getDefault(), cl::CommandQueue
queue = cl::CommandQueue::getDefault(),
114 cl::Device device = cl::Device::getDefault(),
ICLTuner *cl_tuner =
nullptr)
117 _queue = std::move(
queue);
119 _is_initialised =
true;
120 _cl_tuner = cl_tuner;
139 _context = std::move(context);
167 _queue = std::move(queue);
192 _queue.enqueueMarker(&event);
206 cl::NDRange tune_kernel(
ICLKernel &kernel);
209 static std::once_flag _initialize_symbols;
211 cl::Context _context;
212 cl::CommandQueue _queue;
214 bool _is_initialised;
void set_target(GPUTarget target)
Accessor to set target GPU to be used by the scheduler.
void init(std::string kernel_path=".", cl::Context context=cl::Context::getDefault(), cl::Device device=cl::Device::getDefault())
Initialises the kernel library.
void set_context(cl::Context context)
Accessor to set the CL context to be used by the scheduler.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Common interface for all the OpenCL kernels.
This file contains all available output stages for GEMMLowp on OpenCL.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
GPUTarget target() const
Get the target GPU.
cl::Event enqueue_sync_event()
Enqueues a marker into the associated command queue and return the event.
void enqueue(ICLKernel &kernel, bool flush=true)
Schedule the execution of the passed kernel if possible.
void set_queue(cl::CommandQueue queue)
Accessor to set the CL command queue to be used by the scheduler.
cl::CommandQueue & queue()
Accessor for the associated CL command queue.
void sync()
Blocks until all commands in the associated command queue have finished.
GPUTarget
Available GPU Targets.
GPUTarget get_target_from_device(cl::Device &device)
Helper function to get the GPU target from CL device.
Provides global access to a CL context and command queue.
void init(cl::Context context=cl::Context::getDefault(), cl::CommandQueue queue=cl::CommandQueue::getDefault(), cl::Device device=cl::Device::getDefault(), ICLTuner *cl_tuner=nullptr)
Initialises the context and command queue to be used by the scheduler.
Basic interface for tuning the OpenCL kernels.
void default_init(ICLTuner *cl_tuner=nullptr)
Initialises the context and command queue used by the scheduler to default values and sets a default ...
cl::Context & context()
Accessor for the associated CL context.