diff options
author | Antonio Sanchez <cantonios@google.com> | 2021-02-26 15:25:00 -0800 |
---|---|---|
committer | David Tellenbach <david.tellenbach@me.com> | 2021-02-27 21:32:06 +0000 |
commit | c65c2b31d49adea63d31e3ea8f5685a47018e682 (patch) | |
tree | 4bdac396ca186a374de6c86133ab1dd6dd7202b2 /Eigen | |
parent | 39a590dfb66db999ace422be51513c0f04939f09 (diff) |
Make half/bfloat16 constructor take inputs by value, fix powerpc test.
Since `numeric_limits<half>::max_exponent` is a static inline constant,
it cannot be directly passed by reference. This triggers a linker error
in recent versions of `g++-powerpc64le`.
Changing `half` to take inputs by value fixes this. Wrapping
`max_exponent` with `int(...)` to make an addressable integer also fixes this
and may help with other custom `Scalar` types down-the-road.
Also eliminated some compile warnings for powerpc.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/arch/Default/BFloat16.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/arch/Default/Half.h | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h b/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h index 37db1a6f1..64f11727f 100644 --- a/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +++ b/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h @@ -212,12 +212,18 @@ template<> EIGEN_STRONG_INLINE void pgerMMA<Packet4f, __vector_pair, false>(__vector_quad *acc, const __vector_pair& a, const Packet4f& b) { // Just for compilation + EIGEN_UNUSED_VARIABLE(acc) + EIGEN_UNUSED_VARIABLE(a) + EIGEN_UNUSED_VARIABLE(b) } template<> EIGEN_STRONG_INLINE void pgerMMA<Packet4f, __vector_pair, true>(__vector_quad *acc, const __vector_pair& a, const Packet4f& b) { // Just for compilation + EIGEN_UNUSED_VARIABLE(acc) + EIGEN_UNUSED_VARIABLE(a) + EIGEN_UNUSED_VARIABLE(b) } // This is necessary because ploadRhs for double returns a pair of vectors when MMA is enabled. diff --git a/Eigen/src/Core/arch/Default/BFloat16.h b/Eigen/src/Core/arch/Default/BFloat16.h index 81af56a3f..3c0cd39df 100644 --- a/Eigen/src/Core/arch/Default/BFloat16.h +++ b/Eigen/src/Core/arch/Default/BFloat16.h @@ -67,7 +67,7 @@ struct bfloat16 : public bfloat16_impl::bfloat16_base { : bfloat16_impl::bfloat16_base(bfloat16_impl::raw_uint16_to_bfloat16(b ? 0x3f80 : 0)) {} template<class T> - explicit EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR bfloat16(const T& val) + explicit EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR bfloat16(T val) : bfloat16_impl::bfloat16_base(bfloat16_impl::float_to_bfloat16_rtne<internal::is_integral<T>::value>(static_cast<float>(val))) {} explicit EIGEN_DEVICE_FUNC bfloat16(float f) diff --git a/Eigen/src/Core/arch/Default/Half.h b/Eigen/src/Core/arch/Default/Half.h index c91b0ce2f..3779ebc98 100644 --- a/Eigen/src/Core/arch/Default/Half.h +++ b/Eigen/src/Core/arch/Default/Half.h @@ -147,7 +147,7 @@ struct half : public half_impl::half_base { explicit EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR half(bool b) : half_impl::half_base(half_impl::raw_uint16_to_half(b ? 0x3c00 : 0)) {} template<class T> - explicit EIGEN_DEVICE_FUNC half(const T& val) + explicit EIGEN_DEVICE_FUNC half(T val) : half_impl::half_base(half_impl::float_to_half_rtne(static_cast<float>(val))) {} explicit EIGEN_DEVICE_FUNC half(float f) : half_impl::half_base(half_impl::float_to_half_rtne(f)) {} |