aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2018-08-01 12:36:24 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2018-08-01 12:36:24 -0700
commit7f8b53fd0e359aa2b1a588489f31135a8c52b55f (patch)
treed5438b846204f16c27b88e36fed2272336659f99
parentbcb29f890ccdbf4922780ed5da0e23db65d7ae64 (diff)
bug #1580: Fix cuda clang build. STL is not supported, so std::equal_to and std::not_equal breaks compilation.
Update the definition of EIGEN_CONSTEXPR_ARE_DEVICE_FUNC to exclude clang. See also PR 450.
-rw-r--r--Eigen/src/Core/util/Macros.h20
-rwxr-xr-xEigen/src/Core/util/Meta.h2
2 files changed, 12 insertions, 10 deletions
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 0f3b428c9..9a2f5ab05 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -571,20 +571,19 @@
// Does the compiler fully support const expressions? (as in c++14)
#ifndef EIGEN_HAS_CONSTEXPR
-
#if defined(EIGEN_CUDACC)
// Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above
- #if EIGEN_MAX_CPP_VER>=14 && (__cplusplus > 199711L && (EIGEN_COMP_CLANG || EIGEN_CUDACC_VER >= 70500))
- #define EIGEN_HAS_CONSTEXPR 1
- #endif
+ #if EIGEN_MAX_CPP_VER>=14 && (__cplusplus > 199711L && (EIGEN_COMP_CLANG || EIGEN_CUDACC_VER >= 70500))
+ #define EIGEN_HAS_CONSTEXPR 1
+ #endif
#elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (defined(__cplusplus) && __cplusplus >= 201402L) || \
(EIGEN_GNUC_AT_LEAST(4,8) && (__cplusplus > 199711L)) || \
(EIGEN_COMP_CLANG >= 306 && (__cplusplus > 199711L)))
- #define EIGEN_HAS_CONSTEXPR 1
+ #define EIGEN_HAS_CONSTEXPR 1
#endif
#ifndef EIGEN_HAS_CONSTEXPR
- #define EIGEN_HAS_CONSTEXPR 0
+ #define EIGEN_HAS_CONSTEXPR 0
#endif
#endif // EIGEN_HAS_CONSTEXPR
@@ -643,9 +642,12 @@
#ifdef __CUDACC_RELAXED_CONSTEXPR__
#define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
#endif
- #elif defined(__clang__) && defined(__CUDA__)
- // clang++ always considers constexpr functions as implicitly __host__ __device__
- #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
+ // See bug 1580: clang/CUDA fails to make the following calls
+ // to constexpr bool std::equal_to::operator() even when
+ // EIGEN_CONSTEXPR_ARE_DEVICE_FUNC is defined in c++14 only.
+ // #elif defined(__clang__) && defined(__CUDA__) && EIGEN_HAS_CONSTEXPR == 1
+ // // clang++ always considers constexpr functions as implicitly __host__ __device__
+ // #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
#endif
#endif
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h
index 658cfa9eb..f27b8e85d 100755
--- a/Eigen/src/Core/util/Meta.h
+++ b/Eigen/src/Core/util/Meta.h
@@ -569,7 +569,7 @@ template<typename T, typename U> struct scalar_product_traits
} // end namespace internal
namespace numext {
-
+
#if defined(EIGEN_GPU_COMPILE_PHASE)
template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
#else