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 <georgios.pinitas@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index 651b7e5..8ed22c2 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -363,7 +363,10 @@
const T &target_value = reinterpret_cast<const T *>(tensor(id))[c];
const T &reference_value = reinterpret_cast<const T *>(reference(id))[c];
- if(!compare<U>(target_value, reference_value, tolerance_value))
+ // Truncate numbers to the 4th decimal
+ const T target_truncated_value = static_cast<T>(static_cast<int>(target_value * 10000) / 10000);
+ const T reference_truncated_value = static_cast<T>(static_cast<int>(target_value * 10000) / 10000);
+ if(!compare<U>(target_truncated_value, reference_truncated_value, tolerance_value))
{
ARM_COMPUTE_TEST_INFO("id = " << id);
ARM_COMPUTE_TEST_INFO("channel = " << c);