blob: 38682843b7879238ff6cacdb45f3660a1ac153c1 [file] [log] [blame]
Pablo Tello181e6512017-11-15 13:28:27 +00001/*
Manuel Bottini581c8982019-02-07 10:31:57 +00002 * Copyright (c) 2017-2019 ARM Limited.
Pablo Tello181e6512017-11-15 13:28:27 +00003 *
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 __ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H__
25#define __ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H__
26
27#include "arm_compute/core/NEON/INEKernel.h"
28#include "arm_compute/runtime/IFunction.h"
29#include "arm_compute/runtime/IMemoryManager.h"
30#include "arm_compute/runtime/MemoryGroup.h"
Anthony Barbier71d9b572018-07-06 17:05:59 +010031#include "arm_compute/runtime/NEON/functions/NEGEMMAssemblyDispatch.h"
Pablo Tello181e6512017-11-15 13:28:27 +000032#include "arm_compute/runtime/Tensor.h"
33
34#include <memory>
35
36namespace arm_compute
37{
38class ITensor;
39
40/** Basic function to execute matrix multiply assembly kernels.
41 *
42*/
43class NEGEMMLowpAssemblyMatrixMultiplyCore : public IFunction
44{
45public:
46 /** Constructor */
47 NEGEMMLowpAssemblyMatrixMultiplyCore(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
48 /** Initialise the kernel's inputs, output
Anthony Barbierf202e502017-11-23 18:02:04 +000049 *
50 * @param[in] a First input tensor (Matrix A). Data type supported: U8, S8.
51 * @param[in] b Second input tensor (Matrix B). Data type supported: same as @p a
Manuel Bottini581c8982019-02-07 10:31:57 +000052 * @param[out] output Output tensor. Data type supported: Data type supported: U32, S32
Anthony Barbierf202e502017-11-23 18:02:04 +000053 */
Pablo Tello181e6512017-11-15 13:28:27 +000054 void configure(const ITensor *a, const ITensor *b, ITensor *output);
55
56 // Inherited methods overridden:
57 void run() override;
58
59private:
Anthony Barbiereaefd002018-07-20 17:49:35 +010060 MemoryGroup _memory_group;
61 NEGEMMAssemblyDispatch _asm_glue;
62 std::unique_ptr<INEKernel> _mm_kernel;
63 std::unique_ptr<INEKernel> _mtx_a_reshape_kernel;
64 std::unique_ptr<INEKernel> _mtx_b_reshape_kernel;
65 Tensor _tmp_a;
66 Tensor _tmp_b;
Pablo Tello181e6512017-11-15 13:28:27 +000067};
68}
69#endif /*__ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H__ */