Compute Library
 21.02
GCTensor Class Reference

Interface for OpenGL ES tensor. More...

#include <GCTensor.h>

Collaboration diagram for GCTensor:
[legend]

Public Member Functions

 GCTensor (IRuntimeContext *ctx=nullptr)
 Default constructor. More...
 
 GCTensor (const GCTensor &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
GCTensoroperator= (const GCTensor &)=delete
 Prevent instances of this class from being copy assigned (As this class contains pointers) More...
 
 GCTensor (GCTensor &&)=default
 Allow instances of this class to be moved. More...
 
GCTensoroperator= (GCTensor &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~GCTensor ()=default
 Virtual destructor. More...
 
ITensorAllocatorallocator ()
 Return a pointer to the tensor's allocator. More...
 
void map (bool blocking=true)
 Enqueue a map operation of the allocated buffer on the given queue. More...
 
void unmap ()
 Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More...
 
TensorInfoinfo () const override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
TensorInfoinfo () override
 Interface to be implemented by the child class to return the tensor's metadata. More...
 
uint8_t * buffer () const override
 Interface to be implemented by the child class to return a pointer to CPU memory. More...
 
GLuint gc_buffer () const override
 Interface to be implemented by the child class to return the tensor's gles compute buffer id. More...
 
void associate_memory_group (IMemoryGroup *memory_group) override
 Associates a memory managable object with the memory group that manages it. More...
 
- Public Member Functions inherited from IGCTensor
 IGCTensor ()
 Default constructor. More...
 
 IGCTensor (const IGCTensor &)=delete
 Prevent instances of this class from being copied (As this class contains pointers) More...
 
IGCTensoroperator= (const IGCTensor &)=delete
 Prevent instances of this class from being copy assigned (As this class contains pointers) More...
 
 IGCTensor (IGCTensor &&)=default
 Allow instances of this class to be moved. More...
 
IGCTensoroperator= (IGCTensor &&)=default
 Allow instances of this class to be moved. More...
 
virtual ~IGCTensor ()=default
 Virtual destructor. More...
 
void map (bool blocking=true)
 Map on an allocated buffer. More...
 
void unmap ()
 Unmap an allocated and mapped buffer. More...
 
void clear ()
 Clear the contents of the tensor synchronously. More...
 
bool needs_shifting () const
 Flag indicating whether the tensor has been left aligned by a kernel and therefore needs shifting. More...
 
void set_needs_shifting (bool needs_shifting)
 Set the flag indicating whether or not a tensor needs shifting. More...
 
- Public Member Functions inherited from ITensor
virtual ~ITensor ()=default
 Default virtual destructor. More...
 
uint8_t * ptr_to_element (const Coordinates &id) const
 Return a pointer to the element at the passed coordinates. More...
 
void copy_from (const ITensor &src)
 Copy the content of another tensor. More...
 
void print (std::ostream &s, IOFormatInfo io_fmt=IOFormatInfo()) const
 Print a tensor to a given stream using user defined formatting information. More...
 
bool is_used () const
 Flags if the tensor is used or not. More...
 
void mark_as_unused () const
 Marks a tensor as unused. More...
 
- Public Member Functions inherited from IMemoryManageable
virtual ~IMemoryManageable ()=default
 Default virtual destructor. More...
 

Detailed Description

Interface for OpenGL ES tensor.

Definition at line 38 of file GCTensor.h.

Constructor & Destructor Documentation

◆ GCTensor() [1/3]

GCTensor ( IRuntimeContext ctx = nullptr)

Default constructor.

Parameters
[in]ctx(Optional) Pointer to the runtime context.

Definition at line 29 of file GCTensor.cpp.

30  : _allocator(this)
31 {
32 }

◆ GCTensor() [2/3]

GCTensor ( const GCTensor )
delete

Prevent instances of this class from being copied (As this class contains pointers)

◆ GCTensor() [3/3]

GCTensor ( GCTensor &&  )
default

Allow instances of this class to be moved.

◆ ~GCTensor()

virtual ~GCTensor ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ allocator()

◆ associate_memory_group()

void associate_memory_group ( IMemoryGroup memory_group)
overridevirtual

Associates a memory managable object with the memory group that manages it.

Parameters
[in]memory_groupMemory group that manages the object.

Implements IMemoryManageable.

Definition at line 59 of file GCTensor.cpp.

References GCTensorAllocator::set_associated_memory_group().

60 {
61  _allocator.set_associated_memory_group(memory_group);
62 }
void set_associated_memory_group(IMemoryGroup *associated_memory_group)
Associates the tensor with a memory group.

◆ buffer()

uint8_t * buffer ( ) const
overridevirtual

Interface to be implemented by the child class to return a pointer to CPU memory.

Returns
A CPU pointer to the beginning of the image's allocation.

Reimplemented from IGCTensor.

Definition at line 49 of file GCTensor.cpp.

References GCTensorAllocator::data().

50 {
51  return _allocator.data();
52 }
uint8_t * data()
Interface to be implemented by the child class to return the pointer to the mapped data...

◆ gc_buffer()

GLuint gc_buffer ( ) const
overridevirtual

Interface to be implemented by the child class to return the tensor's gles compute buffer id.

Returns
A SSBO buffer id.

Implements IGCTensor.

Definition at line 54 of file GCTensor.cpp.

References GCTensorAllocator::get_gl_ssbo_name().

Referenced by GCFullyConnectedLayer::configure().

55 {
56  return _allocator.get_gl_ssbo_name();
57 }
GLuint get_gl_ssbo_name() const
Get the OpenGL ES buffer object name.

◆ info() [1/2]

TensorInfo * info ( ) const
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 39 of file GCTensor.cpp.

References ITensorAllocator::info().

Referenced by GCConvolutionLayer::configure(), GCAccessor::data_layout(), GCAccessor::data_type(), GCAccessor::element_size(), GCAccessor::format(), GCAccessor::num_channels(), GCAccessor::num_elements(), GCAccessor::padding(), GCAccessor::quantization_info(), GCAccessor::shape(), and GCAccessor::size().

40 {
41  return &_allocator.info();
42 }
TensorInfo & info()
Return a reference to the tensor&#39;s metadata.

◆ info() [2/2]

TensorInfo * info ( )
overridevirtual

Interface to be implemented by the child class to return the tensor's metadata.

Returns
A pointer to the tensor's metadata.

Implements ITensor.

Definition at line 44 of file GCTensor.cpp.

References ITensorAllocator::info().

45 {
46  return &_allocator.info();
47 }
TensorInfo & info()
Return a reference to the tensor&#39;s metadata.

◆ map()

void map ( bool  blocking = true)

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

Parameters
[in]blocking(Optional) 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.
Returns
The mapping address.

Definition at line 64 of file GCTensor.cpp.

References IGCTensor::map().

Referenced by GCAccessor::GCAccessor(), GCTensorHandle::map(), and arm_compute::utils::unmap().

65 {
66  IGCTensor::map(blocking);
67 }
void map(bool blocking=true)
Map on an allocated buffer.
Definition: IGCTensor.cpp:33

◆ operator=() [1/2]

GCTensor& operator= ( const GCTensor )
delete

Prevent instances of this class from being copy assigned (As this class contains pointers)

◆ operator=() [2/2]

GCTensor& operator= ( GCTensor &&  )
default

Allow instances of this class to be moved.

◆ unmap()

void unmap ( )

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

Note
This method simply enqueues 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.

Definition at line 69 of file GCTensor.cpp.

References GCTensorAllocator::map(), IGCTensor::unmap(), and GCTensorAllocator::unmap().

Referenced by GCTensorHandle::unmap(), arm_compute::utils::unmap(), and GCAccessor::~GCAccessor().

70 {
72 }
void unmap()
Unmap an allocated and mapped buffer.
Definition: IGCTensor.cpp:38

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