diff options
author | Rasmus Munk Larsen <rmlarsen@google.com> | 2019-08-27 11:30:31 -0700 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2019-08-27 11:30:31 -0700 |
commit | b021cdea6dd84b0f51dd7aea691d47dd3eab8e9d (patch) | |
tree | fe710bcd0723cd3885e9d832cb78f6b25bda1df9 /Eigen/src/Core/arch/AVX/TypeCasting.h | |
parent | 84fefdf32155f9bbba403b44c961c437eaeac993 (diff) |
Clean up float16 a.k.a. Eigen::half support in Eigen. Move the definition of half to Core/arch/Default and move arch-specific packet ops to their respective sub-directories.
Diffstat (limited to 'Eigen/src/Core/arch/AVX/TypeCasting.h')
-rw-r--r-- | Eigen/src/Core/arch/AVX/TypeCasting.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Eigen/src/Core/arch/AVX/TypeCasting.h b/Eigen/src/Core/arch/AVX/TypeCasting.h index 7d2e1e67f..910fc06ca 100644 --- a/Eigen/src/Core/arch/AVX/TypeCasting.h +++ b/Eigen/src/Core/arch/AVX/TypeCasting.h @@ -52,6 +52,33 @@ template<> EIGEN_STRONG_INLINE Packet8f preinterpret<Packet8f,Packet8i>(const Pa return _mm256_castsi256_ps(a); } + +template <> +struct type_casting_traits<Eigen::half, float> { + enum { + VectorizedCast = 1, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + +template<> EIGEN_STRONG_INLINE Packet8f pcast<Packet8h, Packet8f>(const Packet8h& a) { + return half2float(a); +} + +template <> +struct type_casting_traits<float, Eigen::half> { + enum { + VectorizedCast = 1, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + +template<> EIGEN_STRONG_INLINE Packet8h pcast<Packet8f, Packet8h>(const Packet8f& a) { + return float2half(a); +} + } // end namespace internal } // end namespace Eigen |