aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp b/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
index feebe01cdb..dd9c234c56 100644
--- a/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
+++ b/src/core/CL/kernels/CLBatchConcatenateLayerKernel.cpp
@@ -38,25 +38,6 @@ namespace arm_compute
{
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 @@ void CLBatchConcatenateLayerKernel::configure(const CLCompileContext &compile_co
_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 @@ void CLBatchConcatenateLayerKernel::configure(const CLCompileContext &compile_co
_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 @@ Status CLBatchConcatenateLayerKernel::validate(const arm_compute::ITensorInfo *i
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{};
}