mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-02 03:05:10 +08:00
Disabled some of the AVX512 primitives on compilers that don't support them
This commit is contained in:
parent
8bfe739cd2
commit
d37ee89ca8
@ -14,6 +14,9 @@ namespace Eigen {
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
// Disable the code for older versions of gcc that don't support many of the required avx512 instrinsics.
|
||||||
|
#if EIGEN_GNUC_AT_LEAST(5, 3)
|
||||||
|
|
||||||
#define _EIGEN_DECLARE_CONST_Packet16f(NAME, X) \
|
#define _EIGEN_DECLARE_CONST_Packet16f(NAME, X) \
|
||||||
const Packet16f p16f_##NAME = pset1<Packet16f>(X)
|
const Packet16f p16f_##NAME = pset1<Packet16f>(X)
|
||||||
|
|
||||||
@ -30,6 +33,7 @@ namespace internal {
|
|||||||
// Computes log(x) as log(2^e * m) = C*e + log(m), where the constant C =log(2)
|
// Computes log(x) as log(2^e * m) = C*e + log(m), where the constant C =log(2)
|
||||||
// and m is in the range [sqrt(1/2),sqrt(2)). In this range, the logarithm can
|
// and m is in the range [sqrt(1/2),sqrt(2)). In this range, the logarithm can
|
||||||
// be easily approximated by a polynomial centered on m=1 for stability.
|
// be easily approximated by a polynomial centered on m=1 for stability.
|
||||||
|
#if defined(EIGEN_VECTORIZE_AVX512DQ)
|
||||||
template <>
|
template <>
|
||||||
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet16f
|
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet16f
|
||||||
plog<Packet16f>(const Packet16f& _x) {
|
plog<Packet16f>(const Packet16f& _x) {
|
||||||
@ -118,6 +122,7 @@ plog<Packet16f>(const Packet16f& _x) {
|
|||||||
return _mm512_mask_blend_ps(iszero_mask, p16f_minus_inf,
|
return _mm512_mask_blend_ps(iszero_mask, p16f_minus_inf,
|
||||||
_mm512_mask_blend_ps(invalid_mask, p16f_nan, x));
|
_mm512_mask_blend_ps(invalid_mask, p16f_nan, x));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Exponential function. Works by writing "x = m*log(2) + r" where
|
// Exponential function. Works by writing "x = m*log(2) + r" where
|
||||||
// "m = floor(x/log(2)+1/2)" and "r" is the remainder. The result is then
|
// "m = floor(x/log(2)+1/2)" and "r" is the remainder. The result is then
|
||||||
@ -382,6 +387,7 @@ EIGEN_STRONG_INLINE Packet16f prsqrt<Packet16f>(const Packet16f& x) {
|
|||||||
return _mm512_rsqrt28_ps(x);
|
return _mm512_rsqrt28_ps(x);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
|
@ -54,14 +54,17 @@ template<> struct packet_traits<float> : default_packet_traits
|
|||||||
AlignedOnScalar = 1,
|
AlignedOnScalar = 1,
|
||||||
size = 16,
|
size = 16,
|
||||||
HasHalfPacket = 1,
|
HasHalfPacket = 1,
|
||||||
HasLog = 1,
|
|
||||||
HasExp = 1,
|
|
||||||
HasDiv = 1,
|
HasDiv = 1,
|
||||||
HasBlend = 1,
|
HasBlend = 0,
|
||||||
|
#if EIGEN_GNUC_AT_LEAST(5, 3)
|
||||||
|
#ifdef EIGEN_VECTORIZE_AVX512DQ
|
||||||
|
HasLog = 1,
|
||||||
|
#endif
|
||||||
|
HasExp = 1,
|
||||||
HasSqrt = 1,
|
HasSqrt = 1,
|
||||||
HasRsqrt = 1,
|
HasRsqrt = 1,
|
||||||
HasSelect = 1,
|
#endif
|
||||||
HasEq = 1
|
HasSelect = 1
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
template<> struct packet_traits<double> : default_packet_traits
|
template<> struct packet_traits<double> : default_packet_traits
|
||||||
@ -73,13 +76,11 @@ template<> struct packet_traits<double> : default_packet_traits
|
|||||||
AlignedOnScalar = 1,
|
AlignedOnScalar = 1,
|
||||||
size = 8,
|
size = 8,
|
||||||
HasHalfPacket = 1,
|
HasHalfPacket = 1,
|
||||||
HasExp = 0,
|
#if EIGEN_GNUC_AT_LEAST(5, 3)
|
||||||
HasDiv = 1,
|
|
||||||
HasBlend = 1,
|
|
||||||
HasSqrt = 1,
|
HasSqrt = 1,
|
||||||
HasRsqrt = EIGEN_FAST_MATH,
|
HasRsqrt = EIGEN_FAST_MATH,
|
||||||
HasSelect = 1,
|
#endif
|
||||||
HasEq = 1
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user