COMPMID-3704 Remove OpenCL padding: CLBatchConcatenateLayerKernel

COMPMID-3709 Remove OpenCL padding: CLDepthConcatenateLayerKernel

Signed-off-by: Giorgio Arena <giorgio.arena@arm.com>
Change-Id: Iaea4fafd5d0f081fd5b45b0f6945302dc3365bd9
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4105
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
diff --git a/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp b/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
index feebe01..dd9c234 100644
--- a/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
+++ b/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
@@ -38,25 +38,6 @@
 {
 namespace
 {
-std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, unsigned int batch_offset, ITensorInfo *output)
-{
-    ARM_COMPUTE_UNUSED(batch_offset);
-
-    const unsigned int num_elems_processed_per_iteration = 16 / input->element_size();
-
-    // The window needs to be based on output, except for the batch size
-    Window win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration));
-    // The total batch size is the concatenation of the batch size of the inputs
-    win.set(3, Window::Dimension(0, input->tensor_shape()[3], 1));
-
-    AccessWindowHorizontal input_access(input, 0, num_elems_processed_per_iteration);
-    AccessWindowHorizontal output_access(output, 0, num_elems_processed_per_iteration);
-    bool                   window_changed = update_window_and_padding(win, input_access, output_access);
-    output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape()));
-
-    Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{};
-    return std::make_pair(err, win);
-}
 Status validate_arguments(const ITensorInfo *input, unsigned int batch_offset, const ITensorInfo *output)
 {
     ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
@@ -86,12 +67,13 @@
 
     _batch_offset = batch_offset;
 
-    const unsigned int num_elems_processed_per_iteration = 16 / input->element_size();
+    const unsigned int num_elems_processed_per_iteration = adjust_vec_size(16 / input->element_size(), input->dimension(0));
 
     // Add build options
     CLBuildOptions build_opts;
     build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->data_type()));
     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->dimension(0) % num_elems_processed_per_iteration));
     if(is_data_type_quantized_asymmetric(input->data_type()) && input->quantization_info() != output->quantization_info())
     {
         const UniformQuantizationInfo iq_info = input->quantization_info().uniform();
@@ -107,10 +89,9 @@
     _kernel = create_kernel(compile_context, "concatenate", build_opts.options());
 
     // Configure kernel window
-    auto win_config = validate_and_configure_window(input, batch_offset, output);
-    ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config));
-
-    ICLKernel::configure_internal(std::get<1>(win_config));
+    auto win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration));
+    win.set(3, Window::Dimension(0, input->tensor_shape()[3], 1));
+    ICLKernel::configure_internal(win);
 
     // Set output valid region
     output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape()));
@@ -135,7 +116,6 @@
                                                const arm_compute::ITensorInfo *output)
 {
     ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, batch_offset, output));
-    ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), batch_offset, output->clone().get()).first);
     return Status{};
 }