21.02
|
OpenCL buffer memory region implementation. More...
#include <CLMemoryRegion.h>
Public Member Functions | |
CLBufferMemoryRegion (CLCoreRuntimeContext *ctx, cl_mem_flags flags, size_t size) | |
Constructor. More... | |
CLBufferMemoryRegion (const cl::Buffer &buffer, CLCoreRuntimeContext *ctx) | |
Constructor. More... | |
void * | ptr () final |
Host/SVM pointer accessor. More... | |
void * | map (cl::CommandQueue &q, bool blocking) final |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap (cl::CommandQueue &q) final |
Enqueue an unmap operation of the allocated buffer on the given queue. More... | |
Public Member Functions inherited from ICLMemoryRegion | |
ICLMemoryRegion (CLCoreRuntimeContext *ctx, size_t size) | |
Constructor. More... | |
virtual | ~ICLMemoryRegion ()=default |
Default Destructor. More... | |
ICLMemoryRegion (const ICLMemoryRegion &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ICLMemoryRegion (ICLMemoryRegion &&)=default | |
Default move constructor. More... | |
ICLMemoryRegion & | operator= (const ICLMemoryRegion &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ICLMemoryRegion & | operator= (ICLMemoryRegion &&)=default |
Default move assignment operator. More... | |
const cl::Buffer & | cl_data () const |
Returns the underlying CL buffer. More... | |
void * | buffer () override |
Returns the pointer to the allocated data. More... | |
const void * | buffer () const override |
Returns the pointer to the allocated data. More... | |
std::unique_ptr< IMemoryRegion > | extract_subregion (size_t offset, size_t size) override |
Extract a sub-region from the memory. More... | |
Public Member Functions inherited from IMemoryRegion | |
IMemoryRegion (size_t size) | |
Default constructor. More... | |
virtual | ~IMemoryRegion ()=default |
Virtual Destructor. More... | |
size_t | size () const |
Memory region size accessor. More... | |
void | set_size (size_t size) |
Sets size of region. More... | |
OpenCL buffer memory region implementation.
Definition at line 97 of file CLMemoryRegion.h.
CLBufferMemoryRegion | ( | CLCoreRuntimeContext * | ctx, |
cl_mem_flags | flags, | ||
size_t | size | ||
) |
Constructor.
[in] | ctx | Runtime context |
[in] | flags | Memory flags |
[in] | size | Region size |
Definition at line 62 of file CLMemoryRegion.cpp.
References CLCoreRuntimeContext::context(), CLScheduler::context(), and CLScheduler::get().
CLBufferMemoryRegion | ( | const cl::Buffer & | buffer, |
CLCoreRuntimeContext * | ctx | ||
) |
Constructor.
[in] | buffer | Buffer to be used as a memory region |
[in] | ctx | Runtime context |
Definition at line 71 of file CLMemoryRegion.cpp.
References ICLMemoryRegion::buffer().
|
finalvirtual |
Enqueue a map operation of the allocated buffer on the given queue.
[in,out] | q | The CL command queue to use for the mapping operation. |
[in] | blocking | If true, then the mapping will be ready to use by the time this method returns, else it is the caller's responsibility to flush the queue and wait for the mapping operation to have completed before using the returned mapping pointer. |
Implements ICLMemoryRegion.
Definition at line 82 of file CLMemoryRegion.cpp.
References ARM_COMPUTE_ERROR_ON.
|
finalvirtual |
Host/SVM pointer accessor.
Implements ICLMemoryRegion.
Definition at line 77 of file CLMemoryRegion.cpp.
|
finalvirtual |
Enqueue an unmap operation of the allocated buffer on the given queue.
[in,out] | q | The CL command queue to use for the mapping operation. |
Implements ICLMemoryRegion.
Definition at line 89 of file CLMemoryRegion.cpp.
References ARM_COMPUTE_ERROR_ON, clFinish(), clSVMAlloc(), clSVMFree(), CLCoreRuntimeContext::context(), CLScheduler::context(), CLScheduler::get(), ICLMemoryRegion::ICLMemoryRegion(), and IMemoryRegion::size().