blob: d70ff30b91b6ff9577ab0111b3fe1f7321352b32 [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
27#include "src/core/common/Macros.h"
28#include "src/gpu/cl/ClCompileContext.h"
29#include "src/gpu/cl/IClKernel.h"
30
31namespace arm_compute
32{
33// Forward declerations
34struct MatMulKernelInfo;
35namespace opencl
36{
37namespace kernels
38{
39class ClMatMulLowpNativeKernel : public IClKernel
40{
41public:
42 ClMatMulLowpNativeKernel();
43 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClMatMulLowpNativeKernel);
44 /** Initialise the kernel's input and output.
45 *
46 * @param[in] compile_context The compile context to be used.
47 * @param[in] lhs Input tensor for the LHS matrix. Data type supported: QASYMM8_SIGNED/QASYMM8.
48 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
49 * @param[in] rhs Input tensor for the RHS matrix. Data type supported: same as @p lhs.
50 * Dimensions above 2 are collapsed onto dimension 2 and represent the batch.
Jakub Sujake9b3ee22023-04-17 12:08:48 +010051 * @param[out] dst Output tensor info. Data type supported: same as @p lhs
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010052 * @param[in] matmul_info Attributes for Batch MatMul Kernel
53 */
Jakub Sujake9b3ee22023-04-17 12:08:48 +010054 void configure(const ClCompileContext &compile_context, ITensorInfo *lhs, ITensorInfo *rhs, ITensorInfo *dst, const MatMulKernelInfo &matmul_info);
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010055 /** Static function to check if given info will lead to a valid configuration
56 *
57 * Similar to @ref ClMatMulLowpNativeKernel::configure()
58 *
59 * @return a status
60 */
Jakub Sujake9b3ee22023-04-17 12:08:48 +010061 static Status validate(const ITensorInfo *lhs, const ITensorInfo *rhs, const ITensorInfo *dst, const MatMulKernelInfo &matmul_info);
Gunes Bayir9d0c4de2023-04-13 18:22:58 +010062
63 // Inherited methods overridden:
64 void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override;
65};
66} // namespace kernels
67} // namespace opencl
68} // namespace arm_compute
69#endif /* ACL_SRC_GPU_CL_KERNELS_CLMATMULLOWPNATIVEKERNEL */