aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2021-01-08 17:14:39 +0000
committerManuel Bottini <manuel.bottini@arm.com>2021-01-11 15:52:33 +0000
commit4f77ba9f2dccbae1b46b2d4e17d862560f858050 (patch)
treea14347d2ff8625452742e6fe340bf9fe569d9a02 /src/core/CL/kernels/CLROIAlignLayerKernel.cpp
parent4f8ce13e287867a699b4020583173339570e1917 (diff)
downloadComputeLibrary-4f77ba9f2dccbae1b46b2d4e17d862560f858050.tar.gz
Remove OpenCL padding: CLROIAlignLayerKernel
Add padding checks in configure Resolves: COMPMID-3914 Change-Id: Ia5be67283402d8811ceb3007be3a666ab502d775 Signed-off-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4787 Tested-by: Arm Jenkins <bsgcomp@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/CLROIAlignLayerKernel.cpp')
-rw-r--r--src/core/CL/kernels/CLROIAlignLayerKernel.cpp37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/core/CL/kernels/CLROIAlignLayerKernel.cpp b/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
index 38eafc6e97..87f4a5d7f3 100644
--- a/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
+++ b/src/core/CL/kernels/CLROIAlignLayerKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020 Arm Limited.
+ * Copyright (c) 2018-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -76,27 +76,6 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *rois, ITe
return Status{};
}
-std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *rois, ITensorInfo *output, const ROIPoolingLayerInfo &pool_info)
-{
- ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
-
- // Output auto inizialitation if not yet initialized
- const TensorShape output_shape = compute_roi_align_shape(*input, *rois, pool_info);
- auto_init_if_empty((*output), output_shape, 1, input->data_type());
- output->set_data_layout(input->data_layout());
-
- // Configure kernel window
- constexpr unsigned int num_elems_processed_per_iteration = 1;
- Window win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration));
-
- 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{};
- return std::make_pair(err, win);
-}
} // namespace
CLROIAlignLayerKernel::CLROIAlignLayerKernel()
@@ -114,9 +93,12 @@ void CLROIAlignLayerKernel::configure(const CLCompileContext &compile_context, c
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output, rois);
ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), rois->info(), output->info(), pool_info));
- // Configure kernel window
- auto win_config = validate_and_configure_window(input->info(), rois->info(), output->info(), pool_info);
- ARM_COMPUTE_ERROR_THROW_ON(win_config.first);
+ // Output auto inizialitation if not yet initialized
+ const TensorShape output_shape = compute_roi_align_shape(*input->info(), *rois->info(), pool_info);
+ auto_init_if_empty(*output->info(), output_shape, 1, input->info()->data_type());
+ output->info()->set_data_layout(input->info()->data_layout());
+
+ auto padding_info = get_padding_info({ input, rois, output });
_input = input;
_output = output;
@@ -157,7 +139,10 @@ void CLROIAlignLayerKernel::configure(const CLCompileContext &compile_context, c
const std::string kernel_name = (is_qasymm) ? "roi_align_layer_quantized" : "roi_align_layer";
_kernel = create_kernel(compile_context, kernel_name, build_opts.options());
- ICLKernel::configure_internal(win_config.second);
+ // Configure kernel window
+ Window win = calculate_max_window(*output->info(), Steps());
+ ICLKernel::configure_internal(win);
+ ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info));
}
Status CLROIAlignLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *rois, ITensorInfo *output, const ROIPoolingLayerInfo &pool_info)