From 702dc0c71f2b2830b63e3b4079ede0ef76377f0a Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Fri, 19 Mar 2021 15:06:07 +0000 Subject: Remove usage of valid window region CL - NHWC Resolves: COMPMID-4153 Change-Id: Ib0d60c9acaac8aaf3946c62fc2d740b5ec6cee5c Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5301 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- .../CL/kernels/CLChannelShuffleLayerKernel.cpp | 3 +- src/core/CL/kernels/CLCol2ImKernel.cpp | 6 +--- src/core/CL/kernels/CLComparisonKernel.cpp | 11 ++----- .../kernels/CLDeconvolutionLayerUpsampleKernel.cpp | 3 +- src/core/CL/kernels/CLDepthConvertLayerKernel.cpp | 10 +------ .../CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp | 4 +-- .../CLDepthwiseConvolutionLayer3x3NHWCKernel.cpp | 1 - ...pthwiseConvolutionLayerReshapeWeightsKernel.cpp | 3 +- src/core/CL/kernels/CLFFTDigitReverseKernel.cpp | 3 +- src/core/CL/kernels/CLFFTRadixStageKernel.cpp | 6 +--- src/core/CL/kernels/CLFFTScaleKernel.cpp | 34 +++++++--------------- src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp | 4 --- .../kernels/CLGEMMMatrixMultiplyNativeKernel.cpp | 2 -- .../kernels/CLGEMMMatrixMultiplyReshapedKernel.cpp | 2 -- .../CL/kernels/CLGEMMReshapeLHSMatrixKernel.cpp | 3 +- .../CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp | 3 +- src/core/CL/kernels/CLGatherKernel.cpp | 3 +- src/core/CL/kernels/CLIm2ColKernel.cpp | 4 +-- .../kernels/CLInstanceNormalizationLayerKernel.cpp | 28 +++++------------- src/core/CL/kernels/CLL2NormalizeLayerKernel.cpp | 3 +- .../CL/kernels/CLMeanStdDevNormalizationKernel.cpp | 7 +---- src/core/CL/kernels/CLMinMaxLayerKernel.cpp | 4 +-- src/core/CL/kernels/CLNormalizationLayerKernel.cpp | 3 +- .../CL/kernels/CLNormalizePlanarYUVLayerKernel.cpp | 3 +- .../CL/kernels/CLQLSTMLayerNormalizationKernel.cpp | 3 +- src/core/CL/kernels/CLROIPoolingLayerKernel.cpp | 7 ++--- src/core/CL/kernels/CLReductionOperationKernel.cpp | 4 +-- src/core/CL/kernels/CLRemapKernel.cpp | 4 +-- src/core/CL/kernels/CLReorgLayerKernel.cpp | 3 +- src/core/CL/kernels/CLStridedSliceKernel.cpp | 33 +++++---------------- src/core/CL/kernels/CLWeightsReshapeKernel.cpp | 4 +-- .../CL/kernels/CLWinogradOutputTransformKernel.cpp | 1 - .../gpu/cl/kernels/ClBatchConcatenateKernel.cpp | 3 -- .../gpu/cl/kernels/ClDepthConcatenateKernel.cpp | 3 -- src/core/gpu/cl/kernels/ClDequantizationKernel.cpp | 3 -- .../gpu/cl/kernels/ClDirectConvolutionKernel.cpp | 11 +++---- .../gpu/cl/kernels/ClHeightConcatenateKernel.cpp | 3 -- src/core/gpu/cl/kernels/ClPermuteKernel.cpp | 5 ---- .../cl/kernels/ClPixelWiseMultiplicationKernel.cpp | 16 +++------- src/core/gpu/cl/kernels/ClPoolingKernel.cpp | 7 ----- src/core/gpu/cl/kernels/ClQuantizationKernel.cpp | 2 -- src/core/gpu/cl/kernels/ClReshapeKernel.cpp | 3 -- .../kernels/ClWidthConcatenate2TensorsKernel.cpp | 2 -- .../kernels/ClWidthConcatenate4TensorsKernel.cpp | 2 -- .../gpu/cl/kernels/ClWidthConcatenateKernel.cpp | 3 -- 45 files changed, 63 insertions(+), 212 deletions(-) diff --git a/src/core/CL/kernels/CLChannelShuffleLayerKernel.cpp b/src/core/CL/kernels/CLChannelShuffleLayerKernel.cpp index c969792c3e..c774e98e44 100644 --- a/src/core/CL/kernels/CLChannelShuffleLayerKernel.cpp +++ b/src/core/CL/kernels/CLChannelShuffleLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -76,7 +76,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowRectangle output_access(output, 0, 0, num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y); const bool window_changed = update_window_and_padding(win, input_access, output_access); - output_access.set_valid_region(win, input->valid_region()); Window win_collapsed = win.collapse(win, Window::DimZ); diff --git a/src/core/CL/kernels/CLCol2ImKernel.cpp b/src/core/CL/kernels/CLCol2ImKernel.cpp index 44b8471725..5f52945efb 100644 --- a/src/core/CL/kernels/CLCol2ImKernel.cpp +++ b/src/core/CL/kernels/CLCol2ImKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -75,10 +75,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowHorizontal input_access(input, 0, num_elems_read_per_iteration); bool window_changed = update_window_and_padding(win, input_access); - Coordinates coord; - coord.set_num_dimensions(output->num_dimensions()); - output->set_valid_region(ValidRegion(coord, output->tensor_shape())); - Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); } diff --git a/src/core/CL/kernels/CLComparisonKernel.cpp b/src/core/CL/kernels/CLComparisonKernel.cpp index e2aee36bd8..d0b29e2ba8 100644 --- a/src/core/CL/kernels/CLComparisonKernel.cpp +++ b/src/core/CL/kernels/CLComparisonKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -75,16 +75,13 @@ Status validate_arguments(const ITensorInfo &input1, const ITensorInfo &input2, std::pair validate_and_configure_window(ITensorInfo &input1, ITensorInfo &input2, ITensorInfo &output) { - const std::pair broadcast_pair = ITensorInfo::broadcast_shape_and_valid_region(input1, input2); - const TensorShape &out_shape = broadcast_pair.first; - const ValidRegion &valid_region = broadcast_pair.second; - + const TensorShape &out_shape = TensorShape::broadcast_shape(input1.tensor_shape(), input2.tensor_shape()); const unsigned int num_elems_processed_per_iteration = calculate_num_elems_processed_per_iteration(input1); // Auto initialize output if not initialized auto_init_if_empty(output, out_shape, 1, DataType::U8, QuantizationInfo()); - Window win = calculate_max_window(valid_region, Steps(num_elems_processed_per_iteration)); + Window win = calculate_max_window(out_shape, Steps(num_elems_processed_per_iteration)); Window win_input1 = win.broadcast_if_dimension_le_one(input1); Window win_input2 = win.broadcast_if_dimension_le_one(input2); @@ -96,8 +93,6 @@ std::pair validate_and_configure_window(ITensorInfo &input1, ITe || update_window_and_padding(win_input2, input2_access) || update_window_and_padding(win, output_access); - output_access.set_valid_region(win, valid_region); - Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); } diff --git a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp index d28cffa05f..eb420d8842 100644 --- a/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp +++ b/src/core/CL/kernels/CLDeconvolutionLayerUpsampleKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -96,7 +96,6 @@ void CLDeconvolutionLayerUpsampleKernel::configure(const CLCompileContext &compi // Configure kernel window Window win = calculate_max_window(*output->info(), Steps(num_elems_processed_per_iteration)); AccessWindowHorizontal output_access(output->info(), 0, num_elems_processed_per_iteration); - output_access.set_valid_region(win, ValidRegion(Coordinates(), output->info()->tensor_shape())); ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); diff --git a/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp b/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp index c98d66f390..0d5c7a4881 100644 --- a/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp +++ b/src/core/CL/kernels/CLDepthConvertLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 Arm Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -118,11 +118,6 @@ 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 Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win); @@ -132,9 +127,6 @@ void CLDepthConvertLayerKernel::configure(const CLCompileContext &compile_contex 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 diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp index ba7a782bf1..e8daa56f36 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NCHWKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -228,8 +228,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen bool window_changed = update_window_and_padding(win, input_access, weights_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); } diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NHWCKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NHWCKernel.cpp index d13afd2010..6400ba53e2 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NHWCKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3NHWCKernel.cpp @@ -168,7 +168,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowHorizontal bias_access(bias, 0, num_elems_accessed_per_iteration); window_changed = window_changed || update_window_and_padding(win, bias_access); } - output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape())); err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; } diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayerReshapeWeightsKernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayerReshapeWeightsKernel.cpp index b10c23bde9..386d634cea 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayerReshapeWeightsKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayerReshapeWeightsKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -74,7 +74,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowHorizontal weights_access(input, 0, info.c0); const bool window_changed = update_window_and_padding(win, weights_access); - output->set_valid_region(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); } diff --git a/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp b/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp index 22eee11c8a..ff04708b5b 100644 --- a/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp +++ b/src/core/CL/kernels/CLFFTDigitReverseKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -62,7 +62,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen auto_init_if_empty(*output, input->clone()->set_num_channels(2)); Window win = calculate_max_window(*output, Steps()); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); return std::make_pair(Status{}, win); } diff --git a/src/core/CL/kernels/CLFFTRadixStageKernel.cpp b/src/core/CL/kernels/CLFFTRadixStageKernel.cpp index 5db3cb6bf2..779bf43922 100644 --- a/src/core/CL/kernels/CLFFTRadixStageKernel.cpp +++ b/src/core/CL/kernels/CLFFTRadixStageKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -70,10 +70,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen steps.set(config.axis, config.radix); Window win = calculate_max_window(*input, steps); - if(output != nullptr) - { - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); - } return std::make_pair(Status{}, win); } diff --git a/src/core/CL/kernels/CLFFTScaleKernel.cpp b/src/core/CL/kernels/CLFFTScaleKernel.cpp index edcf5d5a5d..c80f774c6a 100644 --- a/src/core/CL/kernels/CLFFTScaleKernel.cpp +++ b/src/core/CL/kernels/CLFFTScaleKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -50,25 +50,6 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output) return Status{}; } - -std::pair validate_and_configure_window(ITensorInfo *input, ITensorInfo *output) -{ - // Configure kernel window - Window win = calculate_max_window(*input, Steps()); - - if(output != nullptr) - { - // Output auto inizialitation if not yet initialized - auto_init_if_empty(*output, *input->clone()); - - // CLFFTScaleKernel doesn't need padding so update_window_and_padding() can be skipped - Coordinates coord; - coord.set_num_dimensions(output->num_dimensions()); - output->set_valid_region(ValidRegion(coord, output->tensor_shape())); - } - - return std::make_pair(Status{}, win); -} } // namespace CLFFTScaleKernel::CLFFTScaleKernel() @@ -105,9 +86,15 @@ void CLFFTScaleKernel::configure(const CLCompileContext &compile_context, ICLTen _kernel.setArg(idx, config.scale); // Configure kernel window - auto win_config = validate_and_configure_window(input->info(), _run_in_place ? nullptr : output->info()); - ARM_COMPUTE_ERROR_THROW_ON(win_config.first); - ICLKernel::configure_internal(win_config.second); + Window win = calculate_max_window(*input->info(), Steps()); + + if(output != nullptr) + { + // Output auto inizialitation if not yet initialized + auto_init_if_empty(*output->info(), *input->info()->clone()); + } + + ICLKernel::configure_internal(win); // Set config_id for enabling LWS tuning _config_id = kernel_name; @@ -124,7 +111,6 @@ Status CLFFTScaleKernel::validate(const ITensorInfo *input, const ITensorInfo *o { ARM_COMPUTE_UNUSED(config); ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output)); - ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get()).first); return Status{}; } diff --git a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp index 6d3b1e5897..1ef46b5059 100644 --- a/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixMultiplyKernel.cpp @@ -249,10 +249,6 @@ inline std::pair validate_and_configure_window(ITensorInfo *inpu window_changed = update_window_and_padding(win, input0_access, input1_access) || // window used by the execute_window_loop update_window_and_padding(win_out, output_access); // window used to update the padding requirements of output tensor } - - Coordinates coord; - coord.set_num_dimensions(output->num_dimensions()); - output_access.set_valid_region(win_out, ValidRegion(coord, output->tensor_shape())); } // Collapse along the Z direction diff --git a/src/core/CL/kernels/CLGEMMMatrixMultiplyNativeKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixMultiplyNativeKernel.cpp index f07166e4bb..1fe298c0a1 100644 --- a/src/core/CL/kernels/CLGEMMMatrixMultiplyNativeKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixMultiplyNativeKernel.cpp @@ -184,8 +184,6 @@ std::pair validate_and_configure_window(ITensorInfo *input0, ITe update_window_and_padding(win_out, output_access); // window used to update the padding requirements of output tensor } - output_access.set_valid_region(win_out, ValidRegion(Coordinates(), output->tensor_shape())); - // Collapse along the Z direction // This collapse needs to be here in order to tune the Z dimension of LWS Window collapsed = win; diff --git a/src/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.cpp b/src/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.cpp index 9f1ffa48eb..653887dcec 100644 --- a/src/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.cpp +++ b/src/core/CL/kernels/CLGEMMMatrixMultiplyReshapedKernel.cpp @@ -190,8 +190,6 @@ std::pair validate_and_configure_window(ITensorInfo *input0, ITe update_window_and_padding(win_out, output_access); // window used to update the padding requirements of output tensor } - output_access.set_valid_region(win_out, ValidRegion(Coordinates(0, 0), output->tensor_shape())); - // Collapse along the Z direction // This collapse needs to be here in order to tune the Z dimension of LWS Window collapsed = win; diff --git a/src/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.cpp b/src/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.cpp index 52510075b7..cc95315894 100644 --- a/src/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.cpp +++ b/src/core/CL/kernels/CLGEMMReshapeLHSMatrixKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -97,7 +97,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen window_changed = update_window_and_padding(win_in, input_access) || // window used by the execute_window_loop update_window_and_padding(win, output_access); // window used to update the padding requirements of output tensor - output_access.set_valid_region(win, ValidRegion(Coordinates(0, 0), output->tensor_shape())); // Collapse along the Z direction // This collapse needs to be here in order to tune the Z dimension of LWS diff --git a/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp b/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp index 33de61ed01..8f2989e083 100644 --- a/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp +++ b/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -90,7 +90,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowStatic output_access(output, 0, 0, output->dimension(0), output->dimension(1)); window_changed = update_window_and_padding(win, input_access); - output_access.set_valid_region(win, ValidRegion(Coordinates(0, 0), output->tensor_shape())); if(rhs_info.export_to_cl_image) { diff --git a/src/core/CL/kernels/CLGatherKernel.cpp b/src/core/CL/kernels/CLGatherKernel.cpp index e33bc7afd7..cbd540d80b 100644 --- a/src/core/CL/kernels/CLGatherKernel.cpp +++ b/src/core/CL/kernels/CLGatherKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -66,7 +66,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen // Create window Window win = calculate_max_window(*output, Steps()); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); return std::make_pair(Status{}, win); } diff --git a/src/core/CL/kernels/CLIm2ColKernel.cpp b/src/core/CL/kernels/CLIm2ColKernel.cpp index 07309de83c..671058106e 100644 --- a/src/core/CL/kernels/CLIm2ColKernel.cpp +++ b/src/core/CL/kernels/CLIm2ColKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -147,7 +147,7 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen win = calculate_max_window(*input, Steps()); } } - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); + // set the Z dimension's step same size as the whole dimension so that one can't split across the Z dimension win.set_dimension_step(Window::DimZ, win[Window::DimZ].end() - win[Window::DimZ].start()); diff --git a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp index f9e1cbec27..50c4e24c33 100644 --- a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp +++ b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -54,21 +54,6 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, c return Status{}; } - -std::tuple validate_and_configure_window(ITensorInfo *input, ITensorInfo *output) -{ - // We handle the planes manually - Window win = calculate_max_window(*input, Steps(1)); - - // Output auto initialization if not yet initialized - auto_init_if_empty(*output, input->tensor_shape(), 1, input->data_type()); - - // CLInstanceNormalizationLayerKernel doesn't need padding so update_window_and_padding() can be skipped - Coordinates coord; - coord.set_num_dimensions(output->num_dimensions()); - output->set_valid_region(ValidRegion(coord, output->tensor_shape())); - return std::make_pair(Status{}, win); -} } // namespace CLInstanceNormalizationLayerKernel::CLInstanceNormalizationLayerKernel() @@ -110,16 +95,19 @@ void CLInstanceNormalizationLayerKernel::configure(const CLCompileContext &compi _kernel = create_kernel(compile_context, "instance_normalization", build_opts.options()); // Configure kernel window - auto win_config = validate_and_configure_window(_input->info(), _output->info()); - ARM_COMPUTE_ERROR_THROW_ON(std::get<0>(win_config)); - ICLKernel::configure_internal(std::get<1>(win_config)); + Window win = calculate_max_window(*input->info(), Steps(1)); + if(output != nullptr) + { + auto_init_if_empty(*output->info(), input->info()->tensor_shape(), 1, input->info()->data_type()); + } + + ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLInstanceNormalizationLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info) { ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, info)); - ARM_COMPUTE_RETURN_ON_ERROR(std::get<0>(validate_and_configure_window(input->clone().get(), (output == nullptr ? input->clone().get() : output->clone().get())))); return Status{}; } diff --git a/src/core/CL/kernels/CLL2NormalizeLayerKernel.cpp b/src/core/CL/kernels/CLL2NormalizeLayerKernel.cpp index 9e91d98f7c..213770591f 100644 --- a/src/core/CL/kernels/CLL2NormalizeLayerKernel.cpp +++ b/src/core/CL/kernels/CLL2NormalizeLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -83,7 +83,6 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe 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, input->valid_region()); Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; diff --git a/src/core/CL/kernels/CLMeanStdDevNormalizationKernel.cpp b/src/core/CL/kernels/CLMeanStdDevNormalizationKernel.cpp index a889df7930..7dc34f17b5 100644 --- a/src/core/CL/kernels/CLMeanStdDevNormalizationKernel.cpp +++ b/src/core/CL/kernels/CLMeanStdDevNormalizationKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Arm Limited. + * Copyright (c) 2019-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -68,11 +68,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen // This kernel doesn't need padding Window win = calculate_max_window(*input, Steps(num_elems_processed_per_iteration)); - if(output != nullptr) - { - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); - } - return std::make_pair(Status{}, win); } } // namespace diff --git a/src/core/CL/kernels/CLMinMaxLayerKernel.cpp b/src/core/CL/kernels/CLMinMaxLayerKernel.cpp index 7017efa3c2..ac8770467e 100644 --- a/src/core/CL/kernels/CLMinMaxLayerKernel.cpp +++ b/src/core/CL/kernels/CLMinMaxLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -75,8 +75,6 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe 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_tuple(err, win); } diff --git a/src/core/CL/kernels/CLNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLNormalizationLayerKernel.cpp index d1982e77b9..1ea0d2c23d 100644 --- a/src/core/CL/kernels/CLNormalizationLayerKernel.cpp +++ b/src/core/CL/kernels/CLNormalizationLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -91,7 +91,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowHorizontal output_access(output, 0, num_elems_processed_per_iteration); window_changed = window_changed || update_window_and_padding(win, output_access); - output_access.set_valid_region(win, input->valid_region()); Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); diff --git a/src/core/CL/kernels/CLNormalizePlanarYUVLayerKernel.cpp b/src/core/CL/kernels/CLNormalizePlanarYUVLayerKernel.cpp index 18cbe217be..e78d906a9d 100644 --- a/src/core/CL/kernels/CLNormalizePlanarYUVLayerKernel.cpp +++ b/src/core/CL/kernels/CLNormalizePlanarYUVLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -77,7 +77,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen 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, input->valid_region()); if(input->data_layout() == DataLayout::NHWC) { diff --git a/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp b/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp index ccc61783c4..f68520dee6 100644 --- a/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp +++ b/src/core/CL/kernels/CLQLSTMLayerNormalizationKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -51,7 +51,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen // This kernel doesn't need padding Window win = calculate_max_window(*input, Steps(num_elems_processed_per_iteration)); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); return std::make_pair(Status{}, win); } diff --git a/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp b/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp index 43492a3d50..175691a0d2 100644 --- a/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp +++ b/src/core/CL/kernels/CLROIPoolingLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -60,9 +60,8 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowHorizontal output_access(output, 0, num_elems_processed_per_iteration); AccessWindowHorizontal input_access(input, input->valid_region().start(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{}; + bool window_changed = update_window_and_padding(win, input_access, output_access); + Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); } } // namespace diff --git a/src/core/CL/kernels/CLReductionOperationKernel.cpp b/src/core/CL/kernels/CLReductionOperationKernel.cpp index 2697a0df98..a5734d43de 100644 --- a/src/core/CL/kernels/CLReductionOperationKernel.cpp +++ b/src/core/CL/kernels/CLReductionOperationKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -94,7 +94,6 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe AccessWindowStatic input_access(input, 0, 0, input->dimension(0) + border_width, 1); AccessWindowHorizontal output_access(output, 0, 1); window_changed = update_window_and_padding(win, input_access, output_access); - output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape())); } } break; @@ -105,7 +104,6 @@ std::tuple validate_and_configure_window(ITensorInfo *input, ITe AccessWindowHorizontal input_access(input, 0, num_elems_processed_per_iteration); AccessWindowHorizontal output_access(output, 0, num_elems_processed_per_iteration); window_changed = update_window_and_padding(win, input_access, output_access); - output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape())); } break; default: diff --git a/src/core/CL/kernels/CLRemapKernel.cpp b/src/core/CL/kernels/CLRemapKernel.cpp index 0ebeefcc74..335be9b3e7 100644 --- a/src/core/CL/kernels/CLRemapKernel.cpp +++ b/src/core/CL/kernels/CLRemapKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -86,8 +86,6 @@ void CLRemapKernel::configure(const CLCompileContext &compile_context, const ICL update_window_and_padding(win, input_access, output_access); - output_access.set_valid_region(win, ValidRegion(Coordinates(), output->info()->tensor_shape())); - ICLKernel::configure_internal(win); // Set static arguments diff --git a/src/core/CL/kernels/CLReorgLayerKernel.cpp b/src/core/CL/kernels/CLReorgLayerKernel.cpp index 01853450ee..c6c7824188 100644 --- a/src/core/CL/kernels/CLReorgLayerKernel.cpp +++ b/src/core/CL/kernels/CLReorgLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -101,7 +101,6 @@ void CLReorgLayerKernel::configure(const CLCompileContext &compile_context, cons Window win = calculate_max_window(*output->info(), Steps()); // The CLWeightsReshapeKernel doesn't need padding so update_window_and_padding() can be skipped - output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape())); ICLKernel::configure_internal(win); _config_id = kernel_name; diff --git a/src/core/CL/kernels/CLStridedSliceKernel.cpp b/src/core/CL/kernels/CLStridedSliceKernel.cpp index 75fd01df14..dd51df9363 100644 --- a/src/core/CL/kernels/CLStridedSliceKernel.cpp +++ b/src/core/CL/kernels/CLStridedSliceKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -68,23 +68,6 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, return Status{}; } - -std::pair validate_and_configure_window(const ITensorInfo *input, ITensorInfo *output, - const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, - int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask) -{ - // Output tensor auto initialization if not yet initialized - const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_strided_slice_shape(*input, - starts, ends, strides, - begin_mask, end_mask, shrink_axis_mask); - auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape)); - - // Create window - Window win = calculate_max_window(*output, Steps()); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); - - return std::make_pair(Status{}, win); -} } // namespace void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output, @@ -106,8 +89,11 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co begin_mask, end_mask, shrink_axis_mask); // Configure kernel window - auto win_config = validate_and_configure_window(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask); - ARM_COMPUTE_ERROR_THROW_ON(win_config.first); + const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_strided_slice_shape(*input, + starts, ends, strides, + begin_mask, end_mask, shrink_axis_mask); + auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape)); + Window win = calculate_max_window(*output, Steps()); // Enable multiple elements processing along x if stride_x is 1 and output width greater than the access vector size const int vec_size_x = 16 / input->element_size(); @@ -118,11 +104,11 @@ void CLStridedSliceKernel::configure(const CLCompileContext &compile_context, co // Update window if needed if(multi_access_x) { - Window &updated_window = std::get<1>(win_config); + Window &updated_window = win; updated_window.set(Window::DimX, Window::Dimension(updated_window.x().start(), ceil_to_multiple(updated_window.x().end(), vec_size_x), vec_size_x)); } - ICLKernel::configure_internal(win_config.second); + ICLKernel::configure_internal(win); // Create build options CLBuildOptions build_opts; @@ -169,9 +155,6 @@ Status CLStridedSliceKernel::validate(const ITensorInfo *input, const ITensorInf int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask) { ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask)); - ARM_COMPUTE_RETURN_ON_ERROR(validate_and_configure_window(input->clone().get(), output->clone().get(), - starts, ends, strides, begin_mask, end_mask, shrink_axis_mask) - .first); return Status{}; } diff --git a/src/core/CL/kernels/CLWeightsReshapeKernel.cpp b/src/core/CL/kernels/CLWeightsReshapeKernel.cpp index 559f47ce26..d55c548b99 100644 --- a/src/core/CL/kernels/CLWeightsReshapeKernel.cpp +++ b/src/core/CL/kernels/CLWeightsReshapeKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -107,8 +107,6 @@ void CLWeightsReshapeKernel::configure(const CLCompileContext &compile_context, // Configure window Window win = calculate_max_window(*input->info(), Steps()); - // The CLWeightsReshapeKernel doesn't need padding so update_window_and_padding() can be skipped - output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape())); ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); diff --git a/src/core/CL/kernels/CLWinogradOutputTransformKernel.cpp b/src/core/CL/kernels/CLWinogradOutputTransformKernel.cpp index db0e921646..965bf9df77 100644 --- a/src/core/CL/kernels/CLWinogradOutputTransformKernel.cpp +++ b/src/core/CL/kernels/CLWinogradOutputTransformKernel.cpp @@ -111,7 +111,6 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen AccessWindowRectangle input_access(input, 0, 0, num_elems_processed_per_iteration, num_elems_processed_per_iteration); AccessWindowStatic output_access(output, 0, 0, output_static_window_end_x, output_static_window_end_y); window_changed = update_window_and_padding(win, input_access, output_access); - output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape())); } Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; diff --git a/src/core/gpu/cl/kernels/ClBatchConcatenateKernel.cpp b/src/core/gpu/cl/kernels/ClBatchConcatenateKernel.cpp index c16ff1f028..26f5113822 100644 --- a/src/core/gpu/cl/kernels/ClBatchConcatenateKernel.cpp +++ b/src/core/gpu/cl/kernels/ClBatchConcatenateKernel.cpp @@ -99,9 +99,6 @@ void ClBatchConcatenateKernel::configure(const CLCompileContext &compile_context win.set(3, Window::Dimension(0, src->tensor_shape()[3], 1)); ICLKernel::configure_internal(win); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - // Set config_id for enabling LWS tuning _config_id = "concatenate_"; _config_id += support::cpp11::to_string(3); diff --git a/src/core/gpu/cl/kernels/ClDepthConcatenateKernel.cpp b/src/core/gpu/cl/kernels/ClDepthConcatenateKernel.cpp index e8893d76d2..4039570da4 100644 --- a/src/core/gpu/cl/kernels/ClDepthConcatenateKernel.cpp +++ b/src/core/gpu/cl/kernels/ClDepthConcatenateKernel.cpp @@ -98,9 +98,6 @@ void ClDepthConcatenateKernel::configure(const CLCompileContext &compile_context win.set(Window::DimZ, Window::Dimension(0, src->tensor_shape().z(), 1)); ICLKernel::configure_internal(win); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/gpu/cl/kernels/ClDequantizationKernel.cpp b/src/core/gpu/cl/kernels/ClDequantizationKernel.cpp index 267ac9b2b4..612a03437b 100644 --- a/src/core/gpu/cl/kernels/ClDequantizationKernel.cpp +++ b/src/core/gpu/cl/kernels/ClDequantizationKernel.cpp @@ -113,9 +113,6 @@ void ClDequantizationKernel::configure(const CLCompileContext &compile_context, } ICLKernel::configure_internal(win); - // Set output valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/gpu/cl/kernels/ClDirectConvolutionKernel.cpp b/src/core/gpu/cl/kernels/ClDirectConvolutionKernel.cpp index 72801fa6c8..c6ca084386 100644 --- a/src/core/gpu/cl/kernels/ClDirectConvolutionKernel.cpp +++ b/src/core/gpu/cl/kernels/ClDirectConvolutionKernel.cpp @@ -279,11 +279,8 @@ std::pair validate_and_configure_window(ITensorInfo *src, ITenso const unsigned int num_rows = dst->tensor_shape()[0] > 16 ? 2u : 1U; // Create window and update padding - Window win = calculate_max_window(*dst, Steps(vec_size, num_rows)); - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - - Status err = Status{}; - return std::make_pair(err, win); + Window win = calculate_max_window(output_shape, Steps(vec_size, num_rows)); + return std::make_pair(Status{}, win); } else if(data_layout == DataLayout::NCHW) { @@ -368,8 +365,8 @@ void ClDirectConvolutionKernel::configure(const CLCompileContext &compile_contex kernel_name << "direct_convolution_nhwc"; - const unsigned int n0 = win_config.second.x().step(); - const unsigned int m0 = win_config.second.y().step(); + const unsigned int n0 = win_config.second.x().step(); + const unsigned int m0 = win_config.second.y().step(); const unsigned int k0 = adjust_vec_size(8u, src->dimension(channel_idx)); const unsigned int partial_store_n0 = dst->dimension(channel_idx) % n0; diff --git a/src/core/gpu/cl/kernels/ClHeightConcatenateKernel.cpp b/src/core/gpu/cl/kernels/ClHeightConcatenateKernel.cpp index 83e976e10f..4436e98fe3 100644 --- a/src/core/gpu/cl/kernels/ClHeightConcatenateKernel.cpp +++ b/src/core/gpu/cl/kernels/ClHeightConcatenateKernel.cpp @@ -110,9 +110,6 @@ void ClHeightConcatenateKernel::configure(const CLCompileContext &compile_contex Window win = calculate_max_window(*src, Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win.collapse(win, Window::DimZ)); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/gpu/cl/kernels/ClPermuteKernel.cpp b/src/core/gpu/cl/kernels/ClPermuteKernel.cpp index 992c2a89d3..04e649b911 100644 --- a/src/core/gpu/cl/kernels/ClPermuteKernel.cpp +++ b/src/core/gpu/cl/kernels/ClPermuteKernel.cpp @@ -109,11 +109,6 @@ void ClPermuteKernel::configure(const CLCompileContext &compile_context, const I // Configure kernel window Window win = calculate_max_window(*src, Steps()); - // The CLPermute doesn't need padding so update_window_and_padding() can be skipped - Coordinates coord; - coord.set_num_dimensions(dst->num_dimensions()); - dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); - ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp b/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp index f5303379be..56997dc8ad 100644 --- a/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp +++ b/src/core/gpu/cl/kernels/ClPixelWiseMultiplicationKernel.cpp @@ -95,9 +95,7 @@ Status validate_arguments(const ITensorInfo *src1, const ITensorInfo *src2, cons std::pair validate_and_configure_window(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) { - const std::pair broadcast_pair = ITensorInfo::broadcast_shape_and_valid_region(*src1, *src2); - const TensorShape &out_shape = broadcast_pair.first; - const ValidRegion &valid_region = broadcast_pair.second; + const TensorShape &out_shape = TensorShape::broadcast_shape(src1->tensor_shape(), src2->tensor_shape()); // Auto initialize dst if not initialized { @@ -125,7 +123,7 @@ std::pair validate_and_configure_window(ITensorInfo *src1, ITens } } - Window win = calculate_max_window(valid_region, Steps(num_elems_processed_per_iteration)); + Window win = calculate_max_window(out_shape, Steps(num_elems_processed_per_iteration)); Window win_input1 = win.broadcast_if_dimension_le_one(*src1); Window win_input2 = win.broadcast_if_dimension_le_one(*src2); @@ -137,8 +135,6 @@ std::pair validate_and_configure_window(ITensorInfo *src1, ITens || update_window_and_padding(win_input2, input2_access) || update_window_and_padding(win, output_access); - output_access.set_valid_region(win, valid_region); - Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); } @@ -349,15 +345,13 @@ Status validate_arguments_complex(const ITensorInfo *src1, const ITensorInfo *sr std::pair validate_and_configure_window_complex(ITensorInfo *src1, ITensorInfo *src2, ITensorInfo *dst) { - const std::pair broadcast_pair = ITensorInfo::broadcast_shape_and_valid_region(*src1, *src2); - const TensorShape &out_shape = broadcast_pair.first; - const ValidRegion &valid_region = broadcast_pair.second; + const TensorShape &out_shape = TensorShape::broadcast_shape(src1->tensor_shape(), src2->tensor_shape()); // Auto initialize dst if not initialized const TensorInfo out_info(out_shape, src1->num_channels(), src1->data_type()); auto_init_if_empty(*dst, out_info); - Window win = calculate_max_window(valid_region, Steps(num_elems_processed_per_iteration_complex)); + Window win = calculate_max_window(out_shape, Steps(num_elems_processed_per_iteration_complex)); Window win_input1 = win.broadcast_if_dimension_le_one(*src1); Window win_input2 = win.broadcast_if_dimension_le_one(*src2); @@ -369,8 +363,6 @@ std::pair validate_and_configure_window_complex(ITensorInfo *src || update_window_and_padding(win_input2, input2_access) || update_window_and_padding(win, output_access); - output_access.set_valid_region(win, valid_region); - Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{}; return std::make_pair(err, win); } diff --git a/src/core/gpu/cl/kernels/ClPoolingKernel.cpp b/src/core/gpu/cl/kernels/ClPoolingKernel.cpp index 567fec2a37..78243402bf 100644 --- a/src/core/gpu/cl/kernels/ClPoolingKernel.cpp +++ b/src/core/gpu/cl/kernels/ClPoolingKernel.cpp @@ -177,13 +177,6 @@ std::tuple validate_and_configure_window(ITenso border_size = BorderSize(); num_elems_processed_per_iteration = adjust_vec_size(4, dst->dimension(0)); win = calculate_max_window(*dst, Steps(num_elems_processed_per_iteration)); - - if(indices != nullptr) - { - indices->set_valid_region(ValidRegion(Coordinates(), indices->tensor_shape())); - } - - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); break; } default: diff --git a/src/core/gpu/cl/kernels/ClQuantizationKernel.cpp b/src/core/gpu/cl/kernels/ClQuantizationKernel.cpp index ea56289157..ced0d14391 100644 --- a/src/core/gpu/cl/kernels/ClQuantizationKernel.cpp +++ b/src/core/gpu/cl/kernels/ClQuantizationKernel.cpp @@ -144,8 +144,6 @@ void ClQuantizationKernel::configure(const CLCompileContext &compile_context, IT } ICLKernel::configure_internal(win); - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/gpu/cl/kernels/ClReshapeKernel.cpp b/src/core/gpu/cl/kernels/ClReshapeKernel.cpp index 4da3fa0e03..cbf6d0d51a 100644 --- a/src/core/gpu/cl/kernels/ClReshapeKernel.cpp +++ b/src/core/gpu/cl/kernels/ClReshapeKernel.cpp @@ -93,9 +93,6 @@ void ClReshapeKernel::configure(const CLCompileContext &compile_context, const I // Configure kernel window Window win = calculate_max_window(*src); - - // Set the dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); diff --git a/src/core/gpu/cl/kernels/ClWidthConcatenate2TensorsKernel.cpp b/src/core/gpu/cl/kernels/ClWidthConcatenate2TensorsKernel.cpp index 6a2ab3b50f..9f970719ed 100644 --- a/src/core/gpu/cl/kernels/ClWidthConcatenate2TensorsKernel.cpp +++ b/src/core/gpu/cl/kernels/ClWidthConcatenate2TensorsKernel.cpp @@ -113,8 +113,6 @@ void ClWidthConcatenate2TensorsKernel::configure(const CLCompileContext &compile Window win = calculate_max_window(*dst, Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win.collapse(win, Window::DimZ)); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); // Set config_id for enabling LWS tuning diff --git a/src/core/gpu/cl/kernels/ClWidthConcatenate4TensorsKernel.cpp b/src/core/gpu/cl/kernels/ClWidthConcatenate4TensorsKernel.cpp index 4b49652a73..281d190381 100644 --- a/src/core/gpu/cl/kernels/ClWidthConcatenate4TensorsKernel.cpp +++ b/src/core/gpu/cl/kernels/ClWidthConcatenate4TensorsKernel.cpp @@ -131,8 +131,6 @@ void ClWidthConcatenate4TensorsKernel::configure(const CLCompileContext &compile Window win = calculate_max_window(*dst, Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win.collapse(win, Window::DimZ)); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); // Set config_id for enabling LWS tuning diff --git a/src/core/gpu/cl/kernels/ClWidthConcatenateKernel.cpp b/src/core/gpu/cl/kernels/ClWidthConcatenateKernel.cpp index 8cbbc27444..d188a5226b 100644 --- a/src/core/gpu/cl/kernels/ClWidthConcatenateKernel.cpp +++ b/src/core/gpu/cl/kernels/ClWidthConcatenateKernel.cpp @@ -105,9 +105,6 @@ void ClWidthConcatenateKernel::configure(const CLCompileContext &compile_context Window win = calculate_max_window(*src, Steps(num_elems_processed_per_iteration)); ICLKernel::configure_internal(win.collapse(win, Window::DimZ)); - // Set dst valid region - dst->set_valid_region(ValidRegion(Coordinates(), dst->tensor_shape())); - ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } -- cgit v1.2.1