blob: 8a3b745e8584b7d3ce7b732207562b1d98938755 [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"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010033
ramelg01a1f78512022-06-29 16:28:10 +010034#include "src/core/NEON/kernels/assembly/winograd.hpp"
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +010035#include "src/core/NEON/kernels/convolution/common/tensor.hpp"
Georgios Pinitas7891a732021-08-20 21:39:25 +010036#include "src/cpu/ICpuKernel.h"
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +010037
Pablo Tello89519332017-11-17 11:52:36 +000038namespace arm_compute
39{
Michalis Spyrou96f977e2021-07-01 12:20:56 +010040namespace cpu
41{
ramelg01a1f78512022-06-29 16:28:10 +010042class CpuWinogradConv2dTransformInputKernel final : public ICpuKernel<CpuWinogradConv2dTransformInputKernel>
Pablo Tellof6c572c2018-02-14 12:47:30 +000043{
44public:
Pablo Tello7df27862018-05-30 11:44:26 +010045 /** Prevent instances of this class from being copied (As this class contains pointers) */
Michalis Spyrou96f977e2021-07-01 12:20:56 +010046 CpuWinogradConv2dTransformInputKernel(const CpuWinogradConv2dTransformInputKernel &) = delete;
ramelg01a1f78512022-06-29 16:28:10 +010047
Pablo Tello7df27862018-05-30 11:44:26 +010048 /** Prevent instances of this class from being copied (As this class contains pointers) */
Michalis Spyrou96f977e2021-07-01 12:20:56 +010049 CpuWinogradConv2dTransformInputKernel &operator=(const CpuWinogradConv2dTransformInputKernel &) = delete;
Pablo Tello7df27862018-05-30 11:44:26 +010050
ramelg01a1f78512022-06-29 16:28:10 +010051 /** Prevent instances of this class from being moved it contains references.*/
52 CpuWinogradConv2dTransformInputKernel(CpuWinogradConv2dTransformInputKernel &&) = delete;
Pablo Tellof6c572c2018-02-14 12:47:30 +000053
ramelg01a1f78512022-06-29 16:28:10 +010054 /** Prevent instances of this class from being moved it contains references.*/
55 CpuWinogradConv2dTransformInputKernel &operator=(CpuWinogradConv2dTransformInputKernel &&) = delete;
Pablo Tello8f43d742019-03-27 09:28:32 +000056
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010057 CpuWinogradConv2dTransformInputKernel(arm_conv::winograd::WinogradImpl &w_impl,
58 arm_conv::ConvolutionArgs &_c_args,
59 uint32_t nthreads);
Pablo Tellod6ca4782018-01-23 09:36:04 +000060
ramelg01a1f78512022-06-29 16:28:10 +010061 // Inherited methods overridden:
62 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override;
Pablo Tellof6c572c2018-02-14 12:47:30 +000063
Pablo Tellod6ca4782018-01-23 09:36:04 +000064 const char *name() const override
65 {
Michalis Spyrou96f977e2021-07-01 12:20:56 +010066 return "CpuWinogradConv2dTransformInputKernel";
Pablo Tellod6ca4782018-01-23 09:36:04 +000067 }
Pablo Tello52140b42018-01-30 14:48:11 +000068
ramelg01a1f78512022-06-29 16:28:10 +010069private:
70 arm_conv::winograd::WinogradImpl &_winograd_impl;
71 arm_conv::ConvolutionArgs &_conv_args;
72 uint32_t _nthreads;
73};
74class CpuWinogradConv2dTransformOutputKernel : public ICpuKernel<CpuWinogradConv2dTransformOutputKernel>
75{
76public:
77 /** Prevent instances of this class from being copied (As this class contains pointers) */
78 CpuWinogradConv2dTransformOutputKernel(const CpuWinogradConv2dTransformOutputKernel &) = delete;
79
80 /** Prevent instances of this class from being copied (As this class contains pointers) */
81 CpuWinogradConv2dTransformOutputKernel &operator=(const CpuWinogradConv2dTransformOutputKernel &) = delete;
82
83 /** Prevent instances of this class from being moved it contains references.*/
84 CpuWinogradConv2dTransformOutputKernel(CpuWinogradConv2dTransformOutputKernel &&) = delete;
85
86 /** Prevent instances of this class from being moved it contains references.*/
87 CpuWinogradConv2dTransformOutputKernel &operator=(CpuWinogradConv2dTransformOutputKernel &&) = delete;
88
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010089 CpuWinogradConv2dTransformOutputKernel(arm_conv::winograd::WinogradImpl &w_impl,
90 arm_conv::ConvolutionArgs &_c_args,
91 uint32_t nthreads);
Pablo Tello52140b42018-01-30 14:48:11 +000092
Pablo Tellod6ca4782018-01-23 09:36:04 +000093 // Inherited methods overridden:
Michalis Spyrou96f977e2021-07-01 12:20:56 +010094 void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override;
Pablo Tello52140b42018-01-30 14:48:11 +000095
Pablo Tellod6ca4782018-01-23 09:36:04 +000096 const char *name() const override
97 {
Michalis Spyrou96f977e2021-07-01 12:20:56 +010098 return "CpuWinogradConv2dTransformOutputKernel";
Pablo Tellod6ca4782018-01-23 09:36:04 +000099 }
Vidhya Sudhan Loganathan3ca97862018-04-23 08:20:04 +0100100
Pablo Tellod6ca4782018-01-23 09:36:04 +0000101private:
ramelg01a1f78512022-06-29 16:28:10 +0100102 arm_conv::winograd::WinogradImpl &_winograd_impl;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100103 const arm_conv::ConvolutionArgs &_conv_args;
ramelg01a1f78512022-06-29 16:28:10 +0100104 uint32_t _nthreads;
Pablo Tello89519332017-11-17 11:52:36 +0000105};
106
Michalis Spyrou96f977e2021-07-01 12:20:56 +0100107} // namespace cpu
Pablo Tello89519332017-11-17 11:52:36 +0000108} // namespace arm_compute
Michalis Spyrou96f977e2021-07-01 12:20:56 +0100109#endif /*ARM_COMPUTE_CPUWINOGRADCONV2DKERNEL_H*/