diff options
Diffstat (limited to 'src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp')
-rw-r--r-- | src/core/GLES_COMPUTE/kernels/GCIm2ColKernel.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
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<GCKernel>(GCKernelLibrary::get().create_kernel("im2col_reduced", build_opts)); |