diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-10-21 00:04:14 +0100 |
---|---|---|
committer | Michalis Spyrou <michalis.spyrou@arm.com> | 2020-11-03 15:10:47 +0000 |
commit | ebcebf1dee7f8314976b1e0cabd62b4cf893d765 (patch) | |
tree | 95d3e691a0e88a3e213a1d30446a9224497f2055 /src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp | |
parent | da4b1b2055d96aaf73704eb9b0b82d74dc2d699c (diff) | |
download | ComputeLibrary-ebcebf1dee7f8314976b1e0cabd62b4cf893d765.tar.gz |
COMPMID-3638: Move NEON kernels
Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com>
Change-Id: Ieed3e4bc8be7fef80c90c5094599b477a56fc473
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4285
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp')
-rw-r--r-- | src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp index fe545905d5..98d6386ffe 100644 --- a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp @@ -27,9 +27,15 @@ #include "arm_compute/core/Utils.h" #include "arm_compute/core/Validate.h" #include "arm_compute/runtime/NEON/NEScheduler.h" +#include "src/core/NEON/kernels/NEDirectConvolutionLayerKernel.h" +#include "src/core/NEON/kernels/NEDirectConvolutionLayerOutputStageKernel.h" +#include "src/core/NEON/kernels/NEFillBorderKernel.h" +#include "support/MemorySupport.h" namespace arm_compute { +NEDirectConvolutionLayer::~NEDirectConvolutionLayer() = default; + NEDirectConvolutionLayer::NEDirectConvolutionLayer(std::shared_ptr<IMemoryManager> memory_manager) : _memory_group(std::move(memory_manager)), _output_stage_kernel(), _conv_kernel(), _input_border_handler(), _activationlayer_function(), _accumulator(), _has_bias(false), _is_activationlayer_enabled(false), _dim_split(Window::DimZ), _is_padding_required() @@ -39,6 +45,9 @@ NEDirectConvolutionLayer::NEDirectConvolutionLayer(std::shared_ptr<IMemoryManage void NEDirectConvolutionLayer::configure(ITensor *input, const ITensor *weights, const ITensor *bias, ITensor *output, const PadStrideInfo &conv_info, const ActivationLayerInfo &act_info) { ARM_COMPUTE_ERROR_ON(input->info()->data_layout() == DataLayout::UNKNOWN); + _output_stage_kernel = arm_compute::support::cpp14::make_unique<NEDirectConvolutionLayerOutputStageKernel>(); + _conv_kernel = arm_compute::support::cpp14::make_unique<NEDirectConvolutionLayerKernel>(); + _input_border_handler = arm_compute::support::cpp14::make_unique<NEFillBorderKernel>(); // Free accumulator if(_accumulator.buffer() != nullptr) @@ -51,17 +60,17 @@ void NEDirectConvolutionLayer::configure(ITensor *input, const ITensor *weights, // Check if bias should be added in the convolution result _has_bias = (bias != nullptr); - _conv_kernel.configure(input, weights, output, conv_info); + _conv_kernel->configure(input, weights, output, conv_info); if(_has_bias) { - _output_stage_kernel.configure(output, bias); + _output_stage_kernel->configure(output, bias); } - _is_padding_required = !_conv_kernel.border_size().empty(); + _is_padding_required = !_conv_kernel->border_size().empty(); if(_is_padding_required) { // Add zero padding XY - _input_border_handler.configure(input, _conv_kernel.border_size(), BorderMode::CONSTANT, PixelValue(static_cast<float>(0.f))); + _input_border_handler->configure(input, _conv_kernel->border_size(), BorderMode::CONSTANT, PixelValue(static_cast<float>(0.f))); } //Configure Activation Layer @@ -109,12 +118,12 @@ void NEDirectConvolutionLayer::run() if(_is_padding_required) { - NEScheduler::get().schedule(&_input_border_handler, Window::DimZ); + NEScheduler::get().schedule(_input_border_handler.get(), Window::DimZ); } - NEScheduler::get().schedule(&_conv_kernel, _dim_split); + NEScheduler::get().schedule(_conv_kernel.get(), _dim_split); if(_has_bias) { - NEScheduler::get().schedule(&_output_stage_kernel, Window::DimY); + NEScheduler::get().schedule(_output_stage_kernel.get(), Window::DimY); } if(_is_activationlayer_enabled) |