diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-07-01 15:36:44 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-07-08 19:11:30 +0000 |
commit | 4411e1f1d49efb78fb07a3c183f386307f951bad (patch) | |
tree | a09b107d7c833a0fa79f5dc1ad2d4a8e5132661c /src/runtime/CL/functions/CLConvolutionLayer.cpp | |
parent | dd23f2af4ee4f41f34499ada9c6cd28c9479c6d3 (diff) | |
download | ComputeLibrary-4411e1f1d49efb78fb07a3c183f386307f951bad.tar.gz |
Change CLConvolution selection to run Direct approach on large kernels
Consider selection of the Direct Conv2d approach on GPU for floating
point inputs when kernel size is greater or equal to 7x7.
Resolves: COMPMID-4595
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: If851b2e5241dab51127bf9051aa79d210d3f4421
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5894
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CL/functions/CLConvolutionLayer.cpp')
-rw-r--r-- | src/runtime/CL/functions/CLConvolutionLayer.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/runtime/CL/functions/CLConvolutionLayer.cpp b/src/runtime/CL/functions/CLConvolutionLayer.cpp index 2480276d79..500bc4d8e0 100644 --- a/src/runtime/CL/functions/CLConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLConvolutionLayer.cpp @@ -231,30 +231,22 @@ 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) >= 5) && (weights->dimension(idx_h) >= 5); - const bool is_ifm_gt_eq_16 = input->dimension(idx_c) >= 16; + const bool is_large_kernel_sz = (weights->dimension(idx_w) >= 7) && (weights->dimension(idx_h) >= 7); + const bool is_ifm_ge_16 = input->dimension(idx_c) >= 16; - // Large kernel size with IFMs >= OFMs - if(is_large_kernel_sz) + // Run Winograd if valid and IFM >= 16 + if(is_wino_valid && is_ifm_ge_16) { - // First check if we can use Winograd - if(is_wino_valid && is_ifm_gt_eq_16) - { - return ConvolutionMethod::WINOGRAD; - } - - if(is_direct_valid) - { - return ConvolutionMethod::DIRECT; - } - - // Default implementation for floating-point-data-type - return ConvolutionMethod::GEMM; + return ConvolutionMethod::WINOGRAD; } - else // Small kernel size + // Run Direct for Large kernel size + if(is_large_kernel_sz && is_ifm_ge_16 && is_direct_valid) { - return is_wino_valid && is_ifm_gt_eq_16 ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM; + return ConvolutionMethod::DIRECT; } + + // Default case + return ConvolutionMethod::GEMM; } // Generic case for quantized. Only GeMM |