From 11d73272b8df5ceb2629fb916b84c768b7c5c65a Mon Sep 17 00:00:00 2001 From: Sheri Zhang Date: Wed, 28 Oct 2020 14:01:55 +0000 Subject: COMPMID-3706: Add padding assert for kernels that don't have padding Signed-off-by: Sheri Zhang Change-Id: I0a3f0a989a4db9a2abc9c89429e94af4c6b6b366 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4274 Tested-by: Arm Jenkins Reviewed-by: Manuel Bottini Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- .../CL/kernels/CLElementWiseUnaryLayerKernel.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp') diff --git a/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp b/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp index c7f9df0baa..bff0db07a0 100644 --- a/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp +++ b/src/core/CL/kernels/CLElementWiseUnaryLayerKernel.cpp @@ -60,6 +60,9 @@ void CLElementWiseUnaryLayerKernel::configure(const ITensorInfo *input, ITensorI void CLElementWiseUnaryLayerKernel::configure(const CLCompileContext &compile_context, const ITensorInfo *input, ITensorInfo *output, const ElementWiseUnary &op) { ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + + auto padding_info = get_padding_info({ input, output }); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(*input, *output)); const std::string kernel_name = "elementwise_unary"; @@ -67,14 +70,6 @@ void CLElementWiseUnaryLayerKernel::configure(const CLCompileContext &compile_co const int output_width_x = output->tensor_shape().x(); const bool multi_access_x = (output_width_x / vec_size_x > 0); - Window win = calculate_max_window(*output); - if(multi_access_x) - { - win.set(Window::DimX, - Window::Dimension(win.x().start(), ceil_to_multiple(win.x().end(), vec_size_x), vec_size_x)); - } - ICLKernel::configure_internal(win); - // Set kernel build options CLBuildOptions build_opts; build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->data_type())); @@ -109,6 +104,17 @@ void CLElementWiseUnaryLayerKernel::configure(const CLCompileContext &compile_co // Create kernel _kernel = create_kernel(compile_context, kernel_name, build_opts.options()); + + // Configure kernel window + Window win = calculate_max_window(*output); + if(multi_access_x) + { + win.set(Window::DimX, + Window::Dimension(win.x().start(), ceil_to_multiple(win.x().end(), vec_size_x), vec_size_x)); + } + ICLKernel::configure_internal(win); + + ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } Status CLElementWiseUnaryLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ElementWiseUnary &op) -- cgit v1.2.1