From 898d399a0f62c15612a52df4bff5018e783214e4 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Tue, 20 Feb 2018 17:08:11 +0000 Subject: COMPMID-945: Fix GEMM CL FP32 mismatch The mismatch is due to loss of precision of the FMA operations when dealing with large matrices containing small values. The solution proposed in this patch modifies the validation method so that for floating point value, the number is truncated to the 4th decimal value. Change-Id: I4a206a023cbcc23971e4988a554217677e3a96ad Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/121375 Reviewed-by: Georgios Pinitas Tested-by: Jenkins Reviewed-by: Anthony Barbier --- tests/validation/Validation.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/validation/Validation.h') diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h index 651b7e5b3c..8ed22c29dc 100644 --- a/tests/validation/Validation.h +++ b/tests/validation/Validation.h @@ -363,7 +363,10 @@ void validate(const IAccessor &tensor, const SimpleTensor &reference, const V const T &target_value = reinterpret_cast(tensor(id))[c]; const T &reference_value = reinterpret_cast(reference(id))[c]; - if(!compare(target_value, reference_value, tolerance_value)) + // Truncate numbers to the 4th decimal + const T target_truncated_value = static_cast(static_cast(target_value * 10000) / 10000); + const T reference_truncated_value = static_cast(static_cast(target_value * 10000) / 10000); + if(!compare(target_truncated_value, reference_truncated_value, tolerance_value)) { ARM_COMPUTE_TEST_INFO("id = " << id); ARM_COMPUTE_TEST_INFO("channel = " << c); -- cgit v1.2.1