blob: c90828008c832c6dccea613757074b3d914aaec8 [file] [log] [blame]
Gunes Bayir9d0c4de2023-04-13 18:22:58 +01001/*
2 * Copyright (c) 2023 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL
25#define ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL
26
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010027#include "arm_compute/core/ActivationLayerInfo.h"
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010028#include "src/core/common/Macros.h"
29#include "src/gpu/cl/ClCompileContext.h"
30#include "src/gpu/cl/IClKernel.h"
31
32namespace arm_compute
33{
34// Forward declerations
35struct MatMulKernelInfo;
36namespace opencl
37{
38namespace kernels
39{
40class ClMatMulLowpNativeKernel : public IClKernel
41{
42public:
43 ClMatMulLowpNativeKernel();
44 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClMatMulLowpNativeKernel);
45 /** Initialise the kernel's input and output.
46 *
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010047 * @param[in] compile_context The compile context to be used.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010048 * @param[in] lhs Input tensor info for the LHS matrix. Data type supported: QASYMM8_SIGNED/QASYMM8.
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010049 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010050 * @param[in] rhs Input tensor info for the RHS matrix. Data type supported: same as @p lhs.
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010051 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010052 * @param[in] bias Bias tensor info. Can be nullptr. Data type supported: S32.
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010053 * @param[out] dst Output tensor info. Data type supported: same as @p lhs
54 * @param[in] matmul_kernel_info Attributes for Batch MatMul Kernel
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010055 * @param[in] act_info (Optional) Class containing information about fused activation function.
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010056 */
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010057 void configure(const ClCompileContext &compile_context, ITensorInfo *lhs, ITensorInfo *rhs, ITensorInfo *bias, ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info,
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010058 const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010059 /** Static function to check if given info will lead to a valid configuration
60 *
61 * Similar to @ref ClMatMulLowpNativeKernel::configure()
62 *
63 * @return a status
64 */
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010065 static Status validate(const ITensorInfo *lhs, const ITensorInfo *rhs, const ITensorInfo *bias, const ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info,
66 const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010067
68 // Inherited methods overridden:
69 void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override;
70};
71} // namespace kernels
72} // namespace opencl
73} // namespace arm_compute
74#endif /* ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL */