23.08
|
Go to the documentation of this file.
45 static const std::vector<CpuGemmMatrixMultiplyKernel::GemmMatrixMulKernel> available_kernels =
48 "neon_fp32_gemm_matrix_mul",
49 [](
const DataTypeISASelectorData & data)
56 "neon_fp16_gemm_matrix_mul",
57 [](
const DataTypeISASelectorData & data)
65 inline Status
validate_arguments(
const ITensorInfo *lhs,
const ITensorInfo *rhs,
const ITensorInfo *
dst,
float alpha,
bool is_interleaved,
const GEMMReshapeInfo &reshape_info)
77 if(
dst->total_size() != 0)
86 const int m = reshape_info.m();
87 const int n = reshape_info.n();
88 const int k = reshape_info.k();
89 const int mult_transpose1xW_width = reshape_info.mult_transpose1xW_width();
90 const int mult_interleave4x4_height = reshape_info.mult_interleave4x4_height();
93 TensorShape tensor_shape0{ lhs->tensor_shape() };
94 tensor_shape0.set(0,
k);
95 tensor_shape0.set(1,
m);
97 const TensorInfo tensor_info0 = lhs->clone()->set_tensor_shape(tensor_shape0);
103 TensorShape tensor_shape1{ rhs->tensor_shape() };
104 tensor_shape1.set(0,
n);
105 tensor_shape1.set(1,
k);
107 const TensorInfo tensor_info1 = rhs->clone()->set_tensor_shape(tensor_shape1);
112 if(
dst->total_size() != 0)
134 tensor_shape.
set(0, is_interleaved ? reshape_info.
n() : rhs->
dimension(0));
135 tensor_shape.
set(1, is_interleaved ? reshape_info.
m() : lhs->
dimension(1));
148 const bool is_dst_vector = (
dst->dimension(1) == 1);
157 constexpr
unsigned int num_elems_processed_per_iteration_x = 8;
158 constexpr
unsigned int num_elems_processed_per_iteration_y = 4;
167 ICPPKernel::configure(win);
189 const bool is_dst_vector = (
dst->info()->dimension(1) == 1);
190 (*_func)(lhs, rhs,
dst,
window,
info, _alpha, is_dst_vector);
195 return "CpuGemmMatrixMultiplyKernel";
200 return available_kernels;
Class to describe a number of elements in each dimension.
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
GEMM reshape information class.
int n() const
Number of matrix B columns.
void neon_fp16_gemm_matrix_mul(const ITensor *lhs, const ITensor *rhs, ITensor *dst, const Window &window, const ThreadInfo &info, float alpha, const bool is_dst_vector)
Status validate_arguments(const ITensorInfo *src, const ITensorInfo *weights, const ITensorInfo *dst, const PadStrideInfo &conv_info)
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
static Status validate(const ITensorInfo *lhs, const ITensorInfo *rhs, const ITensorInfo *dst, float alpha, bool is_interleaved, const GEMMReshapeInfo &reshape_info)
Static function to check if given info will lead to a valid configuration of CpuGemmMatrixMultiplyKer...
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
static CPUInfo & get()
Access the KernelLibrary singleton.
Interface for CPU tensor.
static const std::vector< GemmMatrixMulKernel > & get_available_kernels()
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
#define REGISTER_FP16_NEON(func_name)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
void neon_fp32_gemm_matrix_mul(const ITensor *lhs, const ITensor *rhs, ITensor *dst, const Window &window, const ThreadInfo &info, float alpha, const bool is_dst_vector)
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
int m() const
Number of matrix A rows.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define REGISTER_FP32_NEON(func_name)
bool empty() const
Checks if pack is empty.
TensorShape compute_transpose1xW_with_element_size_shape(const ITensorInfo &b, int mult_transpose1xW_width=1)
Calculate the transposed 1xW width element shape.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorShape compute_interleaved_shape(const ITensorInfo &a, int mult_interleave4x4_height=1, bool reinterpret_input_as_3d=false)
Calculate the interleaved shape of an input tensor.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
#define ARM_COMPUTE_RETURN_ERROR_ON_CPU_F16_UNSUPPORTED(tensor)
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
void configure(const ITensorInfo *lhs, const ITensorInfo *rhs, ITensorInfo *dst, float alpha, bool is_interleaved, const GEMMReshapeInfo &reshape_info=GEMMReshapeInfo())
Initialise the kernel's input and output.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
static const auto * get_implementation(const SelectorType &selector, KernelSelectionType selection_type=KernelSelectionType::Supported)
Micro-kernel selector.
const Window & window() const
The maximum window the kernel can be executed on.
Information about executing thread and CPU.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
Describe a multidimensional execution window.
Copyright (c) 2017-2023 Arm Limited.
@ F16
16-bit floating-point number
const char * name() const override
Name of the kernel.
Store the tensor's metadata.
@ F32
32-bit floating-point number
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.