From e52a3000d2c13bc1b66ca66b3d12b6b836982394 Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Wed, 11 Apr 2018 15:59:10 +0100 Subject: COMPMID-1026 - Add support for 4x4 output tile in CLWinogradConvolutionLayer The performance achieved can be found at the following confluence page: https://confluence.arm.com/display/MLENG/GEMM-based+convolution+vs+Winograd-based+convolution+on+OpenCL Change-Id: I4b690cfdd4eb4ff0cd17b14fdd49ccaa1d1dc85c Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/127729 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- .../CL/functions/CLWinogradConvolutionLayer.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp') diff --git a/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp b/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp index 0aa7f8d1b5..86ccddac88 100644 --- a/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLWinogradConvolutionLayer.cpp @@ -44,13 +44,18 @@ void CLWinogradConvolutionLayer::configure(ICLTensor *input, const ICLTensor *we const size_t idx_height = get_data_layout_dimension_index(input->info()->data_layout(), DataLayoutDimension::HEIGHT); // Input shape - const TensorShape input_shape = input->info()->tensor_shape(); + const TensorShape input_shape = input->info()->tensor_shape(); + const unsigned int input_w = input->info()->tensor_shape()[idx_width]; + const unsigned int input_h = input->info()->tensor_shape()[idx_height]; // Kernel size const unsigned int kernel_w = weights->info()->tensor_shape()[idx_width]; const unsigned int kernel_h = weights->info()->tensor_shape()[idx_height]; - const WinogradInfo winograd_info = WinogradInfo(Size2D(2, 2), + //Winograd output tile + const Size2D output_tile = (Size2D(kernel_w, kernel_h) == Size2D(3U, 3U) && input_w <= 4 && input_h <= 4) ? Size2D(2U, 2U) : Size2D(4U, 4U); + + const WinogradInfo winograd_info = WinogradInfo(output_tile, Size2D(kernel_w, kernel_h), Size2D(input_shape[idx_width], input_shape[idx_height]), conv_info, @@ -95,13 +100,18 @@ Status CLWinogradConvolutionLayer::validate(const ITensorInfo *input, const ITen const size_t idx_height = get_data_layout_dimension_index(input->data_layout(), DataLayoutDimension::HEIGHT); // Input shape - const TensorShape input_shape = input->tensor_shape(); + const TensorShape input_shape = input->tensor_shape(); + const unsigned int input_w = input->tensor_shape()[idx_width]; + const unsigned int input_h = input->tensor_shape()[idx_height]; // Kernel size const unsigned int kernel_w = weights->tensor_shape()[idx_width]; const unsigned int kernel_h = weights->tensor_shape()[idx_height]; - const WinogradInfo winograd_info = WinogradInfo(Size2D(2, 2), + //Winograd output tile + const Size2D output_tile = (Size2D(kernel_w, kernel_h) == Size2D(3U, 3U) && input_w <= 4 && input_h <= 4) ? Size2D(2U, 2U) : Size2D(4U, 4U); + + const WinogradInfo winograd_info = WinogradInfo(output_tile, Size2D(kernel_w, kernel_h), Size2D(input_shape[idx_width], input_shape[idx_height]), conv_info, -- cgit v1.2.1