Compute Library
18.05
|
Basic implementation of a CL memory tensor allocator. More...
#include <CLTensorAllocator.h>
Public Member Functions | |
CLTensorAllocator (CLTensor *owner=nullptr) | |
Default constructor. More... | |
CLTensorAllocator (const CLTensorAllocator &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLTensorAllocator & | operator= (const CLTensorAllocator &)=delete |
Prevent instances of this class from being copy assigned (As this class contains pointers) More... | |
CLTensorAllocator (CLTensorAllocator &&)=default | |
Allow instances of this class to be moved. More... | |
CLTensorAllocator & | operator= (CLTensorAllocator &&)=default |
Allow instances of this class to be moved. More... | |
uint8_t * | data () |
Interface to be implemented by the child class to return the pointer to the mapped data. More... | |
const cl::Buffer & | cl_data () const |
Interface to be implemented by the child class to return the pointer to the CL data. More... | |
uint8_t * | map (cl::CommandQueue &q, bool blocking) |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap (cl::CommandQueue &q, uint8_t *mapping) |
Enqueue an unmap operation of the allocated buffer on the given queue. More... | |
void | allocate () override |
Allocate size specified by TensorInfo of OpenCL memory. More... | |
void | free () override |
Free allocated OpenCL memory. More... | |
arm_compute::Status | import_memory (CLMemory memory) |
Import an existing memory as a tensor's backing memory. More... | |
void | set_associated_memory_group (CLMemoryGroup *associated_memory_group) |
Associates the tensor with a memory group. More... | |
![]() | |
ITensorAllocator () | |
Default constructor. More... | |
ITensorAllocator (const ITensorAllocator &)=default | |
Allow instances of this class to be copy constructed. More... | |
ITensorAllocator & | operator= (const ITensorAllocator &)=default |
Allow instances of this class to be copied. More... | |
ITensorAllocator (ITensorAllocator &&)=default | |
Allow instances of this class to be move constructed. More... | |
ITensorAllocator & | operator= (ITensorAllocator &&)=default |
Allow instances of this class to be moved. More... | |
virtual | ~ITensorAllocator ()=default |
Default virtual destructor. More... | |
void | init (const TensorInfo &input) |
Initialize a tensor based on the passed TensorInfo. More... | |
TensorInfo & | info () |
Return a reference to the tensor's metadata. More... | |
const TensorInfo & | info () const |
Return a constant reference to the tensor's metadata. More... | |
Basic implementation of a CL memory tensor allocator.
Definition at line 43 of file CLTensorAllocator.h.
CLTensorAllocator | ( | CLTensor * | owner = nullptr | ) |
Default constructor.
[in] | owner | (Optional) Owner of the allocator. |
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Allocate size specified by TensorInfo of OpenCL memory.
Implements ITensorAllocator.
Referenced by arm_compute::test::validation::DATA_TEST_CASE().
const cl::Buffer& cl_data | ( | ) | const |
Interface to be implemented by the child class to return the pointer to the CL data.
uint8_t* data | ( | ) |
Interface to be implemented by the child class to return the pointer to the mapped data.
|
overridevirtual |
Free allocated OpenCL memory.
Implements ITensorAllocator.
arm_compute::Status import_memory | ( | CLMemory | memory | ) |
Import an existing memory as a tensor's backing memory.
[in] | memory | Memory to import |
uint8_t* map | ( | cl::CommandQueue & | q, |
bool | blocking | ||
) |
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. |
|
delete |
Prevent instances of this class from being copy assigned (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
void set_associated_memory_group | ( | CLMemoryGroup * | associated_memory_group | ) |
Associates the tensor with a memory group.
[in] | associated_memory_group | Memory group to associate the tensor with |
void unmap | ( | cl::CommandQueue & | q, |
uint8_t * | mapping | ||
) |
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. |
[in] | mapping | The cpu mapping to unmap. |