diff options
author | Jeremy Johnson <jeremy.johnson@arm.com> | 2023-11-30 14:18:19 +0000 |
---|---|---|
committer | Jeremy Johnson <jeremy.johnson@arm.com> | 2023-12-04 10:02:15 +0000 |
commit | 718f347a2d886381de19420b5b5b99db8f2b7338 (patch) | |
tree | 87f6ab932029654b4e0704938dbe6ab7135da27d /reference_model/src/verify/verify_utils.h | |
parent | fe79accba2c220036c7b5ea0aa27bff5ef74ec73 (diff) | |
download | reference_model-718f347a2d886381de19420b5b5b99db8f2b7338.tar.gz |
Main Compliance FP16 support - generate and verify.
FP16 support for all existing operators for compliance:
* DOT_PRODUCT
* ULP
* EXACT
* ABS_ERROR
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
Change-Id: I8d25448a793375b53880da3787d8f839767f02cf
Diffstat (limited to 'reference_model/src/verify/verify_utils.h')
-rw-r--r-- | reference_model/src/verify/verify_utils.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/reference_model/src/verify/verify_utils.h b/reference_model/src/verify/verify_utils.h index a58950e..45daeac 100644 --- a/reference_model/src/verify/verify_utils.h +++ b/reference_model/src/verify/verify_utils.h @@ -17,6 +17,7 @@ #define VERIFY_UTILS_H_ #include "dtype.h" +#include "half.hpp" #include "types.h" #include <cstdint> @@ -135,10 +136,17 @@ struct AccPrecision<float> static constexpr double normal_max = const_exp2(128) - const_exp2(127 - 23); static constexpr int32_t normal_frac = 23; }; +template <> +struct AccPrecision<half_float::half> +{ + static constexpr double normal_min = const_exp2(-14); + static constexpr double normal_max = const_exp2(16) - const_exp2(15 - 10); + static constexpr int32_t normal_frac = 7; +}; /// \brief Error bounds check for ULP and ABS_ERROR modes -bool tosaCheckFloatBound(float testValue, double referenceValue, double errorBound); - +template <typename OutType> +bool tosaCheckFloatBound(OutType testValue, double referenceValue, double errorBound); }; // namespace TosaReference #endif // VERIFY_UTILS_H_ |