diff options
author | Jeremy Johnson <jeremy.johnson@arm.com> | 2024-04-11 16:21:54 +0100 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2024-04-18 15:34:50 +0000 |
commit | 1eb1455568e2a23971f2c1b7be1077a8c1494685 (patch) | |
tree | 7979b9e1eaf3e407ff493c7f4b51fcf127f6603c /reference_model/src/verify/verify_abs_error.cc | |
parent | 8753f3aa944c87e779db2d2c4ba9d9df241b87b1 (diff) | |
download | reference_model-1eb1455568e2a23971f2c1b7be1077a8c1494685.tar.gz |
Update compliance verify checks
Cope with large error bounds with small reference values.
Change how error bounds of NaN are avoided for ABS_ERRORs.
Update SIN/COS compliance to latest spec and use input value as
magnitude.
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: I55aca59e0255e1cfd255b08edb845c3e33ca7eff
Diffstat (limited to 'reference_model/src/verify/verify_abs_error.cc')
-rw-r--r-- | reference_model/src/verify/verify_abs_error.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/reference_model/src/verify/verify_abs_error.cc b/reference_model/src/verify/verify_abs_error.cc index 64f86a3..b49ce48 100644 --- a/reference_model/src/verify/verify_abs_error.cc +++ b/reference_model/src/verify/verify_abs_error.cc @@ -30,15 +30,29 @@ double calcErrorBound(double referenceValue, double boundsValue, const void* cfg { const auto cfg = reinterpret_cast<const AbsErrorVerifyInfo*>(cfgPtr); + double boundsMagnitude; + if (cfg->boundAsMagnitude) + { + // Special case for SIN/COS + // use the input value (stored in the bounds tensor) as the magnitude and value + boundsMagnitude = boundsValue; + boundsValue = std::abs(boundsValue); + } + else + { + // Use the referenceValue as the magnitude + boundsMagnitude = referenceValue; + } + double errorBound = 0.0; - if (std::isfinite(referenceValue) && std::abs(referenceValue) != 0.0) + if (std::isfinite(boundsValue) || std::abs(boundsMagnitude) != 0.0) { - double valBound = std::abs(referenceValue) * boundsValue; + double valueBound = std::abs(boundsMagnitude) * (boundsValue + cfg->boundAddition); if (cfg->lowerBound > 0) { - valBound = std::max(cfg->lowerBound, valBound); + valueBound = std::max(cfg->lowerBound, valueBound); } - errorBound = exp2(-AccPrecision<OutType>::normal_frac / cfg->normalDivisor) * valBound; + errorBound = exp2(-AccPrecision<OutType>::normal_frac / cfg->normalDivisor) * valueBound; } return errorBound; } |