Compute Library
 22.08
CLFineSVMMemoryRegion Class Referencefinal

OpenCL fine-grain SVM memory region implementation. More...

#include <CLMemoryRegion.h>

Collaboration diagram for CLFineSVMMemoryRegion:
[legend]

Public Member Functions

 CLFineSVMMemoryRegion (cl_mem_flags flags, size_t size, size_t alignment)
 Constructor. 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 (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...
 
ICLMemoryRegionoperator= (const ICLMemoryRegion &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
ICLMemoryRegionoperator= (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< IMemoryRegionextract_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...
 

Detailed Description

OpenCL fine-grain SVM memory region implementation.

Definition at line 163 of file CLMemoryRegion.h.

Constructor & Destructor Documentation

◆ CLFineSVMMemoryRegion()

CLFineSVMMemoryRegion ( cl_mem_flags  flags,
size_t  size,
size_t  alignment 
)

Constructor.

Parameters
[in]flagsMemory flags
[in]sizeRegion size
[in]alignmentAlignment

Definition at line 149 of file CLMemoryRegion.cpp.

150  : ICLSVMMemoryRegion(flags, size, alignment)
151 {
152 }
size_t size() const
Memory region size accessor.
Definition: IMemoryRegion.h:73

Member Function Documentation

◆ map()

void * map ( cl::CommandQueue &  q,
bool  blocking 
)
finalvirtual

Enqueue a map operation of the allocated buffer on the given queue.

Parameters
[in,out]qThe CL command queue to use for the mapping operation.
[in]blockingIf 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.
Returns
The mapping address.

Implements ICLMemoryRegion.

Definition at line 154 of file CLMemoryRegion.cpp.

References clFinish().

155 {
156  if(blocking)
157  {
158  clFinish(q.get());
159  }
160  _mapping = _ptr;
161  return _mapping;
162 }
cl_int clFinish(cl_command_queue command_queue)
Definition: OpenCL.cpp:725

◆ unmap()

void unmap ( cl::CommandQueue &  q)
finalvirtual

Enqueue an unmap operation of the allocated buffer on the given queue.

Note
This method simply enqueue the unmap operation, it is the caller's responsibility to flush the queue and make sure the unmap is finished before the memory is accessed by the device.
Parameters
[in,out]qThe CL command queue to use for the mapping operation.

Implements ICLMemoryRegion.

Definition at line 164 of file CLMemoryRegion.cpp.

References ARM_COMPUTE_UNUSED.

165 {
167  _mapping = nullptr;
168 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

The documentation for this class was generated from the following files: