From 7b4278627ef04fb1fb136fe2a367bb67c97218d1 Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Mon, 8 Feb 2021 13:45:19 +0000 Subject: Fix Floating Point Exception for cl_gemm_reshaped Return proper error in the examples when such cases occur Resolves: COMPMID-4237 Change-Id: I864c6f73a629a961774c7ae1cb62c28edcbed379 Signed-off-by: Manuel Bottini Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5028 Reviewed-by: Giorgio Arena Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- examples/gemm_tuner/GemmTunerHelpers.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'examples/gemm_tuner/GemmTunerHelpers.h') diff --git a/examples/gemm_tuner/GemmTunerHelpers.h b/examples/gemm_tuner/GemmTunerHelpers.h index 23cf14cf18..ae5cfbb19e 100644 --- a/examples/gemm_tuner/GemmTunerHelpers.h +++ b/examples/gemm_tuner/GemmTunerHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -31,19 +31,24 @@ namespace examples { namespace gemm_tuner_helpers { -void update_padding_for_cl_image(arm_compute::ITensorInfo *tensor) +bool update_padding_for_cl_image(arm_compute::ITensorInfo *tensor) { constexpr unsigned int num_floats_per_pixel = 4; const unsigned int stride_y_in_elements = tensor->strides_in_bytes()[1] / tensor->element_size(); const unsigned int pixel_aligment = arm_compute::get_cl_image_pitch_alignment( arm_compute::CLKernelLibrary::get().get_device()); + if(pixel_aligment == 0) + { + return false; + } const unsigned int row_pitch_alignment = pixel_aligment * num_floats_per_pixel; const unsigned int round_up_width = ((stride_y_in_elements + row_pitch_alignment - 1) / row_pitch_alignment) * row_pitch_alignment; const unsigned int padding = round_up_width - stride_y_in_elements; tensor->extend_padding(arm_compute::PaddingSize(0, padding, 0, 0)); + return true; } } // namespace gemm_tuner_helpers } // namespace examples -- cgit v1.2.1