aboutsummaryrefslogtreecommitdiff
path: root/examples/gemm_tuner/GemmTunerHelpers.h
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2021-02-08 13:45:19 +0000
committerManuel Bottini <manuel.bottini@arm.com>2021-02-09 13:46:56 +0000
commit7b4278627ef04fb1fb136fe2a367bb67c97218d1 (patch)
treef0cdf2c6673b20fe079c8ef5bcc77fecc9f25831 /examples/gemm_tuner/GemmTunerHelpers.h
parentbbd8fac8e0cd6a403ddb6262be84f15a25f5cb3e (diff)
downloadComputeLibrary-7b4278627ef04fb1fb136fe2a367bb67c97218d1.tar.gz
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 <manuel.bottini@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5028 Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'examples/gemm_tuner/GemmTunerHelpers.h')
-rw-r--r--examples/gemm_tuner/GemmTunerHelpers.h9
1 files changed, 7 insertions, 2 deletions
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