21.02
|
Basic implementation of a GLES memory tensor allocator. More...
#include <GCTensorAllocator.h>
Public Member Functions | |
GCTensorAllocator (IMemoryManageable *owner=nullptr) | |
Default constructor. More... | |
GCTensorAllocator (const GCTensorAllocator &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
GCTensorAllocator & | operator= (const GCTensorAllocator &)=delete |
Prevent instances of this class from being copy assigned (As this class contains pointers) More... | |
GCTensorAllocator (GCTensorAllocator &&)=default | |
Allow instances of this class to be moved. More... | |
GCTensorAllocator & | operator= (GCTensorAllocator &&)=default |
Allow instances of this class to be moved. More... | |
~GCTensorAllocator ()=default | |
Default destructor. More... | |
uint8_t * | data () |
Interface to be implemented by the child class to return the pointer to the mapped data. More... | |
GLuint | get_gl_ssbo_name () const |
Get the OpenGL ES buffer object name. More... | |
uint8_t * | map (bool blocking) |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap () |
Enqueue an unmap operation of the allocated buffer on the given queue. More... | |
void | allocate () override |
Allocate size specified by TensorInfo of GLES memory. More... | |
void | free () override |
Free allocated GLES memory. More... | |
void | set_associated_memory_group (IMemoryGroup *associated_memory_group) |
Associates the tensor with a memory group. More... | |
Public Member Functions inherited from ITensorAllocator | |
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, size_t alignment=0) |
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... | |
size_t | alignment () const |
Return underlying's tensor buffer alignment. More... | |
Basic implementation of a GLES memory tensor allocator.
Definition at line 40 of file GCTensorAllocator.h.
GCTensorAllocator | ( | IMemoryManageable * | owner = nullptr | ) |
Default constructor.
Definition at line 34 of file GCTensorAllocator.cpp.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
default |
Default destructor.
|
overridevirtual |
Allocate size specified by TensorInfo of GLES memory.
Implements ITensorAllocator.
Definition at line 44 of file GCTensorAllocator.cpp.
References ITensorAllocator::alignment(), IMemoryGroup::finalize_memory(), ITensorAllocator::info(), TensorInfo::set_is_resizable(), and GCMemory::set_owned_region().
uint8_t * data | ( | ) |
Interface to be implemented by the child class to return the pointer to the mapped data.
Definition at line 39 of file GCTensorAllocator.cpp.
Referenced by GCTensor::buffer().
|
overridevirtual |
Free allocated GLES memory.
Implements ITensorAllocator.
Definition at line 57 of file GCTensorAllocator.cpp.
References ITensorAllocator::info(), TensorInfo::set_is_resizable(), and GCMemory::set_region().
GLuint get_gl_ssbo_name | ( | ) | const |
Get the OpenGL ES buffer object name.
Definition at line 83 of file GCTensorAllocator.cpp.
References GCMemory::gc_region(), IGCMemoryRegion::gc_ssbo_name(), and GCMemory::region().
Referenced by GCTensor::gc_buffer().
uint8_t * map | ( | bool | blocking | ) |
Enqueue a map operation of the allocated buffer on the given queue.
[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. |
Definition at line 88 of file GCTensorAllocator.cpp.
References ARM_COMPUTE_ERROR_ON, GCMemory::gc_region(), IGCMemoryRegion::map(), and GCMemory::region().
Referenced by GCTensorAllocator::set_associated_memory_group(), and GCTensor::unmap().
|
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 | ( | IMemoryGroup * | associated_memory_group | ) |
Associates the tensor with a memory group.
[in] | associated_memory_group | Memory group to associate the tensor with |
Definition at line 64 of file GCTensorAllocator.cpp.
References ARM_COMPUTE_ERROR_ON, GCMemory::gc_region(), IGCMemoryRegion::gc_ssbo_name(), GCTensorAllocator::map(), GCMemory::region(), and GCTensorAllocator::unmap().
Referenced by GCTensor::associate_memory_group().
void unmap | ( | ) |
Enqueue an unmap operation of the allocated buffer on the given queue.
Definition at line 97 of file GCTensorAllocator.cpp.
References ARM_COMPUTE_ERROR_ON, GCMemory::gc_region(), GCMemory::region(), and IGCMemoryRegion::unmap().
Referenced by GCTensorAllocator::set_associated_memory_group(), and GCTensor::unmap().