aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/Validation.h
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-02-20 17:08:11 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:47:21 +0000
commit898d399a0f62c15612a52df4bff5018e783214e4 (patch)
tree059f315721bc80267bf258d2956bf2f4bec7e0f5 /tests/validation/Validation.h
parent9414f64c231a013664102e2c284b10266c6b4d4e (diff)
downloadComputeLibrary-898d399a0f62c15612a52df4bff5018e783214e4.tar.gz
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>
Diffstat (limited to 'tests/validation/Validation.h')
-rw-r--r--tests/validation/Validation.h5
1 files changed, 4 insertions, 1 deletions
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<T> &reference, const V
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);