34 _queue((ctx != nullptr) ? ctx->queue() :
CLScheduler::get().queue()),
35 _ctx((ctx != nullptr) ? ctx->context() :
CLScheduler::get().context()),
85 _mapping = q.enqueueMapBuffer(_mem, blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, 0, _size);
92 q.enqueueUnmapMemObject(_mem, _mapping);
109 ICLSVMMemoryRegion::~ICLSVMMemoryRegion()
125 void *ICLSVMMemoryRegion::ptr()
138 clEnqueueSVMMap(q.get(), blocking ? CL_TRUE : CL_FALSE, CL_MAP_READ | CL_MAP_WRITE, _ptr, _size, 0,
nullptr,
nullptr);
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
CLCoarseSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment)
Constructor.
cl::Context context()
OpenCL context accessor.
void * map(cl::CommandQueue &q, bool blocking) final
Enqueue a map operation of the allocated buffer on the given queue.
static CLScheduler & get()
Access the scheduler singleton.
ICLMemoryRegion(CLCoreRuntimeContext *ctx, size_t size)
Constructor.
OpenCL SVM memory region interface.
void unmap(cl::CommandQueue &q) final
Enqueue an unmap operation of the allocated buffer on the given queue.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
OpenCL memory region interface.
Copyright (c) 2017-2021 Arm Limited.
const cl::Buffer & cl_data() const
Returns the underlying CL buffer.
void clSVMFree(cl_context context, void *svm_pointer)
Interface to enqueue OpenCL kernels and get/set the OpenCL CommandQueue and ICLTuner.
void unmap(cl::CommandQueue &q) final
Enqueue an unmap operation of the allocated buffer on the given queue.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
cl::Context & context()
Accessor for the associated CL context.
Core runtime context for OpenCL.
CLBufferMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size)
Constructor.
cl_int clEnqueueSVMUnmap(cl_command_queue command_queue, void *svm_ptr, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
void * buffer() override
Returns the pointer to the allocated data.
cl_int clEnqueueSVMMap(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void *svm_ptr, size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
void unmap(cl::CommandQueue &q) final
Enqueue an unmap operation of the allocated buffer on the given queue.
void * map(cl::CommandQueue &q, bool blocking) final
Enqueue a map operation of the allocated buffer on the given queue.
void * clSVMAlloc(cl_context context, cl_svm_mem_flags_arm flags, size_t size, cl_uint alignment)
Provides global access to a CL context and command queue.
CLFineSVMMemoryRegion(CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size, size_t alignment)
Constructor.
std::unique_ptr< IMemoryRegion > extract_subregion(size_t offset, size_t size) override
Extract a sub-region from the memory.
void * ptr() final
Host/SVM pointer accessor.
void * map(cl::CommandQueue &q, bool blocking) final
Enqueue a map operation of the allocated buffer on the given queue.
cl_int clFinish(cl_command_queue command_queue)
size_t size() const
Memory region size accessor.