24.02.1
|
Basic function to execute GEMM. More...
#include <NEGEMM.h>
Public Member Functions | |
NEGEMM (std::shared_ptr< IMemoryManager > memory_manager=nullptr, IWeightsManager *weights_manager=nullptr) | |
Constructor. More... | |
NEGEMM (const NEGEMM &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEGEMM (NEGEMM &&)=default | |
Default move constructor. More... | |
NEGEMM & | operator= (const NEGEMM &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NEGEMM & | operator= (NEGEMM &&)=default |
Default move assignment operator. More... | |
~NEGEMM () | |
Default destructor. More... | |
void | configure (const ITensor *a, const ITensor *b, const ITensor *c, ITensor *d, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Initialise the kernel's inputs, 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 NEGEMM. More... | |
static Status | has_opt_impl (arm_compute::WeightFormat &expected_weight_format, const ITensorInfo *a, const ITensorInfo *b, const ITensorInfo *c, const ITensorInfo *output, float alpha, float beta, const GEMMInfo &gemm_info=GEMMInfo()) |
Static function that queries whether there exists fixed-format kernel and if it exists it will return in the first argument in what format weights are expected to be reshaped as defined by WeightFormat class. More... | |
Basic function to execute GEMM.
This function calls the following kernels:
NEGEMM | ( | std::shared_ptr< IMemoryManager > | memory_manager = nullptr , |
IWeightsManager * | weights_manager = nullptr |
||
) |
Constructor.
Definition at line 56 of file NEGEMM.cpp.
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Default destructor.
void configure | ( | const ITensor * | a, |
const ITensor * | b, | ||
const ITensor * | c, | ||
ITensor * | d, | ||
float | alpha, | ||
float | beta, | ||
const GEMMInfo & | gemm_info = GEMMInfo() |
||
) |
Initialise the kernel's inputs, output.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
F32 | F32 | F32 | F32 |
F16 | F16 | F16 | F16 |
BFLOAT16 | BFLOAT16 | BFLOAT16 | BFLOAT16 |
[in] | a | First input tensor (Matrix A or Vector A). Data type supported: BFLOAT16/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] | d | 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 |
Definition at line 65 of file NEGEMM.cpp.
References arm_compute::ACL_DST, arm_compute::ACL_SRC_0, arm_compute::ACL_SRC_1, arm_compute::ACL_SRC_2, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::test::validation::b, ITensor::info(), GEMMInfo::reshape_b_only_on_first_run(), and CpuGemm::validate().
Referenced by NERNNLayer::configure(), and NELSTMLayer::configure().
|
static |
Static function that queries whether there exists fixed-format kernel and if it exists it will return in the first argument in what format weights are expected to be reshaped as defined by WeightFormat class.
Apart from the first argument the rest of the arguments are the same as in NEGEMM::validate() except that all arguments are required.
Definition at line 117 of file NEGEMM.cpp.
References ARM_COMPUTE_UNUSED, arm_compute::test::validation::b, and CpuGemm::has_opt_impl().
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 138 of file NEGEMM.cpp.
References arm_compute::ACL_SRC_1, and arm_compute::mlgo::parser::end().
Referenced by NERNNLayer::prepare(), and NEGEMM::run().
|
overridevirtual |
Run the kernels contained in the function.
For CPU kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 130 of file NEGEMM.cpp.
References NEGEMM::prepare().
Referenced by NERNNLayer::run(), and NELSTMLayer::run().
|
static |
Static function to check if given info will lead to a valid configuration of NEGEMM.
Similar to NEGEMM::configure()
Definition at line 99 of file NEGEMM.cpp.
References arm_compute::test::validation::b, GEMMInfo::reshape_b_only_on_first_run(), and CpuGemm::validate().
Referenced by NELSTMLayer::validate().