Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 1 | /* |
| 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 Munshi | 94abde4 | 2023-05-25 16:48:43 +0100 | [diff] [blame^] | 27 | #include "arm_compute/core/ActivationLayerInfo.h" |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 28 | #include "src/core/common/Macros.h" |
| 29 | #include "src/gpu/cl/ClCompileContext.h" |
| 30 | #include "src/gpu/cl/IClKernel.h" |
| 31 | |
| 32 | namespace arm_compute |
| 33 | { |
| 34 | // Forward declerations |
| 35 | struct MatMulKernelInfo; |
| 36 | namespace opencl |
| 37 | { |
| 38 | namespace kernels |
| 39 | { |
| 40 | class ClMatMulLowpNativeKernel : public IClKernel |
| 41 | { |
| 42 | public: |
| 43 | ClMatMulLowpNativeKernel(); |
| 44 | ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClMatMulLowpNativeKernel); |
| 45 | /** Initialise the kernel's input and output. |
| 46 | * |
Mohammed Suhail Munshi | 94abde4 | 2023-05-25 16:48:43 +0100 | [diff] [blame^] | 47 | * @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 Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 55 | */ |
Mohammed Suhail Munshi | 94abde4 | 2023-05-25 16:48:43 +0100 | [diff] [blame^] | 56 | void configure(const ClCompileContext &compile_context, ITensorInfo *lhs, ITensorInfo *rhs, ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info, |
| 57 | const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 58 | /** 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 Munshi | 94abde4 | 2023-05-25 16:48:43 +0100 | [diff] [blame^] | 64 | static Status validate(const ITensorInfo *lhs, const ITensorInfo *rhs, const ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info, const ActivationLayerInfo &act_info = ActivationLayerInfo()); |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 65 | |
| 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 */ |