aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/MathFunctions.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-10-02 21:05:35 +0000
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2020-10-02 21:05:35 +0000
commitee714f79f7eac6ee46f4ee640133b5ee2b3ccea7 (patch)
treee9ca5bf9ad7a2772c604f9b14ecab3e3719717f8 /Eigen/src/Core/MathFunctions.h
parentf7b185a8b13ed2612bce306c08cb5a371e8ba347 (diff)
Fix CUDA build breakage and incorrect result for absdiff on HIP with long double arguments.
Diffstat (limited to 'Eigen/src/Core/MathFunctions.h')
-rw-r--r--Eigen/src/Core/MathFunctions.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index a5c078b3b..a727ea7ae 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -1199,17 +1199,15 @@ EIGEN_ALWAYS_INLINE double absdiff(const double& x, const double& y)
{
return fabs(x - y);
}
+
+#if !defined(EIGEN_GPUCC)
+// HIP and CUDA do not support long double.
template<>
EIGEN_DEVICE_FUNC
-EIGEN_ALWAYS_INLINE long double absdiff(const long double& x, const long double& y)
-{
-#if defined(EIGEN_HIPCC)
- // no "fabsl" on HIP yet
- return (x > y) ? x : y;
-#else
+EIGEN_ALWAYS_INLINE long double absdiff(const long double& x, const long double& y) {
return fabsl(x - y);
-#endif
}
+#endif
template<typename Scalar>
EIGEN_DEVICE_FUNC