From 2b6ebfe4270b06b09e45f306e8384950aeca7e4e Mon Sep 17 00:00:00 2001 From: Ramy Elgammal Date: Thu, 9 Mar 2023 21:15:37 +0000 Subject: Implement OpenCL MatMul for Lhs NT Rhs T/NT FP32/16 - Implement ClNativeMatMulKernel class - Implement opencl kernel for LHS non-transposed and RHS non-transposed - Implement opencl kernel for LHS non-transposed and RHS transposed - Add test fixture and dataset for matmul - Implement transpose_tensor() for reference implementation to transpose high dimensional tensors Resolves: COMPMID-5944, COMPMID-5951 Co-authored-by: Gunes Bayir Co-authored-by: Ramy Elgammal Change-Id: I1d5b8978f41be27baddb3153ade880472141573f Signed-off-by: Gunes Bayir Signed-off-by: Ramy Elgammal Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9333 Tested-by: Arm Jenkins Reviewed-by: Gian Marco Iodice Benchmark: Arm Jenkins --- arm_compute/core/KernelDescriptors.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'arm_compute/core/KernelDescriptors.h') diff --git a/arm_compute/core/KernelDescriptors.h b/arm_compute/core/KernelDescriptors.h index 19ac254c04..016e03d88e 100644 --- a/arm_compute/core/KernelDescriptors.h +++ b/arm_compute/core/KernelDescriptors.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CORE_KERNEL_DESCRIPTORS_H -#define ARM_COMPUTE_CORE_KERNEL_DESCRIPTORS_H +#ifndef ACL_ARM_COMPUTE_CORE_KERNELDESCRIPTORS +#define ACL_ARM_COMPUTE_CORE_KERNELDESCRIPTORS #include "arm_compute/core/PixelValue.h" #include "arm_compute/core/Types.h" @@ -223,5 +223,19 @@ struct ScaleKernelInfo bool align_corners; /**< Align corners of input and output */ DataLayout data_layout; /**< Data layout to use */ }; + +struct MatMulKernelInfo +{ + MatMulKernelInfo(bool adj_lhs = false, bool adj_rhs = false, int m0 = 1, int n0 = 1, int k0 = 1, bool export_rhs_to_cl_image = false) + : adj_lhs{ adj_lhs }, adj_rhs{ adj_rhs }, m0{ m0 }, n0{ n0 }, k0{ k0 }, export_rhs_to_cl_image{ export_rhs_to_cl_image } + { + } + bool adj_lhs{ false }; /**< Get Adjoint LHS flag value */ + bool adj_rhs{ false }; /**< Get Adjoint RHS flag value */ + int m0{ 1 }; /**< Number of output rows processed by each work-item*/ + int n0{ 1 }; /**< Number of output columns processed by each work-item*/ + int k0{ 1 }; /**< Number of inner accumulations */ + bool export_rhs_to_cl_image{ false }; /**< Flag to know whether the RHS tensor should be exported to cl_image*/ +}; } // namespace arm_compute -#endif /* ARM_COMPUTE_CORE_KERNEL_DESCRIPTORS_H */ +#endif /* ACL_ARM_COMPUTE_CORE_KERNELDESCRIPTORS */ -- cgit v1.2.1