From 24dbc420aae556649f50e645bd94489dab2cc75a Mon Sep 17 00:00:00 2001 From: James Ward Date: Wed, 19 Oct 2022 12:20:31 +0100 Subject: Add BF16 support to reference model * Upgrade Eigen to 3.4.0 (for bfloat16 support) and add work- arounds for reduce.any() and reduce.all() bugs (introduced between 3.3.7 and 3.4.0) * Truncation to bfloat16 now performed in eval() methods Signed-off-by: James Ward Signed-off-by: Jeremy Johnson Change-Id: If5f5c988d76d3d30790acf3b97081726b89205fe --- reference_model/src/ops/template_types.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'reference_model/src/ops/template_types.h') diff --git a/reference_model/src/ops/template_types.h b/reference_model/src/ops/template_types.h index 3de4899..647ca84 100644 --- a/reference_model/src/ops/template_types.h +++ b/reference_model/src/ops/template_types.h @@ -19,6 +19,8 @@ #include "tosa_generated.h" #include #include "half.hpp" +#include +#include "arith_util.h" using namespace tosa; @@ -76,6 +78,12 @@ struct GetEigenType using type = float; }; template <> +struct GetEigenType +{ + // NOTE: full precision used + using type = float; +}; +template <> struct GetEigenType { using type = int32_t; @@ -132,12 +140,6 @@ struct GetAccEigenType using type = typename GetEigenType::type; }; -template -struct GetHalfEigenType -{ - using type = half_float::half; -}; - // Meta function to get number of bits template struct GetNumBits -- cgit v1.2.1