From 4718706b1141d5cccb006a7f86d65c1fde6c54ff Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 26 Jul 2021 17:23:59 +0100 Subject: 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 Change-Id: Ic9fe8b178a58bd95e7c47597221e47d344f96c79 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5996 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- src/runtime/CL/functions/CLConvolutionLayer.cpp | 5 +++-- 1 file 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; } -- cgit v1.2.1