23.11
|
Basic function to execute GEMM. More...
#include <CpuGemm.h>
Public Member Functions | |
CpuGemm ()=default | |
Default constructor. More... | |
~CpuGemm ()=default | |
Default destructor. More... | |
void | configure (const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, ITensorInfo *d, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Configure operator for a given list of arguments. 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... | |
bool | isVarWeightsKernel () const |
Indicates if the convolution executes in variable weights mode. More... | |
![]() | |
INEOperator (IRuntimeContext *ctx=nullptr) | |
Constructor. More... | |
INEOperator (const INEOperator &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
INEOperator (INEOperator &&)=default | |
Default move constructor. More... | |
INEOperator & | operator= (const INEOperator &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
INEOperator & | operator= (INEOperator &&)=default |
Default move assignment operator. More... | |
~INEOperator () | |
Default destructor. More... | |
![]() | |
virtual | ~IOperator ()=default |
Destructor. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *d, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Static function to check if given info will lead to a valid configuration of CpuGemm. More... | |
static Status | has_opt_impl (arm_compute::WeightFormat &weight_format, const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *d, const GEMMInfo &gemm_info=GEMMInfo()) |
Indicates whether or not there is an optimal assembly implementation that can be used to process the given parameters. More... | |
Basic function to execute GEMM.
This function calls the following kernels:
If optimized assembly is available:
|
default |
Default constructor.
|
default |
Default destructor.
void configure | ( | const ITensorInfo * | a, |
const ITensorInfo * | b, | ||
const ITensorInfo * | c, | ||
ITensorInfo * | d, | ||
float | alpha, | ||
float | beta, | ||
const GEMMInfo & | gemm_info = GEMMInfo() |
||
) |
Configure operator for a given list of arguments.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
F32 | F32 | F32 | F32 |
F16 | F16 | F16 | F16 |
BFLOAT16 | BFLOAT16 | BFLOAT16 | FP32 |
[in] | a | First input tensor info (Matrix A or Vector A). Data type supported: BFLOAT16/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 |
[out] | d | 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 63 of file CpuGemm.cpp.
References ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, arm_compute::test::validation::b, CpuGemmAssemblyDispatch::validate(), and arm_compute::validate().
|
static |
Indicates whether or not there is an optimal assembly implementation that can be used to process the given parameters.
This method has the same use of NEGEMMConvolutionLayer::has_opt_impl, with the only caveat that the value of arm_compute::WeightFormat need to be passed via the parameter gemm_info.
Definition at line 539 of file CpuGemm.cpp.
References arm_compute::test::validation::b.
Referenced by NEGEMM::has_opt_impl(), CpuFullyConnected::has_opt_impl(), and CpuGemmConv2d::has_opt_impl().
bool isVarWeightsKernel | ( | ) | const |
Indicates if the convolution executes in variable weights mode.
When ACL executes convolution in variable weights mode, it does not perform any processing of the weights tensor. Instead, it utilizes the data as it is given by the user.
Definition at line 551 of file CpuGemm.cpp.
|
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 INEOperator.
Definition at line 495 of file CpuGemm.cpp.
|
overridevirtual |
Run the kernels contained in the function.
[in] | tensors | Vector that contains the tensors to operate on. |
Reimplemented from INEOperator.
Definition at line 403 of file CpuGemm.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ITensorPack::add_const_tensor(), arm_compute::test::validation::b, Window::DimX, Window::DimY, Scheduler::get(), CpuAuxTensorHandler::get(), ITensorPack::get_const_tensor(), ITensorPack::get_tensor(), arm_compute::offset_int_vec(), arm_compute::test::validation::pack, and IScheduler::schedule_op().
|
static |
Static function to check if given info will lead to a valid configuration of CpuGemm.
Similar to CpuGemm::configure()
Definition at line 213 of file CpuGemm.cpp.
References GEMMInfo::activation_info(), ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_CPU_BF16_UNSUPPORTED, ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MSG, ARM_COMPUTE_RETURN_ON_ERROR, ARM_COMPUTE_UNUSED, arm_compute::auto_init_if_empty(), arm_compute::test::validation::b, arm_compute::BFLOAT16, arm_compute::block_by(), ICloneable< T >::clone(), arm_compute::misc::shape_calculator::compute_interleaved_shape(), arm_compute::misc::shape_calculator::compute_mm_shape(), arm_compute::misc::shape_calculator::compute_transpose1xW_with_element_size_shape(), arm_compute::misc::shape_calculator::compute_transposed_shape(), ITensorInfo::data_type(), GEMMInfo::depth_output_gemm3d(), ITensorInfo::dimension(), ActivationLayerInfo::enabled(), arm_compute::F16, arm_compute::F32, GEMMInfo::fixed_format(), GEMMInfo::is_a_reshaped(), GEMMInfo::is_b_reshaped(), arm_compute::is_fixed_format_fast_math(), GEMMInfo::pretranspose_B(), GEMMInfo::reinterpret_input_as_3d(), arm_compute::SATURATE, arm_compute::to_string(), ITensorInfo::total_size(), CpuActivation::validate(), CpuAdd::validate(), CpuGemmInterleave4x4Kernel::validate(), CpuGemmMatrixAdditionKernel::validate(), CpuGemmMatrixMultiplyKernel::validate(), CpuGemmTranspose1xWKernel::validate(), CpuGemmAssemblyDispatch::validate(), and GEMMInfo::weight_format().
Referenced by NEGEMM::configure(), and NEGEMM::validate().
|
overridevirtual |
Return the memory requirements required by the workspace.
Reimplemented from INEOperator.
Definition at line 534 of file CpuGemm.cpp.