From 0a66abec3723f7dd655a118cf2969db59b37f171 Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Mon, 12 Apr 2021 16:44:24 +0100 Subject: Fix CLDepthwiseConvolutionLayer QSYMM8_PER_CHANNEL mismatches Resolve COMPMID-4367 Signed-off-by: Giorgio Arena Change-Id: I5e65b62c2ca52cf65950c9c343864ef55b7122c3 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5407 Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- .../runtime/CL/functions/CLDepthwiseConvolutionLayer.h | 3 ++- src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h index 8e594bc09f..e2c5d683cf 100644 --- a/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h +++ b/arm_compute/runtime/CL/functions/CLDepthwiseConvolutionLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -231,6 +231,7 @@ private: bool _needs_weights_reshape; bool _is_prepared; bool _is_quantized; + bool _is_nhwc; }; /** Basic function to execute a generic depthwise convolution. This function calls the following OpenCL kernels: diff --git a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp index 5ed8aa98c9..f7517a50a3 100644 --- a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp @@ -366,7 +366,8 @@ CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayerInternal3x3::CLDepthwise _needs_permute(false), _needs_weights_reshape(false), _is_prepared(false), - _is_quantized(false) + _is_quantized(false), + _is_nhwc(false) { } @@ -394,10 +395,10 @@ void CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayerInternal3x3::config gpu_target, dilation)); - const bool is_nhwc = input->info()->data_layout() == DataLayout::NHWC; + _is_nhwc = input->info()->data_layout() == DataLayout::NHWC; _is_quantized = is_data_type_quantized_asymmetric(input->info()->data_type()); - _needs_permute = is_nhwc && (depth_multiplier > 1); - _needs_weights_reshape = is_nhwc && (depth_multiplier == 1) && _is_quantized; + _needs_permute = _is_nhwc && (depth_multiplier > 1); + _needs_weights_reshape = _is_nhwc && (depth_multiplier == 1) && _is_quantized; _is_prepared = false; _original_weights = weights; @@ -437,7 +438,7 @@ void CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayerInternal3x3::config _kernel = std::make_unique(); } - else if(is_nhwc) + else if(_is_nhwc) { if(_needs_weights_reshape) { @@ -529,7 +530,7 @@ void CLDepthwiseConvolutionLayer::CLDepthwiseConvolutionLayerInternal3x3::prepar { _output_multipliers.map(); _output_shifts.map(); - const unsigned int idx_ofms = _needs_permute ? 2 : 0; + const unsigned int idx_ofms = _is_nhwc ? 0 : 2; quantization::compute_quantized_multipliers_and_shifts(_input->info(), _original_weights->info(), _output->info(), -- cgit v1.2.1