Skip to content

Commit

Permalink
Address CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
e10harvey committed Oct 2, 2023
1 parent f6d2add commit 935e9bf
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions common/unit_test/Test_Common_ArithTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,20 @@ class ArithTraitsTesterBase {
}

if (AT::has_infinity) {
if (!AT::isInf(AT::infinity())) {
out << "AT::isInf (inf) != true" << endl;
FAILURE();
// Compiler intrinsic casts from inf of type half_t / bhalf_t to inf
// of type float in CUDA, SYCL and HIP do not work yet.
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_SYCL) || \
defined(KOKKOS_ENABLE_HIP)
namespace KE = Kokkos::Experimental;
if constexpr (!std::is_same<ScalarType, KE::half_t>::value &&
!std::is_same<ScalarType, KE::bhalf_t>::value) {
#else
{
#endif // KOKKOS_ENABLE_CUDA || KOKKOS_ENABLE_SYCL || KOKKOS_ENABLE_HIP
if (!AT::isInf(AT::infinity())) {
out << "AT::isInf (inf) != true" << endl;
FAILURE();
}
}
}
if (!std::is_same<ScalarType, decltype(AT::infinity())>::value) {
Expand Down Expand Up @@ -1495,13 +1506,24 @@ class ArithTraitsTesterFloatingPointBase<ScalarType, DeviceType, 0>
FAILURE();
}

if (!AT::isNan(AT::nan())) {
// Compiler intrinsic casts from nan of type half_t / bhalf_t to nan
// of type float in CUDA, SYCL and HIP do not work yet.
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_SYCL) || \
defined(KOKKOS_ENABLE_HIP)
namespace KE = Kokkos::Experimental;
if constexpr (!std::is_same<ScalarType, KE::half_t>::value &&
!std::is_same<ScalarType, KE::bhalf_t>::value) {
#else
{
#endif // KOKKOS_ENABLE_CUDA || KOKKOS_ENABLE_SYCL || KOKKOS_ENABLE_HIP
if (!AT::isNan(AT::nan())) {
#if KOKKOS_VERSION < 40199
KOKKOS_IMPL_DO_NOT_USE_PRINTF("NaN is not NaN\n");
KOKKOS_IMPL_DO_NOT_USE_PRINTF("NaN is not NaN\n");
#else
Kokkos::printf("NaN is not NaN\n");
Kokkos::printf("NaN is not NaN\n");
#endif
FAILURE();
FAILURE();
}
}

const ScalarType zero = AT::zero();
Expand Down

0 comments on commit 935e9bf

Please sign in to comment.