From ebcebf1dee7f8314976b1e0cabd62b4cf893d765 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 21 Oct 2020 00:04:14 +0100 Subject: COMPMID-3638: Move NEON kernels Signed-off-by: Michalis Spyrou Change-Id: Ieed3e4bc8be7fef80c90c5094599b477a56fc473 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4285 Comments-Addressed: Arm Jenkins Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- arm_compute/runtime/NEON/functions/NEConvolution.h | 59 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) (limited to 'arm_compute/runtime/NEON/functions/NEConvolution.h') diff --git a/arm_compute/runtime/NEON/functions/NEConvolution.h b/arm_compute/runtime/NEON/functions/NEConvolution.h index eb16a4582e..9415cf0835 100644 --- a/arm_compute/runtime/NEON/functions/NEConvolution.h +++ b/arm_compute/runtime/NEON/functions/NEConvolution.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 Arm Limited. + * Copyright (c) 2016-2020 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,8 +24,6 @@ #ifndef ARM_COMPUTE_NECONVOLUTION_H #define ARM_COMPUTE_NECONVOLUTION_H -#include "arm_compute/core/NEON/kernels/NEConvolutionKernel.h" -#include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" #include "arm_compute/core/Types.h" #include "arm_compute/runtime/IFunction.h" #include "arm_compute/runtime/IMemoryManager.h" @@ -39,6 +37,13 @@ namespace arm_compute { class ITensor; +class NEFillBorderKernel; +template +class NEConvolutionKernel; +template +class NESeparableConvolutionHorKernel; +template +class NESeparableConvolutionVertKernel; /** Basic function to execute convolution of size 3x3. This function calls the following NEON kernels: * @@ -49,6 +54,18 @@ class ITensor; class NEConvolution3x3 : public INESimpleFunction { public: + /** Constructor */ + NEConvolution3x3() = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolution3x3(const NEConvolution3x3 &) = delete; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolution3x3 &operator=(const NEConvolution3x3 &) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolution3x3(NEConvolution3x3 &&) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolution3x3 &operator=(NEConvolution3x3 &&) = delete; + /** Default destructor */ + ~NEConvolution3x3(); /** Initialize the function's source, destination, conv and border_mode. * * @param[in,out] input Source tensor. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED) @@ -74,6 +91,16 @@ class NEConvolutionSquare : public IFunction public: /** Default constructor */ NEConvolutionSquare(std::shared_ptr memory_manager = nullptr); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolutionSquare(const NEConvolutionSquare &) = delete; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolutionSquare &operator=(const NEConvolutionSquare &) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolutionSquare(NEConvolutionSquare &&) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolutionSquare &operator=(NEConvolutionSquare &&) = delete; + /** Default destructor */ + ~NEConvolutionSquare(); /** Initialize the function's source, destination, conv and border_mode. * * @param[in,out] input Source tensor. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED) @@ -89,13 +116,13 @@ public: void run() override; private: - MemoryGroup _memory_group; /**< Function memory group */ - Tensor _tmp; /**< temporary buffer for output of horizontal pass */ - bool _is_separable; /**< true if the convolution can be separated */ - NESeparableConvolutionHorKernel _kernel_hor; /**< kernel for horizontal pass of separated convolution */ - NESeparableConvolutionVertKernel _kernel_vert; /**< kernel for vertical pass of separated convolution */ - NEConvolutionKernel _kernel; /**< kernel for non-separated convolution **/ - NEFillBorderKernel _border_handler; /**< kernel for border handling */ + MemoryGroup _memory_group; /**< Function memory group */ + Tensor _tmp; /**< temporary buffer for output of horizontal pass */ + bool _is_separable; /**< true if the convolution can be separated */ + std::unique_ptr> _kernel_hor; /**< kernel for horizontal pass of separated convolution */ + std::unique_ptr> _kernel_vert; /**< kernel for vertical pass of separated convolution */ + std::unique_ptr> _kernel; /**< kernel for non-separated convolution **/ + std::unique_ptr _border_handler; /**< kernel for border handling */ }; /** Basic function to run 5x5 convolution. */ @@ -115,6 +142,18 @@ using NEConvolution9x9 = NEConvolutionSquare<9>; class NEConvolutionRectangle : public INESimpleFunction { public: + /** Constructor */ + NEConvolutionRectangle() = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolutionRectangle(const NEConvolutionRectangle &) = delete; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEConvolutionRectangle &operator=(const NEConvolutionRectangle &) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolutionRectangle(NEConvolutionRectangle &&) = delete; + /** Prevent instances of this class from being moved (As this class contains non movable objects) */ + NEConvolutionRectangle &operator=(NEConvolutionRectangle &&) = delete; + /** Default destructor */ + ~NEConvolutionRectangle(); /** Initialize the function's source, destination, conv and border_mode. * * @param[in,out] input Source tensor. Data type supported: U8. (Written to only for @p border_mode != UNDEFINED) -- cgit v1.2.1