blob: a8ce1e511be1207c2f37ecd61b08c3d09011b254 [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 */
Michalis Spyrouf4643372019-11-29 16:17:13 +000024#ifndef ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H
25#define ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H
Pablo Tello181e6512017-11-15 13:28:27 +000026
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{
Georgios Pinitascfa2bba2019-06-27 17:00:52 +010038// Forward declarations
Pablo Tello181e6512017-11-15 13:28:27 +000039class ITensor;
40
Georgios Pinitascfa2bba2019-06-27 17:00:52 +010041/** Basic function to execute matrix multiply assembly kernels. */
Pablo Tello181e6512017-11-15 13:28:27 +000042class NEGEMMLowpAssemblyMatrixMultiplyCore : public IFunction
43{
44public:
45 /** Constructor */
46 NEGEMMLowpAssemblyMatrixMultiplyCore(std::shared_ptr<IMemoryManager> memory_manager = nullptr);
47 /** Initialise the kernel's inputs, output
Anthony Barbierf202e502017-11-23 18:02:04 +000048 *
49 * @param[in] a First input tensor (Matrix A). Data type supported: U8, S8.
50 * @param[in] b Second input tensor (Matrix B). Data type supported: same as @p a
Georgios Pinitascfa2bba2019-06-27 17:00:52 +010051 * @param[in] c Third input tensor (Matrix C). 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 */
Georgios Pinitascfa2bba2019-06-27 17:00:52 +010054 void configure(const ITensor *a, const ITensor *b, const ITensor *c, ITensor *output);
Pablo Tello181e6512017-11-15 13:28:27 +000055
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};
Georgios Pinitascfa2bba2019-06-27 17:00:52 +010068} // namespace arm_compute
Michalis Spyrouf4643372019-11-29 16:17:13 +000069#endif /*ARM_COMPUTE_NEGEMMLOWPASSEMBLYMATRIXMULTIPLYCORE_H */