Gunes Bayir | e87fa66 | 2023-09-07 12:20:33 +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 | |
| 25 | #ifndef ACL_SRC_GPU_CL_KERNELS_HELPERS_MATMULKERNELHELPERS_H |
| 26 | #define ACL_SRC_GPU_CL_KERNELS_HELPERS_MATMULKERNELHELPERS_H |
| 27 | |
| 28 | #include "arm_compute/core/Error.h" |
| 29 | #include "arm_compute/core/KernelDescriptors.h" |
| 30 | #include "arm_compute/core/TensorShape.h" |
| 31 | #include "arm_compute/core/Window.h" |
| 32 | |
| 33 | namespace arm_compute |
| 34 | { |
| 35 | namespace opencl |
| 36 | { |
| 37 | namespace kernels |
| 38 | { |
| 39 | /** Validate the input shapes of Matmul operation |
| 40 | * |
| 41 | * @param[in] lhs_shape Lhs tensor shape |
| 42 | * @param[in] rhs_shape Rhs tensor shape |
| 43 | * @param[in] matmul_kernel_info Matmul kernel info |
| 44 | * |
| 45 | * @return true if the shapes and matmul kernel info matches |
| 46 | */ |
| 47 | Status validate_matmul_input_shapes(const TensorShape &lhs_shape, const TensorShape &rhs_shape, |
| 48 | const MatMulKernelInfo &matmul_kernel_info); |
| 49 | |
| 50 | /** Validate and configure window for Matmul MMUL kernels |
| 51 | * |
| 52 | * @param[in] lhs Lhs tensor info |
| 53 | * @param[in] rhs Rhs tensor info |
| 54 | * @param[in] dst Dst tensor info |
| 55 | * @param[in] matmul_kernel_info Matmul kernel info |
| 56 | * @param[in] mmul_m0 Number of rows in the MMUL block |
| 57 | * @param[in] mmul_n0 Number of columns in the MMUL block |
| 58 | * |
| 59 | * @return a pair of Status and Window object |
| 60 | */ |
| 61 | std::pair<Status, Window> validate_and_configure_window_for_mmul_kernels(const ITensorInfo *lhs, |
| 62 | const ITensorInfo *rhs, const ITensorInfo *dst, const MatMulKernelInfo &matmul_kernel_info, |
| 63 | int mmul_m0, int mmul_n0); |
| 64 | } // namespace kernels |
| 65 | } // namespace opencl |
| 66 | } // namespace arm_compute |
| 67 | |
| 68 | #endif // ACL_SRC_GPU_CL_KERNELS_HELPERS_MATMULKERNELHELPERS_H |