2 * Copyright (c) 2017-2018 ARM Limited.
4 * SPDX-License-Identifier: MIT
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:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
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
24 #ifndef __ARM_COMPUTE_NEGEMMASSEMBLYBASE_H__
25 #define __ARM_COMPUTE_NEGEMMASSEMBLYBASE_H__
27 #include "arm_compute/core/NEON/INEKernel.h"
33 /** Base class for GEMM NEON kernels implemented in Assembly. */
34 class NEGEMMAssemblyBaseKernel : public INEKernel
37 const char *name() const override
39 return "NEGEMMAssemblyBaseKernel";
42 NEGEMMAssemblyBaseKernel()
43 : _input0(nullptr), _input1(nullptr), _output(nullptr), _workspace(nullptr), _alpha(1.f), _beta(0.f), _is_transposed_0(false), _is_transposed_1(false)
47 /** Prevent instances of this class from being copied (As this class contains pointers) */
48 NEGEMMAssemblyBaseKernel(const NEGEMMAssemblyBaseKernel &) = delete;
49 /** Prevent instances of this class from being copied (As this class contains pointers) */
50 NEGEMMAssemblyBaseKernel &operator=(const NEGEMMAssemblyBaseKernel &) = delete;
51 /** Allow instances of this class to be moved */
52 NEGEMMAssemblyBaseKernel(NEGEMMAssemblyBaseKernel &&) = default;
53 /** Allow instances of this class to be moved */
54 NEGEMMAssemblyBaseKernel &operator=(NEGEMMAssemblyBaseKernel &&) = default;
56 virtual ~NEGEMMAssemblyBaseKernel() = default;
58 /** Initialise the kernel's input and output.
60 * The computed function is C = a * AxB + b * C.
62 * @param[in] input0 Input tensor containing the Matrix A. Data types supported: F32
63 * @param[in] input1 Input tensor containing the Matrix B. Data types supported: same as @p input0
64 * @param[in,out] output Output tensor to store the result of matrix multiplication. If @p beta is not zero the values are multiplied by @p beta before the result is accumulated. Otherwise the values are overwritten by the result. Data types supported: same as @p input0.
65 * @param[out] workspace Space for intermediate results.
66 * @param[in] alpha Weight of the matrix product
67 * @param[in] beta Weight of the accumulation.
68 * @param[in] is_transposed_0 (Optional)True if @p input0 is transposed else false. (Defaults to false)
69 * @param[in] is_transposed_1 (Optional)True if @p input1 is transposed else false. (Defaults to false)
71 void configure(const ITensor *input0, const ITensor *input1, ITensor *output, ITensor *workspace, float alpha = 1.f, float beta = 0.f, bool is_transposed_0 = false, bool is_transposed_1 = false)
73 internal_configure(input0, input1, output, workspace, alpha, beta, is_transposed_0, is_transposed_1);
77 virtual void internal_configure(const ITensor *input0, const ITensor *input1, ITensor *output, ITensor *workspace, float alpha, float beta, bool _is_transposed_0, bool _is_transposed_1) = 0;
79 const ITensor *_input0;
80 const ITensor *_input1;
85 bool _is_transposed_0;
86 bool _is_transposed_1;
88 } // namespace arm_compute
89 #endif /*__ARM_COMPUTE_NEGEMMASSEMBLYBASE_H__*/