blob: 67d1a6601f07d14264afc64b400adc29c39a4669 [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.
48 * @param[in] lhs Input tensor for the LHS matrix. Data type supported: QASYMM8_SIGNED/QASYMM8.
49 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
50 * @param[in] rhs Input tensor for the RHS matrix. Data type supported: same as @p lhs.
51 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
52 * @param[out] dst Output tensor info. Data type supported: same as @p lhs
53 * @param[in] matmul_kernel_info Attributes for Batch MatMul Kernel
54 * @param[in] act_info Class containing information about fused activation function.
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010055 */
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010056 void configure(const ClCompileContext &compile_context, ITensorInfo *lhs, ITensorInfo *rhs, ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info,
57 const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010058 /** Static function to check if given info will lead to a valid configuration
59 *
60 * Similar to @ref ClMatMulLowpNativeKernel::configure()
61 *
62 * @return a status
63 */
Mohammed Suhail Munshi94abde42023-05-25 16:48:43 +010064 static Status validate(const ITensorInfo *lhs, const ITensorInfo *rhs, const ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info, const ActivationLayerInfo &act_info = ActivationLayerInfo());
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010065
66 // Inherited methods overridden:
67 void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override;
68};
69} // namespace kernels
70} // namespace opencl
71} // namespace arm_compute
72#endif /* ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL */