From 96f977e43f452a75f2658b820791cb3d3da9c0a3 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Thu, 1 Jul 2021 12:20:56 +0100 Subject: Port NEWinogradConvolutionLayer Rename to CpuWinogradConv2d Allow memory to be injected externally Change-Id: I1f0a26ea533e326a7c63df86e708895c31752a39 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5926 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio --- .../NEON/functions/NEWinogradConvolutionLayer.h | 59 ++++++---------------- 1 file changed, 15 insertions(+), 44 deletions(-) (limited to 'arm_compute/runtime') diff --git a/arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h b/arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h index b02c4ed5b7..2a49f2be59 100644 --- a/arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h +++ b/arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h @@ -27,11 +27,6 @@ #include "arm_compute/runtime/IFunction.h" #include "arm_compute/core/Types.h" -#include "arm_compute/runtime/CPP/functions/CPPPermute.h" -#include "arm_compute/runtime/MemoryGroup.h" -#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" -#include "arm_compute/runtime/NEON/functions/NEGEMM.h" - #include "arm_compute/runtime/Tensor.h" #include @@ -40,13 +35,12 @@ namespace arm_compute { // Forward declarations class ITensor; -class ICPPKernel; /** Basic function to simulate a convolution layer. This function calls the following kernels: * - * -# @ref NEWinogradLayerTransformWeightsKernel (executed only once in the first call to the run() method ) - * -# @ref NEWinogradLayerTransformInputKernel - * -# @ref NEWinogradLayerTransformOutputKernel + * -# @ref cpu::CpuWinogradConv2dTransformWeightsKernel (executed only once in the first call to the run() method ) + * -# @ref cpu::CpuWinogradConv2dTransformInputKernel + * -# @ref cpu::CpuWinogradConv2dTransformOutputKernel * -# @ref cpu::CpuGemmAssemblyDispatch * -# @ref CPPPermute (three times: weights, input and output) * @@ -57,12 +51,16 @@ class NEWinogradConvolutionLayer : public IFunction public: /** Constructor */ NEWinogradConvolutionLayer(const std::shared_ptr &memory_manager = nullptr); - /** Prevent instances of this class from being moved (As this class contains non movable objects) */ - NEWinogradConvolutionLayer(NEWinogradConvolutionLayer &&) = delete; - /** Prevent instances of this class from being moved (As this class contains non movable objects) */ - NEWinogradConvolutionLayer &operator=(NEWinogradConvolutionLayer &&) = delete; - /** Default destructor */ - ~NEWinogradConvolutionLayer() = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEWinogradConvolutionLayer(const NEWinogradConvolutionLayer &) = delete; + /** Default move constructor */ + NEWinogradConvolutionLayer(NEWinogradConvolutionLayer &&) = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + NEWinogradConvolutionLayer &operator=(const NEWinogradConvolutionLayer &) = delete; + /** Default move assignment operator */ + NEWinogradConvolutionLayer &operator=(NEWinogradConvolutionLayer &&) = default; + /** Destructor */ + ~NEWinogradConvolutionLayer(); /** Set the input and output tensors. * @@ -105,36 +103,9 @@ public: static Status validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info = ActivationLayerInfo(), bool enable_fast_math = false); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEWinogradConvolutionLayer(const NEWinogradConvolutionLayer &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEWinogradConvolutionLayer &operator=(const NEWinogradConvolutionLayer &) = delete; - private: - MemoryGroup _memory_group; - NEGEMM _gemm_function; - std::unique_ptr _transform_input_kernel; - std::unique_ptr _transform_output_kernel; - std::unique_ptr _transform_weights_kernel; - NEActivationLayer _activationlayer_function; - - CPPPermute _permute_input; - CPPPermute _permute_weights; - CPPPermute _permute_output; - Tensor _input_transformed; - Tensor _output_transformed; - Tensor _input_workspace; - Tensor _output_workspace; - Tensor _kernel_storage; - Tensor _input_nhwc; - Tensor _output_nhwc; - Tensor _weights_hwio; - const ITensor *_input; - const ITensor *_weights; - ITensor *_output; - bool _is_prepared; - bool _is_activationlayer_enabled; - DataLayout _data_layout; + struct Impl; + std::unique_ptr _impl; }; } // namespace arm_compute #endif /* ARM_COMPUTE_NEWINOGRADCONVOLUTIONLAYER_H */ -- cgit v1.2.1