From ec0113dd7749991959ae351934eea0c0d8077dcb Mon Sep 17 00:00:00 2001 From: Gunes Bayir Date: Wed, 9 Nov 2022 09:26:27 +0000 Subject: Optimize Transposed Convolution for CL backend (FP32/16) This patch optimizes transposed convolution for CL backend by rewriting it in a single kernel instead of three (flip_kernel + upsample + conv). The new kernel skips the upsampling step which reduces the input space of convolution by stride_x * stride_y, resulting in significant performance improvement. It also skips the kernel flipping by traversing the weights accordingly, thus reduces the memory footprint. Resolves: COMPMID-5676 Signed-off-by: Gunes Bayir Change-Id: I8a333212dc7c5f7f0597aa58b0d56d44814baa14 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8588 Tested-by: Arm Jenkins Reviewed-by: Gian Marco Iodice Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- src/gpu/cl/ClKernelLibrary.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gpu/cl/ClKernelLibrary.cpp') diff --git a/src/gpu/cl/ClKernelLibrary.cpp b/src/gpu/cl/ClKernelLibrary.cpp index 0f08f5d044..4e036399db 100644 --- a/src/gpu/cl/ClKernelLibrary.cpp +++ b/src/gpu/cl/ClKernelLibrary.cpp @@ -448,6 +448,7 @@ const std::map ClKernelLibrary::_kernel_program_map = { "space_to_batch_nhwc", "nhwc/space_to_batch.cl" }, { "space_to_batch_static_nhwc", "nhwc/space_to_batch.cl" }, { "space_to_depth_nhwc", "nhwc/space_to_depth.cl" }, + { "transposed_convolution_nhwc", "nhwc/transposed_convolution.cl" }, { "upsample_layer_nhwc", "nhwc/upsample_layer.cl" }, { "winograd_filter_transform_4x1_3x1_nhwc", "nhwc/winograd_filter_transform.cl" }, { "winograd_filter_transform_1x4_1x3_nhwc", "nhwc/winograd_filter_transform.cl" }, @@ -941,6 +942,10 @@ const std::map ClKernelLibrary::_program_source_map = { "nhwc/space_to_depth.cl", #include "./cl_kernels/nhwc/space_to_depth.clembed" + }, + { + "nhwc/transposed_convolution.cl", +#include "./cl_kernels/nhwc/transposed_convolution.clembed" }, { "nhwc/winograd_filter_transform.cl", -- cgit v1.2.1