From 718f347a2d886381de19420b5b5b99db8f2b7338 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Thu, 30 Nov 2023 14:18:19 +0000 Subject: 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 Change-Id: I8d25448a793375b53880da3787d8f839767f02cf --- reference_model/src/verify/verify_utils.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'reference_model/src/verify/verify_utils.h') 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 @@ -135,10 +136,17 @@ struct AccPrecision static constexpr double normal_max = const_exp2(128) - const_exp2(127 - 23); static constexpr int32_t normal_frac = 23; }; +template <> +struct AccPrecision +{ + 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 +bool tosaCheckFloatBound(OutType testValue, double referenceValue, double errorBound); }; // namespace TosaReference #endif // VERIFY_UTILS_H_ -- cgit v1.2.1