aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-07-26 17:23:59 +0100
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-07-27 14:06:27 +0000
commit4718706b1141d5cccb006a7f86d65c1fde6c54ff (patch)
treec35b4c3568d10981327abae9820accfab1ceabad
parent387f80ed5b4c8ef32cfdba4ea27734dd257f87f0 (diff)
downloadComputeLibrary-4718706b1141d5cccb006a7f86d65c1fde6c54ff.tar.gz
Dispatch Conv2d using the Direct method when necessary
Direct Convolution will be preferred for large kernel sizes (>=5) and when input feature maps are greater or equal to output feature maps. Resolves: COMPMID-4708 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Ic9fe8b178a58bd95e7c47597221e47d344f96c79 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5996 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/runtime/CL/functions/CLConvolutionLayer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/runtime/CL/functions/CLConvolutionLayer.cpp b/src/runtime/CL/functions/CLConvolutionLayer.cpp
index 500bc4d8e0..cc6d9e142d 100644
--- a/src/runtime/CL/functions/CLConvolutionLayer.cpp
+++ b/src/runtime/CL/functions/CLConvolutionLayer.cpp
@@ -231,8 +231,9 @@ ConvolutionMethod CLConvolutionLayer::get_convolution_method(const ITensorInfo *
// Floating-point case: GeMM/Direct/Winograd
if(is_data_type_float(input->data_type()))
{
- const bool is_large_kernel_sz = (weights->dimension(idx_w) >= 7) && (weights->dimension(idx_h) >= 7);
+ const bool is_large_kernel_sz = (weights->dimension(idx_w) >= 5) && (weights->dimension(idx_h) >= 5);
const bool is_ifm_ge_16 = input->dimension(idx_c) >= 16;
+ const bool are_ifm_ge_ofm = input->dimension(idx_c) >= output->dimension(idx_c);
// Run Winograd if valid and IFM >= 16
if(is_wino_valid && is_ifm_ge_16)
@@ -240,7 +241,7 @@ ConvolutionMethod CLConvolutionLayer::get_convolution_method(const ITensorInfo *
return ConvolutionMethod::WINOGRAD;
}
// Run Direct for Large kernel size
- if(is_large_kernel_sz && is_ifm_ge_16 && is_direct_valid)
+ if(is_direct_valid && is_large_kernel_sz && is_ifm_ge_16 && are_ifm_ge_ofm)
{
return ConvolutionMethod::DIRECT;
}