From ee714f79f7eac6ee46f4ee640133b5ee2b3ccea7 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 2 Oct 2020 21:05:35 +0000 Subject: Fix CUDA build breakage and incorrect result for absdiff on HIP with long double arguments. --- Eigen/src/Core/MathFunctions.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'Eigen/src/Core/MathFunctions.h') 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 EIGEN_DEVICE_FUNC -- cgit v1.2.3