From a6a153817302793732e28b07c3b4046df3f91a60 Mon Sep 17 00:00:00 2001 From: Gunes Bayir Date: Mon, 16 Jan 2023 09:52:40 +0000 Subject: Fix performance regression when stride equal to kernel size This patch prefers Gemm-based transposed deconvolution algorithm in case kernel sizes and strides are equal to each other in each dimension. Resolves: COMPMID-5815 Signed-off-by: Gunes Bayir Change-Id: I22052e48341f3284d6bafbdbcce4a48399dc8e87 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8970 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Gian Marco Iodice --- src/runtime/CL/functions/CLDeconvolutionLayer.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/runtime/CL') diff --git a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp index ea7f3e75f7..56e9dae45d 100644 --- a/src/runtime/CL/functions/CLDeconvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLDeconvolutionLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2022 Arm Limited. + * Copyright (c) 2017-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -146,11 +146,6 @@ DeconvolutionMethod CLDeconvolutionLayer::get_deconvolution_method(const ITensor return DeconvolutionMethod::UPSCALE_CONV2D; } - if(input->data_layout() == DataLayout::NHWC) - { - return DeconvolutionMethod::DIRECT; - } - const DataLayout data_layout = input->data_layout(); const size_t idx_w = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH); @@ -158,7 +153,14 @@ DeconvolutionMethod CLDeconvolutionLayer::get_deconvolution_method(const ITensor if(weights->dimension(idx_w) != deconv_info.stride().first || weights->dimension(idx_h) != deconv_info.stride().second) { - return DeconvolutionMethod::UPSCALE_CONV2D; + if(input->data_layout() == DataLayout::NHWC) + { + return DeconvolutionMethod::DIRECT; + } + else + { + return DeconvolutionMethod::UPSCALE_CONV2D; + } } return DeconvolutionMethod::GEMM; -- cgit v1.2.1