21.02
|
Basic function to execute GEMM on OpenCL. More...
#include <CLGEMM.h>
Public Member Functions | |
CLGEMM (std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr) | |
Default constructor. More... | |
CLGEMM (const CLGEMM &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLGEMM (CLGEMM &&)=default | |
Default move constructor. More... | |
CLGEMM & | operator= (const CLGEMM &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLGEMM & | operator= (CLGEMM &&)=default |
Default move assignment operator. More... | |
~CLGEMM () | |
Default destructor. More... | |
void | configure (const ICLTensor *a, const ICLTensor *b, const ICLTensor *c, ICLTensor *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Initialise the kernel's inputs and output. More... | |
void | configure (const CLCompileContext &compile_context, const ICLTensor *a, const ICLTensor *b, const ICLTensor *c, ICLTensor *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Initialise the kernel's inputs and output. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
void | prepare () override |
Prepare the function for executing. More... | |
Public Member Functions inherited from IFunction | |
virtual | ~IFunction ()=default |
Destructor. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Static function to check if given info will lead to a valid configuration of CLGEMM. More... | |
Basic function to execute GEMM on OpenCL.
This function calls the following OpenCL kernels:
CLGEMM | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr , |
IWeightsManager * | weights_manager = nullptr |
||
) |
Default constructor.
[in] | memory_manager | (Optional) Memory manager. |
[in] | weights_manager | (Optional) Weights manager. |
Definition at line 233 of file CLGEMM.cpp.
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default destructor.
void configure | ( | const ICLTensor * | a, |
const ICLTensor * | b, | ||
const ICLTensor * | c, | ||
ICLTensor * | output, | ||
float | alpha, | ||
float | beta, | ||
const GEMMInfo & | gemm_info = GEMMInfo() |
||
) |
Initialise the kernel's inputs and output.
[in] | a | First input tensor (Matrix or Vector A). Data types supported: F16/F32 |
[in] | b | Second input tensor (Matrix B). Data type supported: same as a . |
[in] | c | Third input tensor (Matrix C). It can be a nullptr if just the multiplication between a and b is needed. Data type supported: same as a . |
[out] | output | Output tensor. Data type supported: same as a |
[in] | alpha | Weight of the matrix product |
[in] | beta | Weight of matrix C |
[in] | gemm_info | (Optional) Specifies if the matrix A and/or matrix B have been reshaped and if the reshape of matrix B should happen only for the first run. GEMMInfo also contains information about the reshaping in case matrix A and matrix B have been already transformed. |
Definition at line 666 of file CLGEMM.cpp.
References CLKernelLibrary::get().
Referenced by CLRNNLayer::configure(), CLWinogradConvolutionLayer::configure(), CLGEMMDeconvolutionLayer::configure(), and CLLSTMLayer::configure().
void configure | ( | const CLCompileContext & | compile_context, |
const ICLTensor * | a, | ||
const ICLTensor * | b, | ||
const ICLTensor * | c, | ||
ICLTensor * | output, | ||
float | alpha, | ||
float | beta, | ||
const GEMMInfo & | gemm_info = GEMMInfo() |
||
) |
Initialise the kernel's inputs and output.
[in] | compile_context | The compile context to be used. |
[in] | a | First input tensor (Matrix or Vector A). Data types supported: F16/F32 |
[in] | b | Second input tensor (Matrix B). Data type supported: same as a . |
[in] | c | Third input tensor (Matrix C). It can be a nullptr if just the multiplication between a and b is needed. Data type supported: same as a . |
[out] | output | Output tensor. Data type supported: same as a |
[in] | alpha | Weight of the matrix product |
[in] | beta | Weight of matrix C |
[in] | gemm_info | (Optional) Specifies if the matrix A and/or matrix B have been reshaped and if the reshape of matrix B should happen only for the first run. GEMMInfo also contains information about the reshaping in case matrix A and matrix B have been already transformed. |
Definition at line 671 of file CLGEMM.cpp.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::test::validation::b, ITensorInfo::data_type(), ITensorInfo::dimension(), CLScheduler::get(), ITensor::info(), arm_compute::helpers::float_ops::is_zero(), arm_compute::NATIVE_V1, GEMMInfo::reinterpret_input_as_3d(), GEMMInfo::reshape_b_only_on_first_run(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_V1, GEMMInfo::retain_internal_weights(), CLScheduler::target(), and CLGEMM::validate().
Prevent instances of this class from being copied (As this class contains pointers)
|
overridevirtual |
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
Reimplemented from IFunction.
Definition at line 870 of file CLGEMM.cpp.
References CLTensorAllocator::allocate(), CLTensor::allocator(), IWeightsManager::are_weights_managed(), CLScheduler::enqueue(), CLScheduler::get(), ITensor::mark_as_unused(), arm_compute::NATIVE_V1, CLScheduler::queue(), and IWeightsManager::run().
Referenced by CLRNNLayer::prepare(), CLWinogradConvolutionLayer::prepare(), CLGEMMDeconvolutionLayer::prepare(), CLFullyConnectedLayer::prepare(), CLGEMMConvolutionLayer::prepare(), and CLGEMM::run().
|
overridevirtual |
Run the kernels contained in the function.
For Neon kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 778 of file CLGEMM.cpp.
References IWeightsManager::are_weights_managed(), ARM_COMPUTE_ERROR, BorderSize::bottom, CLScheduler::enqueue(), CLScheduler::get(), ITensor::info(), arm_compute::NATIVE_V1, ITensorInfo::padding(), CLGEMM::prepare(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_V1, IWeightsManager::run(), and BorderSize::top.
Referenced by CLRNNLayer::run(), CLWinogradConvolutionLayer::run(), CLGEMMDeconvolutionLayer::run(), CLFullyConnectedLayer::run(), CLLSTMLayer::run(), and CLGEMMConvolutionLayer::run().
|
static |
Static function to check if given info will lead to a valid configuration of CLGEMM.
[in] | a | First input tensor info (Matrix or Vector A). Data types supported: F16/F32 |
[in] | b | Second input tensor info (Matrix B). Data type supported: same as a . |
[in] | c | Third input tensor info (Matrix C). It can be a nullptr if just the multiplication between a and b is needed. Data type supported: same as a . |
[in] | output | Output tensor info. Data type supported: same as a |
[in] | alpha | Weight of the matrix product |
[in] | beta | Weight of matrix C |
[in] | gemm_info | (Optional) Specifies if the matrix A and/or matrix B have been reshaped and if the reshape of matrix B should happen only for the first run |
Definition at line 727 of file CLGEMM.cpp.
References ARM_COMPUTE_RETURN_ERROR_MSG, ARM_COMPUTE_RETURN_ON_ERROR, ITensorInfo::data_type(), ITensorInfo::dimension(), CLScheduler::get(), arm_compute::helpers::float_ops::is_zero(), arm_compute::NATIVE_V1, GEMMInfo::reinterpret_input_as_3d(), GEMMInfo::reshape_b_only_on_first_run(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_V1, and CLScheduler::target().
Referenced by CLGEMM::configure(), CLRNNLayer::validate(), CLWinogradConvolutionLayer::validate(), CLGEMMDeconvolutionLayer::validate(), and CLLSTMLayer::validate().