Fix a collection of random failures encountered when testing with Bazel.

This commit is contained in:
Antonio Sánchez
2025-06-26 16:58:24 +00:00
committed by Rasmus Munk Larsen
parent 0bce653efc
commit a395ee162d
12 changed files with 52 additions and 23 deletions

View File

@@ -31,6 +31,15 @@ namespace internal {
#define EIGEN_GPU_HAS_FP16_ARITHMETIC 1
#endif
// We need to distinguish clang as the CUDA compiler from clang as the host compiler,
// invoked by NVCC (e.g. on MacOS). The former needs to see both host and device implementation
// of the functions, while the latter can only deal with one of them.
#if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIPCC) || (defined(EIGEN_CUDACC) && EIGEN_COMP_CLANG && !EIGEN_COMP_NVCC)
#define EIGEN_HAS_GPU_DEVICE_FUNCTIONS 1
#else
#define EIGEN_HAS_GPU_DEVICE_FUNCTIONS 0
#endif
// Make sure this is only available when targeting a GPU: we don't want to
// introduce conflicts between these packet_traits definitions and the ones
// we'll use on the host side (SSE, AVX, ...)
@@ -74,7 +83,10 @@ struct packet_traits<float> : default_packet_traits {
HasGammaSampleDerAlpha = 1,
HasIGammac = 1,
HasBetaInc = 1,
HasBlend = 0
HasBlend = 0,
HasFloor = 1,
HasCmp = EIGEN_HAS_GPU_DEVICE_FUNCTIONS
};
};
@@ -143,10 +155,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pset1<double2>(const double& from)
return make_double2(from, from);
}
// We need to distinguish clang as the CUDA compiler from clang as the host compiler,
// invoked by NVCC (e.g. on MacOS). The former needs to see both host and device implementation
// of the functions, while the latter can only deal with one of them.
#if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIPCC) || (defined(EIGEN_CUDACC) && EIGEN_COMP_CLANG && !EIGEN_COMP_NVCC)
#if EIGEN_HAS_GPU_DEVICE_FUNCTIONS
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float bitwise_and(const float& a, const float& b) {
return __int_as_float(__float_as_int(a) & __float_as_int(b));
@@ -259,8 +268,7 @@ template <>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 pcmp_le<double2>(const double2& a, const double2& b) {
return make_double2(le_mask(a.x, b.x), le_mask(a.y, b.y));
}
#endif // defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIPCC) || (defined(EIGEN_CUDACC) && EIGEN_COMP_CLANG &&
// !EIGEN_COMP_NVCC)
#endif // EIGEN_HAS_GPU_DEVICE_FUNCTIONS
template <>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 plset<float4>(const float& a) {

View File

@@ -274,6 +274,10 @@ struct simpl_chol_helper {
}
};
// Symbol is ODR-used, so we need a definition.
template <typename Scalar, typename StorageIndex>
constexpr StorageIndex simpl_chol_helper<Scalar, StorageIndex>::kEmpty;
} // namespace internal
template <typename Derived>