blob: ffdb72085519a455cf9add27752a263b4547829f [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
SiCong Li91295492023-07-21 18:16:13 +010027#include "arm_compute/function_info/ActivationLayerInfo.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010028
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010029#include "src/core/common/Macros.h"
30#include "src/gpu/cl/ClCompileContext.h"
31#include "src/gpu/cl/IClKernel.h"
32
33namespace arm_compute
34{
35// Forward declerations
36struct MatMulKernelInfo;
37namespace opencl
38{
39namespace kernels
40{
41class ClMatMulLowpNativeKernel : public IClKernel
42{
43public:
44 ClMatMulLowpNativeKernel();
45 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClMatMulLowpNativeKernel);
46 /** Initialise the kernel's input and output.
47 *
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010048 * @param[in] compile_context The compile context to be used.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010049 * @param[in] lhs Input tensor info for the LHS matrix. Data type supported: QASYMM8_SIGNED/QASYMM8.
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010050 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010051 * @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 +010052 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010053 * @param[in] bias Bias tensor info. Can be nullptr. Data type supported: S32.
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010054 * @param[out] dst Output tensor info. Data type supported: same as @p lhs
55 * @param[in] matmul_kernel_info Attributes for Batch MatMul Kernel
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010056 * @param[in] act_info (Optional) Class containing information about fused activation function.
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010057 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010058 void configure(const ClCompileContext &compile_context,
59 ITensorInfo *lhs,
60 ITensorInfo *rhs,
61 ITensorInfo *bias,
62 ITensorInfo *dst,
63 const MatMulKernelInfo &matmul_kernel_info,
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010064 const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010065 /** Static function to check if given info will lead to a valid configuration
66 *
67 * Similar to @ref ClMatMulLowpNativeKernel::configure()
68 *
69 * @return a status
70 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010071 static Status validate(const ITensorInfo *lhs,
72 const ITensorInfo *rhs,
73 const ITensorInfo *bias,
74 const ITensorInfo *dst,
75 const MatMulKernelInfo &matmul_kernel_info,
Mohammed Suhail Munshi8e2dede2023-06-27 14:25:58 +010076 const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010077
78 // Inherited methods overridden:
79 void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override;
80};
81} // namespace kernels
82} // namespace opencl
83} // namespace arm_compute
84#endif /* ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL */