24.02.1
|
Basic function to execute GEMM on OpenCL. More...
#include <ClGemm.h>
Public Member Functions | |
ClGemm () | |
Constructor. More... | |
void | configure (const CLCompileContext &compile_context, ITensorInfo *a, ITensorInfo *b, ITensorInfo *c, ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info) |
Initialise the kernel's inputs and output. More... | |
void | run (ITensorPack &tensors) override |
Run the kernels contained in the function. More... | |
void | prepare (ITensorPack &constants) override |
Prepare the function for executing. More... | |
experimental::MemoryRequirements | workspace () const override |
Return the memory requirements required by the workspace. More... | |
Public Member Functions inherited from ICLOperator | |
ICLOperator (IRuntimeContext *ctx=nullptr) | |
Constructor. More... | |
ICLOperator (const ICLOperator &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ICLOperator (ICLOperator &&)=default | |
Default move constructor. More... | |
ICLOperator & | operator= (const ICLOperator &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
ICLOperator & | operator= (ICLOperator &&)=default |
Default move assignment operator. More... | |
Public Member Functions inherited from IOperator | |
virtual | ~IOperator ()=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) |
Static function to check if given info will lead to a valid configuration. More... | |
Basic function to execute GEMM on OpenCL.
This function calls the following OpenCL kernels:
ClGemm | ( | ) |
Constructor.
Definition at line 223 of file ClGemm.cpp.
References arm_compute::NATIVE.
void configure | ( | const CLCompileContext & | compile_context, |
ITensorInfo * | a, | ||
ITensorInfo * | b, | ||
ITensorInfo * | c, | ||
ITensorInfo * | output, | ||
float | alpha, | ||
float | beta, | ||
const GEMMInfo & | gemm_info | ||
) |
Initialise the kernel's inputs and output.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
F32 | F32 | F32 | F32 |
F16 | F16 | F16 | F16 |
[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 657 of file ClGemm.cpp.
References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, arm_compute::test::validation::b, ITensorInfo::data_type(), ITensorInfo::dimension(), CLScheduler::get(), arm_compute::helpers::float_ops::is_zero(), arm_compute::NATIVE, GEMMInfo::reinterpret_input_as_3d(), GEMMInfo::reshape_b_only_on_first_run(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_ONLY_RHS_MMUL, GEMMInfo::retain_internal_weights(), CLScheduler::target(), and ClGemm::validate().
Referenced by ClWinogradConv2d::configure().
|
overridevirtual |
Prepare the function for executing.
Any one off pre-processing step required by the function is handled here
[in] | constants | Vector that contains the constants tensors. |
Reimplemented from ICLOperator.
Definition at line 894 of file ClGemm.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_1, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_LOG_INFO_WITH_FUNCNAME_ACL, ICLTensor::cl_buffer(), CLScheduler::enqueue_op(), CLScheduler::get(), CLAuxTensorHandler::get(), ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), and arm_compute::offset_int_vec().
Referenced by ClWinogradConv2d::prepare(), and ClGemm::run().
|
overridevirtual |
Run the kernels contained in the function.
[in] | tensors | Vector that contains the tensors to operate on. |
Reimplemented from ICLOperator.
Definition at line 786 of file ClGemm.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, ITensorPack::add_const_tensor(), ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, BorderSize::bottom, arm_compute::test::validation::dst, CLScheduler::enqueue_op(), CLScheduler::get(), CLAuxTensorHandler::get(), ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), ITensor::info(), arm_compute::NATIVE, arm_compute::offset_int_vec(), ITensorInfo::padding(), ClGemm::prepare(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_ONLY_RHS_MMUL, and BorderSize::top.
Referenced by ClWinogradConv2d::run().
|
static |
Static function to check if given info will lead to a valid configuration.
Similar to ClGemm::configure()
Definition at line 720 of file ClGemm.cpp.
References ARM_COMPUTE_RETURN_ERROR_MSG, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ON_ERROR, arm_compute::test::validation::b, ITensorInfo::data_type(), ITensorInfo::dimension(), arm_compute::F16, arm_compute::F32, CLScheduler::get(), arm_compute::helpers::float_ops::is_zero(), arm_compute::NATIVE, GEMMInfo::reinterpret_input_as_3d(), GEMMInfo::reshape_b_only_on_first_run(), arm_compute::RESHAPED, arm_compute::RESHAPED_ONLY_RHS, arm_compute::RESHAPED_ONLY_RHS_MMUL, and CLScheduler::target().
Referenced by ClGemm::configure(), NEElementwiseUnaryLayer< op >::validate(), NEPReluLayer::validate(), CLPReluLayer::validate(), CLSoftmaxLayerGeneric< IS_LOG >::validate(), NEGEMMConv2d::validate(), CLMatMul::validate(), CLGEMM::validate(), and CLGEMMLowpMatrixMultiplyCore::validate().
|
overridevirtual |
Return the memory requirements required by the workspace.
Reimplemented from ICLOperator.
Definition at line 918 of file ClGemm.cpp.
Referenced by ClWinogradConv2d::configure().