From 1257131193fdb9b6940055a41691320e37a208b5 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Thu, 25 Aug 2022 12:25:44 +0100 Subject: Enable Winograd-based conv2d when IFM>=8 on Gpu From an internal performance evaluation, it seems that Winograd-based Conv2D offers better performance than alternative methods such as direct convolution and gemm-based conv already from IFM=8. Before the condition was for IFM>=16 Resolves COMPMID-5532 Change-Id: I9ff04835d6fd07f5f0abeec9645c9d9cc913b6b7 Signed-off-by: Gian Marco Iodice Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8147 Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir Benchmark: Arm Jenkins --- src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.cpp | 2 +- src/gpu/cl/operators/ClConv2d.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.cpp index d1f0338739..732d768308 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayerNativeKernel.cpp @@ -211,7 +211,7 @@ void CLDepthwiseConvolutionLayerNativeKernel::configure(const CLCompileContext & arm_compute::opencl::kernels::gemm::update_padding_for_cl_image(weights->info()); } - // Conditions of -cl-fast-relaxed-math causing accuracy issues can be traced from COMPMID-5324 + // Conditions of -cl-fast-relaxed-math causing accuracy issues can be traced from COMPMID-5324 const GPUTarget gpu_target = get_target(); const auto act_function = conv_info.act_info.activation(); const auto dst_data_type = _output->info()->data_type(); diff --git a/src/gpu/cl/operators/ClConv2d.cpp b/src/gpu/cl/operators/ClConv2d.cpp index 8119fc8e3d..16fc0e90d3 100644 --- a/src/gpu/cl/operators/ClConv2d.cpp +++ b/src/gpu/cl/operators/ClConv2d.cpp @@ -258,14 +258,15 @@ ConvolutionMethod ClConv2d::get_convolution_method(const ITensorInfo *src, const // Get dst shape TensorShape output_shape = misc::shape_calculator::compute_deep_convolution_shape(*src, *weights, conv_info); const bool is_large_kernel_sz = (weights->dimension(idx_w) >= kernel_sz_direct_conv_thr) && (weights->dimension(idx_h) >= kernel_sz_direct_conv_thr); + const bool is_ifm_ge_8 = src->dimension(idx_c) >= 8; const bool is_ifm_ge_16 = src->dimension(idx_c) >= 16; const bool is_ofm_lte_8 = weights->dimension(3U) <= 8; const bool workload_gte_8192 = (output_shape[0] * output_shape[1] * output_shape[2]) / 16 >= 8192; const bool is_ifm_gt_ofm = src->dimension(idx_c) > weights->dimension(3U); const bool is_m_one = output_shape[1] * output_shape[2] == 1; - // Run Winograd if valid and IFM >= 16 - if(is_wino_valid && is_ifm_ge_16) + // Run Winograd if valid and IFM >= 8 + if(is_wino_valid && is_ifm_ge_8) { if(is_ofm_lte_8) { -- cgit v1.2.1