aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp
diff options
context:
space:
mode:
authorSheri Zhang <sheri.zhang@arm.com>2020-10-14 13:34:54 +0100
committerSheri Zhang <sheri.zhang@arm.com>2020-10-28 14:12:33 +0000
commit5a4284dc7d98a382d0fa492b64fabe430d5afdc6 (patch)
treec331acbf1bab0220b8609dfa2375ce9e995740fd /src/core/CL/kernels/CLDepthConvertLayerKernel.cpp
parent1b50bd4d74d479f80c48ee1cd7b223245162aac3 (diff)
downloadComputeLibrary-5a4284dc7d98a382d0fa492b64fabe430d5afdc6.tar.gz
COMPMID-3710: Remove OpenCL padding: CLDepthConvertLayerKernel
Signed-off-by: Sheri Zhang <sheri.zhang@arm.com> Change-Id: Iee1d4655012ce4cb699535697aeefec673f0bc63 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4157 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLDepthConvertLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLDepthConvertLayerKernel.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp b/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp
index 24f638f8c4..452a14bd29 100644
--- a/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp
+++ b/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp
@@ -32,6 +32,7 @@
#include "arm_compute/core/Validate.h"
#include "src/core/CL/CLValidate.h"
#include "src/core/helpers/AutoConfiguration.h"
+#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
#include <cstddef>
@@ -81,21 +82,27 @@ void CLDepthConvertLayerKernel::configure(const CLCompileContext &compile_contex
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
+ _input = input;
+ _output = output;
+
// Auto initialize output shape if not initialized (We can only auto-configure the shape, datatype must be given)
set_shape_if_empty(*output->info(), input->info()->tensor_shape());
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), policy, shift));
+ auto padding_info = get_padding_info({ input, output });
+
// Get data sizes
const size_t input_size = data_size_from_type(input->info()->data_type());
const size_t output_size = data_size_from_type(output->info()->data_type());
// Get number of elements to process per iterations
- constexpr unsigned int num_elems_processed_per_iteration = 16;
+ const unsigned int num_elems_processed_per_iteration = adjust_vec_size(16 / input->info()->element_size(), input->info()->dimension(0));
// Set build options
CLBuildOptions build_opts;
build_opts.add_option("-DVEC_SIZE=" + support::cpp11::to_string(num_elems_processed_per_iteration));
+ build_opts.add_option("-DVEC_SIZE_LEFTOVER=" + support::cpp11::to_string(input->info()->dimension(0) % num_elems_processed_per_iteration));
build_opts.add_option("-DDATA_TYPE_IN=" + get_cl_type_from_data_type(input->info()->data_type()));
build_opts.add_option("-DDATA_TYPE_OUT=" + get_cl_type_from_data_type(output->info()->data_type()));
// Conversions from float always SATURATE as out-of-bounds conversion from float->integer is implementation defined
@@ -111,14 +118,25 @@ void CLDepthConvertLayerKernel::configure(const CLCompileContext &compile_contex
unsigned int idx = 2 * num_arguments_per_3D_tensor(); // Skip the input and output parameters
_kernel.setArg(idx++, shift);
+ // Since we have a leftover vector size calculated using the input tensor shape, it is required to
+ // have the input region equal to the tensor shape
+ ValidRegion input_valid_region = input->info()->valid_region();
+ input->info()->set_valid_region(ValidRegion(Coordinates(0, 0), input->info()->tensor_shape()));
+
// Configure kernel
- ICLSimple2DKernel::configure(input, output, num_elems_processed_per_iteration);
+ Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
+ ICLKernel::configure_internal(win);
// Collapse window
const Window &full_window = window();
Window collapsed_window = full_window.collapse_if_possible(full_window, Window::DimZ);
ICLKernel::configure_internal(collapsed_window);
+ // Restore the valid region
+ input->info()->set_valid_region(input_valid_region);
+
+ ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info));
+
// Set config_id for enabling LWS tuning
_config_id = kernel_name;
_config_id += "_";