23.08
|
Basic implementation of the OpenCL tensor interface. More...
#include <CLTensor.h>
Public Member Functions | |
CLTensor (IRuntimeContext *ctx=nullptr) | |
Constructor. More... | |
~CLTensor ()=default | |
Destructor. More... | |
CLTensor (const CLTensor &)=delete | |
Prevent copying by construction. More... | |
CLTensor (CLTensor &&)=default | |
Default move constructor. More... | |
CLTensor & | operator= (const CLTensor &)=delete |
Prevent copaingy by assignment. More... | |
CLTensor & | operator= (CLTensor &&)=default |
Default move assignment operator. More... | |
CLTensorAllocator * | allocator () |
Return a pointer to the tensor's allocator. More... | |
void | map (bool blocking=true) |
Enqueue a map operation of the allocated buffer. More... | |
void | unmap () |
Enqueue an unmap operation of the allocated and mapped buffer. More... | |
TensorInfo * | info () const override |
Interface to be implemented by the child class to return the tensor's metadata. More... | |
TensorInfo * | info () override |
Interface to be implemented by the child class to return the tensor's metadata. More... | |
const cl::Buffer & | cl_buffer () const override |
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the image's data. More... | |
CLQuantization | quantization () const override |
Interface to be implemented by the child class to return the wrapped quantization info data. More... | |
void | associate_memory_group (IMemoryGroup *memory_group) override |
Associates a memory managable object with the memory group that manages it. More... | |
CLRuntimeContext * | context () |
void | map (cl::CommandQueue &q, bool blocking=true) |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap (cl::CommandQueue &q) |
Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More... | |
![]() | |
ICLTensor () | |
Default constructor. More... | |
ICLTensor (const ICLTensor &)=delete | |
Prevent instances of this class from being copy constructed. More... | |
ICLTensor & | operator= (const ICLTensor &)=delete |
Prevent instances of this class from being copied. More... | |
ICLTensor (ICLTensor &&)=default | |
Allow instances of this class to be move constructed. More... | |
ICLTensor & | operator= (ICLTensor &&)=default |
Allow instances of this class to be copied. More... | |
virtual | ~ICLTensor ()=default |
Default virtual destructor. More... | |
void | map (cl::CommandQueue &q, bool blocking=true) |
Enqueue a map operation of the allocated buffer on the given queue. More... | |
void | unmap (cl::CommandQueue &q) |
Enqueue an unmap operation of the allocated and mapped buffer on the given queue. More... | |
void | clear (cl::CommandQueue &q) |
Clear the contents of the tensor synchronously. More... | |
uint8_t * | buffer () const override |
Interface to be implemented by the child class to return a pointer to CPU memory. More... | |
![]() | |
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... | |
void | mark_as_used () const |
Marks a tensor as used. More... | |
![]() | |
virtual | ~IMemoryManageable ()=default |
Default virtual destructor. More... | |
Basic implementation of the OpenCL tensor interface.
Definition at line 41 of file CLTensor.h.
CLTensor | ( | IRuntimeContext * | ctx = nullptr | ) |
Constructor.
[in] | ctx | (Optional) Pointer to a CLRuntimeContext. If nullptr is passed in, the legacy api using the singletons will be used. Otherwise the memory for the tensor will allocate on the context passed in. The singletons legacy api has been deprecated and will be removed in future releases. |
Definition at line 31 of file CLTensor.cpp.
|
default |
Destructor.
CLTensorAllocator * allocator | ( | ) |
Return a pointer to the tensor's allocator.
Definition at line 61 of file CLTensor.cpp.
Referenced by CLTensorHandle::allocate(), CLAuxTensorHandler::CLAuxTensorHandler(), CLTensorHandle::CLTensorHandle(), arm_compute::test::validation::compute_float_target_in_place(), CLReduceMean::configure(), CLFFT2D::configure(), CLRNNLayer::configure(), CLFFT1D::configure(), CLDepthwiseConvolutionLayer::configure(), CLL2NormalizeLayer::configure(), CLReductionOperation::configure(), CLArgMinMaxLayer::configure(), CLInstanceNormalizationLayer::configure(), CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), CLLSTMLayer::configure(), CLQLSTMLayer::configure(), CLTensorHandle::free(), arm_compute::manage_workspace(), CLDepthwiseConvolutionLayer::prepare(), CLFFTConvolutionLayer::prepare(), CLGEMMDeconvolutionLayer::prepare(), CLDirectDeconvolutionLayer::prepare(), CLLSTMLayerQuantized::prepare(), CLQLSTMLayer::prepare(), CLConvertFullyConnectedWeightsManaged::release(), CLTensorHandle::release_if_unused(), CLConvertFullyConnectedWeightsManaged::run(), CLFFTConvolutionLayer::run(), and arm_compute::test::validation::TEST_CASE().
|
overridevirtual |
Associates a memory managable object with the memory group that manages it.
[in] | memory_group | Memory group that manages the object. |
Implements IMemoryManageable.
Definition at line 86 of file CLTensor.cpp.
References CLTensorAllocator::set_associated_memory_group().
|
overridevirtual |
Interface to be implemented by the child class to return a reference to the OpenCL buffer containing the image's data.
Implements ICLTensor.
Definition at line 51 of file CLTensor.cpp.
References CLTensorAllocator::cl_data().
Referenced by arm_compute::create_image2d_from_tensor(), CLFFTConvolutionLayer::run(), and arm_compute::test::validation::TEST_CASE().
CLRuntimeContext * context | ( | ) |
Definition at line 36 of file CLTensor.cpp.
|
overridevirtual |
Interface to be implemented by the child class to return the tensor's metadata.
Implements ITensor.
Definition at line 41 of file CLTensor.cpp.
References ITensorAllocator::info().
Referenced by CLReduceMean::configure(), CLDepthwiseConvolutionLayer::configure(), CLArgMinMaxLayer::configure(), CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), CLLSTMLayer::configure(), CLQLSTMLayer::configure(), arm_compute::create_image2d_from_tensor(), CLAccessor::data_layout(), CLAccessor::data_type(), CLAccessor::element_size(), arm_compute::error_on_data_layout_not_in(), arm_compute::error_on_data_type_channel_not_in(), arm_compute::error_on_data_type_not_in(), arm_compute::error_on_mismatching_data_layouts(), arm_compute::error_on_mismatching_data_types(), arm_compute::error_on_unsupported_cpu_bf16(), arm_compute::error_on_unsupported_cpu_fp16(), arm_compute::error_on_unsupported_fp16(), CLAccessor::format(), arm_compute::get_padding_info(), CLAccessor::num_channels(), CLAccessor::num_elements(), CLAccessor::padding(), CLQLSTMLayer::prepare(), CLAccessor::quantization_info(), CLAccessor::shape(), CLAccessor::size(), arm_compute::test::validation::TEST_CASE(), and arm_compute::to_string().
|
overridevirtual |
Interface to be implemented by the child class to return the tensor's metadata.
Implements ITensor.
void map | ( | bool | blocking = true | ) |
Enqueue a map operation of the allocated buffer.
[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. |
Definition at line 66 of file CLTensor.cpp.
References CLScheduler::get(), CLRuntimeContext::gpu_scheduler(), ICLTensor::map(), and CLScheduler::queue().
Referenced by AclMapTensor(), CLFFT1D::configure(), CLFFTConvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLTensorHandle::map(), CLDepthwiseConvolutionLayer::prepare(), and CLQLSTMLayer::prepare().
void map |
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. |
Definition at line 35 of file ICLTensor.cpp.
|
overridevirtual |
Interface to be implemented by the child class to return the wrapped quantization info data.
Implements ICLTensor.
Definition at line 56 of file CLTensor.cpp.
References CLTensorAllocator::quantization().
void unmap | ( | ) |
Enqueue an unmap operation of the allocated and mapped buffer.
Definition at line 71 of file CLTensor.cpp.
References CLScheduler::get(), CLRuntimeContext::gpu_scheduler(), CLScheduler::queue(), and ICLTensor::unmap().
Referenced by AclUnmapTensor(), CLFFT1D::configure(), CLFFTConvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLDepthwiseConvolutionLayer::prepare(), CLQLSTMLayer::prepare(), CLTensorHandle::unmap(), and CLAccessor::~CLAccessor().
void unmap |
Enqueue an unmap operation of the allocated and mapped buffer on the given queue.
[in,out] | q | The CL command queue to use for the mapping operation. |
Definition at line 40 of file ICLTensor.cpp.