From b9d38ee6378f3035f8dbad442223d3d9e2f3dc4f Mon Sep 17 00:00:00 2001 From: Frank Lei Date: Tue, 5 Dec 2017 10:43:33 +0800 Subject: APPBROWSER-312 Fully connected performance optimization Change-Id: Ie93fd630ebbad7b6ca8812cb5044b3f1908b45fd Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111830 Reviewed-by: Stephen Li Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com Reviewed-by: Anthony Barbier --- src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp') diff --git a/src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp index 97c4dc48a1..e849891c7c 100644 --- a/src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp +++ b/src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp @@ -107,7 +107,38 @@ void GCIm2ColKernel::configure(const IGCTensor *input, IGCTensor *output, std::p else { build_opts.insert("#define IM2COL_REDUCED"); - _num_elems_processed_per_iteration = 4 / input->info()->element_size(); + + if(input->info()->data_type() == DataType::F32) + { + _num_elems_processed_per_iteration = 4 / input->info()->element_size(); + } + else if(input->info()->data_type() == DataType::F16) + { + int input_width = input->info()->dimension(0); + int input_height = input->info()->dimension(1); + + build_opts.insert("#define IMAGE_SIZE " + support::cpp11::to_string(input_width * input_height)); + if(input_width % 8 == 0) + { + _num_elems_processed_per_iteration = 8; + build_opts.insert("#define IM2COL_REDUCED_8X"); + } + else if(input_width % 4 == 0) + { + _num_elems_processed_per_iteration = 4; + build_opts.insert("#define IM2COL_REDUCED_4X"); + } + else if(input_width % 2 == 0) + { + _num_elems_processed_per_iteration = 2; + build_opts.insert("#define IM2COL_REDUCED_2X"); + } + else + { + _num_elems_processed_per_iteration = 2; + build_opts.insert("#define IM2COL_REDUCED_GENERIC"); + } + } // Create kernel _kernel = static_cast(GCKernelLibrary::get().create_kernel("im2col_reduced", build_opts)); -- cgit v1.2.1