blob: 0170dcae220026059112f82d93f5fa6e81a9fe48 [file] [log] [blame]
Pablo Tello89519332017-11-17 11:52:36 +00001/*
Giorgio Arena5ae8d802021-11-18 18:02:13 +00002 * Copyright (c) 2017-2022 Arm Limited.
Pablo Tello89519332017-11-17 11:52:36 +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 Spyrou96f977e2021-07-01 12:20:56 +010024#ifndef ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H
25#define ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H
Pablo Tello89519332017-11-17 11:52:36 +000026
ramelg01a1f78512022-06-29 16:28:10 +010027#include "arm_compute/core/Helpers.h"
28#include "arm_compute/core/ITensor.h"
29#include "arm_compute/core/ITensorPack.h"
30#include "arm_compute/core/Steps.h"
31#include "arm_compute/core/TensorInfo.h"
32#include "arm_compute/runtime/Tensor.h"
33#include "src/core/NEON/kernels/assembly/winograd.hpp"
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +010034#include "src/core/NEON/kernels/convolution/common/tensor.hpp"
Georgios Pinitas7891a732021-08-20 21:39:25 +010035#include "src/cpu/ICpuKernel.h"
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +010036
Pablo Tello89519332017-11-17 11:52:36 +000037namespace arm_compute
38{
Michalis Spyrou96f977e2021-07-01 12:20:56 +010039namespace cpu
40{
ramelg01a1f78512022-06-29 16:28:10 +010041class CpuWinogradConv2dTransformInputKernel final : public ICpuKernel<CpuWinogradConv2dTransformInputKernel>
Pablo Tellof6c572c2018-02-14 12:47:30 +000042{
43public:
Pablo Tello7df27862018-05-30 11:44:26 +010044 /** Prevent instances of this class from being copied (As this class contains pointers) */
Michalis Spyrou96f977e2021-07-01 12:20:56 +010045 CpuWinogradConv2dTransformInputKernel(const CpuWinogradConv2dTransformInputKernel &) = delete;
ramelg01a1f78512022-06-29 16:28:10 +010046
Pablo Tello7df27862018-05-30 11:44:26 +010047 /** Prevent instances of this class from being copied (As this class contains pointers) */
Michalis Spyrou96f977e2021-07-01 12:20:56 +010048 CpuWinogradConv2dTransformInputKernel &operator=(const CpuWinogradConv2dTransformInputKernel &) = delete;
Pablo Tello7df27862018-05-30 11:44:26 +010049
ramelg01a1f78512022-06-29 16:28:10 +010050 /** Prevent instances of this class from being moved it contains references.*/
51 CpuWinogradConv2dTransformInputKernel(CpuWinogradConv2dTransformInputKernel &&) = delete;
Pablo Tellof6c572c2018-02-14 12:47:30 +000052
ramelg01a1f78512022-06-29 16:28:10 +010053 /** Prevent instances of this class from being moved it contains references.*/
54 CpuWinogradConv2dTransformInputKernel &operator=(CpuWinogradConv2dTransformInputKernel &&) = delete;
Pablo Tello8f43d742019-03-27 09:28:32 +000055
ramelg01a1f78512022-06-29 16:28:10 +010056 CpuWinogradConv2dTransformInputKernel(arm_conv::winograd::WinogradImpl &w_impl, arm_conv::ConvolutionArgs &_c_args, uint32_t nthreads);
Pablo Tellod6ca4782018-01-23 09:36:04 +000057
ramelg01a1f78512022-06-29 16:28:10 +010058 // Inherited methods overridden:
59 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override;
Pablo Tellof6c572c2018-02-14 12:47:30 +000060
Pablo Tellod6ca4782018-01-23 09:36:04 +000061 const char *name() const override
62 {
Michalis Spyrou96f977e2021-07-01 12:20:56 +010063 return "CpuWinogradConv2dTransformInputKernel";
Pablo Tellod6ca4782018-01-23 09:36:04 +000064 }
Pablo Tello52140b42018-01-30 14:48:11 +000065
ramelg01a1f78512022-06-29 16:28:10 +010066private:
67 arm_conv::winograd::WinogradImpl &_winograd_impl;
68 arm_conv::ConvolutionArgs &_conv_args;
69 uint32_t _nthreads;
70};
71class CpuWinogradConv2dTransformOutputKernel : public ICpuKernel<CpuWinogradConv2dTransformOutputKernel>
72{
73public:
74 /** Prevent instances of this class from being copied (As this class contains pointers) */
75 CpuWinogradConv2dTransformOutputKernel(const CpuWinogradConv2dTransformOutputKernel &) = delete;
76
77 /** Prevent instances of this class from being copied (As this class contains pointers) */
78 CpuWinogradConv2dTransformOutputKernel &operator=(const CpuWinogradConv2dTransformOutputKernel &) = delete;
79
80 /** Prevent instances of this class from being moved it contains references.*/
81 CpuWinogradConv2dTransformOutputKernel(CpuWinogradConv2dTransformOutputKernel &&) = delete;
82
83 /** Prevent instances of this class from being moved it contains references.*/
84 CpuWinogradConv2dTransformOutputKernel &operator=(CpuWinogradConv2dTransformOutputKernel &&) = delete;
85
86 CpuWinogradConv2dTransformOutputKernel(arm_conv::winograd::WinogradImpl &w_impl, arm_conv::ConvolutionArgs &_c_args, uint32_t nthreads);
Pablo Tello52140b42018-01-30 14:48:11 +000087
Pablo Tellod6ca4782018-01-23 09:36:04 +000088 // Inherited methods overridden:
Michalis Spyrou96f977e2021-07-01 12:20:56 +010089 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override;
Pablo Tello52140b42018-01-30 14:48:11 +000090
Pablo Tellod6ca4782018-01-23 09:36:04 +000091 const char *name() const override
92 {
Michalis Spyrou96f977e2021-07-01 12:20:56 +010093 return "CpuWinogradConv2dTransformOutputKernel";
Pablo Tellod6ca4782018-01-23 09:36:04 +000094 }
Vidhya Sudhan Loganathan3ca97862018-04-23 08:20:04 +010095
Pablo Tellod6ca4782018-01-23 09:36:04 +000096private:
ramelg01a1f78512022-06-29 16:28:10 +010097 arm_conv::winograd::WinogradImpl &_winograd_impl;
98 const arm_conv::ConvolutionArgs &_conv_args;
99 uint32_t _nthreads;
Pablo Tello89519332017-11-17 11:52:36 +0000100};
101
Michalis Spyrou96f977e2021-07-01 12:20:56 +0100102} // namespace cpu
Pablo Tello89519332017-11-17 11:52:36 +0000103} // namespace arm_compute
Michalis Spyrou96f977e2021-07-01 12:20:56 +0100104#endif /*ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H*/