Enable more generic packet ops for double.

See merge request libeigen/eigen!2050
This commit is contained in:
Rasmus Munk Larsen
2025-10-30 19:14:43 +00:00
parent fb5bb3e98f
commit ce70a507c0
7 changed files with 27 additions and 9 deletions

View File

@@ -25,8 +25,8 @@ EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet8f)
EIGEN_DOUBLE_PACKET_FUNCTION(atanh, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(atanh, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(log, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(log, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(log2, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(exp, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(exp, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(log2, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(tanh, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(tanh, Packet4d)
EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, Packet4d) EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, Packet4d)
#ifdef EIGEN_VECTORIZE_AVX2 #ifdef EIGEN_VECTORIZE_AVX2
@@ -35,6 +35,8 @@ EIGEN_DOUBLE_PACKET_FUNCTION(cos, Packet4d)
#endif #endif
EIGEN_GENERIC_PACKET_FUNCTION(atan, Packet4d) EIGEN_GENERIC_PACKET_FUNCTION(atan, Packet4d)
EIGEN_GENERIC_PACKET_FUNCTION(exp2, Packet4d) EIGEN_GENERIC_PACKET_FUNCTION(exp2, Packet4d)
EIGEN_GENERIC_PACKET_FUNCTION(expm1, Packet4d)
EIGEN_GENERIC_PACKET_FUNCTION(log1p, Packet4d)
// Notice that for newer processors, it is counterproductive to use Newton // Notice that for newer processors, it is counterproductive to use Newton
// iteration for square root. In particular, Skylake and Zen2 processors // iteration for square root. In particular, Skylake and Zen2 processors

View File

@@ -115,9 +115,9 @@ struct packet_traits<float> : default_packet_traits {
HasATan = 1, HasATan = 1,
HasATanh = 1, HasATanh = 1,
HasLog = 1, HasLog = 1,
HasExp = 1,
HasLog1p = 1, HasLog1p = 1,
HasExpm1 = 1, HasExpm1 = 1,
HasExp = 1,
HasPow = 1, HasPow = 1,
HasNdtri = 1, HasNdtri = 1,
HasBessel = 1, HasBessel = 1,
@@ -146,10 +146,12 @@ struct packet_traits<double> : default_packet_traits {
HasCos = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH,
#endif #endif
HasTanh = EIGEN_FAST_MATH, HasTanh = EIGEN_FAST_MATH,
HasLog = 1,
HasErf = 1, HasErf = 1,
HasErfc = 1, HasErfc = 1,
HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasPow = 1, HasPow = 1,
HasSqrt = 1, HasSqrt = 1,
HasRsqrt = 1, HasRsqrt = 1,

View File

@@ -159,6 +159,8 @@ struct packet_traits<double> : default_packet_traits {
HasCos = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH,
HasLog = 1, HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasPow = 1, HasPow = 1,
HasATan = 1, HasATan = 1,
HasTanh = EIGEN_FAST_MATH, HasTanh = EIGEN_FAST_MATH,

View File

@@ -184,6 +184,8 @@ struct packet_traits<float> : default_packet_traits {
HasATanh = 1, HasATanh = 1,
HasLog = 1, HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
#ifdef EIGEN_VECTORIZE_VSX #ifdef EIGEN_VECTORIZE_VSX
HasCmp = 1, HasCmp = 1,
HasPow = 1, HasPow = 1,
@@ -3176,9 +3178,11 @@ struct packet_traits<double> : default_packet_traits {
HasErfc = EIGEN_FAST_MATH, HasErfc = EIGEN_FAST_MATH,
HasATanh = 1, HasATanh = 1,
HasATan = 0, HasATan = 0,
HasLog = 0,
HasCmp = 1, HasCmp = 1,
HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasSqrt = 1, HasSqrt = 1,
HasCbrt = 1, HasCbrt = 1,
#if !EIGEN_COMP_CLANG #if !EIGEN_COMP_CLANG

View File

@@ -210,16 +210,18 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet generic_round(const Packet& a);
EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET)
#define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET) \ #define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(atanh, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(sin, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(sin, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(cos, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(cos, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(log, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(log2, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(log2, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(exp, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(exp, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(tanh, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(tanh, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(atanh, PACKET) \
EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, PACKET) \ EIGEN_DOUBLE_PACKET_FUNCTION(cbrt, PACKET) \
EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET) \ EIGEN_GENERIC_PACKET_FUNCTION(expm1, PACKET) \
EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET) EIGEN_GENERIC_PACKET_FUNCTION(exp2, PACKET) \
EIGEN_GENERIC_PACKET_FUNCTION(log1p, PACKET) \
EIGEN_GENERIC_PACKET_FUNCTION(atan, PACKET)
} // end namespace internal } // end namespace internal
} // end namespace Eigen } // end namespace Eigen

View File

@@ -204,6 +204,8 @@ struct packet_traits<float> : default_packet_traits {
HasATanh = 1, HasATanh = 1,
HasLog = 1, HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasPow = 1, HasPow = 1,
HasSqrt = 1, HasSqrt = 1,
HasRsqrt = 1, HasRsqrt = 1,
@@ -5050,6 +5052,8 @@ struct packet_traits<double> : default_packet_traits {
#if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG
HasExp = 1, HasExp = 1,
HasLog = 1, HasLog = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasPow = 1, HasPow = 1,
HasATan = 1, HasATan = 1,
HasATanh = 1, HasATanh = 1,

View File

@@ -218,10 +218,12 @@ struct packet_traits<double> : default_packet_traits {
HasSin = EIGEN_FAST_MATH, HasSin = EIGEN_FAST_MATH,
HasCos = EIGEN_FAST_MATH, HasCos = EIGEN_FAST_MATH,
HasTanh = EIGEN_FAST_MATH, HasTanh = EIGEN_FAST_MATH,
HasLog = 1,
HasErf = EIGEN_FAST_MATH, HasErf = EIGEN_FAST_MATH,
HasErfc = EIGEN_FAST_MATH, HasErfc = EIGEN_FAST_MATH,
HasLog = 1,
HasExp = 1, HasExp = 1,
HasLog1p = 1,
HasExpm1 = 1,
HasPow = 1, HasPow = 1,
HasSqrt = 1, HasSqrt = 1,
HasRsqrt = 1, HasRsqrt = 1,