Compute Library
 23.11
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 155 of file CLMemoryRegion.cpp.

156  : ICLSVMMemoryRegion(flags, size, alignment)
157 {
158 }

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 160 of file CLMemoryRegion.cpp.

161 {
162  if (blocking)
163  {
164  clFinish(q.get());
165  }
166  _mapping = _ptr;
167  return _mapping;
168 }

References clFinish().

◆ 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 170 of file CLMemoryRegion.cpp.

171 {
173  _mapping = nullptr;
174 }

References ARM_COMPUTE_UNUSED.


The documentation for this class was generated from the following files:
arm_compute::IMemoryRegion::size
size_t size() const
Memory region size accessor.
Definition: IMemoryRegion.h:72
clFinish
cl_int clFinish(cl_command_queue command_queue)
Definition: OpenCL.cpp:743
ARM_COMPUTE_UNUSED
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:151