diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-16 09:52:40 +0000 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-23 14:18:27 +0000 |
commit | a6a153817302793732e28b07c3b4046df3f91a60 (patch) | |
tree | 0a423b09429419646da948616f9b5cf660a82bec | |
parent | 5a63d1e39b8bcc19726bf98fe3b7f827701fabcd (diff) | |
download | ComputeLibrary-a6a153817302793732e28b07c3b4046df3f91a60.tar.gz |
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 <gunes.bayir@arm.com>
Change-Id: I22052e48341f3284d6bafbdbcce4a48399dc8e87
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8970
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
-rw-r--r-- | src/runtime/CL/functions/CLDeconvolutionLayer.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
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; |