diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-06-05 14:56:06 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:53:09 +0000 |
commit | 72219330fd85b1271e714d4ba894d6d8e26340c9 (patch) | |
tree | 9ae0510087a1ca77b1695252a8621de3f2ab98af /src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp | |
parent | c42f28d45e9b990276d54880d2cee9c9ee675a41 (diff) | |
download | ComputeLibrary-72219330fd85b1271e714d4ba894d6d8e26340c9.tar.gz |
COMPMID-1145: (API) Introduce prepare() stage (NEON/CL/GLES)
Change-Id: I5b46764f9c3154ec3e3b9c951cc9e6dfbcb81dfb
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/134255
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp')
-rw-r--r-- | src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp index 0a977ad08d..83c3e217f3 100644 --- a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp @@ -172,7 +172,7 @@ void NEDepthwiseConvolutionLayer3x3::run() NEDepthwiseConvolutionLayer::NEDepthwiseConvolutionLayer() : _im2col_kernel(), _weights_reshape_kernel(), _v2mm_kernel(), _vector_to_tensor_kernel(), _output_stage_kernel(), _v2mm_input_fill_border(), _v2mm_weights_fill_border(), _input_reshaped(), - _weights_reshaped(), _v2mm_output(), _output_reshaped(), _is_first_run(true), _is_quantized(false), _original_weights(nullptr) + _weights_reshaped(), _v2mm_output(), _output_reshaped(), _is_prepared(false), _is_quantized(false), _original_weights(nullptr) { } @@ -187,7 +187,7 @@ void NEDepthwiseConvolutionLayer::configure(ITensor *input, const ITensor *weigh const size_t weights_z = weights->info()->dimension(2); _is_quantized = is_data_type_quantized_asymmetric(input->info()->data_type()); - _is_first_run = true; + _is_prepared = false; _original_weights = weights; // Should bias be appended ? @@ -260,24 +260,12 @@ void NEDepthwiseConvolutionLayer::configure(ITensor *input, const ITensor *weigh // Allocate intermediate tensors _input_reshaped.allocator()->allocate(); - _weights_reshaped.allocator()->allocate(); _v2mm_output.allocator()->allocate(); } void NEDepthwiseConvolutionLayer::run() { - // Run weights reshaping (Runs once for every configure) - if(_is_first_run) - { - ARM_COMPUTE_ERROR_ON(!_original_weights->is_used()); - - NEScheduler::get().schedule(&_weights_reshape_kernel, Window::DimX); - NEScheduler::get().schedule(&_v2mm_weights_fill_border, Window::DimX); - _is_first_run = false; - - // Mark original weights tensor as unused - _original_weights->mark_as_unused(); - } + prepare(); NEScheduler::get().schedule(&_im2col_kernel, Window::DimX); NEScheduler::get().schedule(&_v2mm_input_fill_border, Window::DimX); @@ -288,3 +276,19 @@ void NEDepthwiseConvolutionLayer::run() NEScheduler::get().schedule(&_output_stage_kernel, Window::DimX); } } + +void NEDepthwiseConvolutionLayer::prepare() +{ + if(!_is_prepared) + { + ARM_COMPUTE_ERROR_ON(!_original_weights->is_used()); + + // Run reshape and mark original weights as unused + _weights_reshaped.allocator()->allocate(); + NEScheduler::get().schedule(&_weights_reshape_kernel, Window::DimX); + NEScheduler::get().schedule(&_v2mm_weights_fill_border, Window::DimX); + _original_weights->mark_as_unused(); + + _is_prepared = true; + } +} |