Skip to content

Commit ad782f9

Browse files
committed
Hide NaN code with -ffast-math
1 parent 3fa3fe8 commit ad782f9

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Common/ML/include/ML/3rdparty/GPUORTFloat16.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,11 @@ GPUdi() uint16_t BFloat16Impl<Derived>::ToUint16Impl(float v) noexcept
568568
template <class Derived>
569569
GPUdi() float BFloat16Impl<Derived>::ToFloatImpl() const noexcept
570570
{
571+
#ifndef __FAST_MATH__
571572
if (IsNaN()) {
572573
return o2::gpu::CAMath::QuietNaN();
573574
}
575+
#endif
574576
float result;
575577
char* const first = reinterpret_cast<char*>(&result);
576578
char* const second = first + sizeof(uint16_t);

GPU/Common/GPUCommonMath.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,9 @@ class GPUCommonMath
9999
GPUhdi() static float Remainderf(float x, float y);
100100
GPUd() constexpr static bool Finite(float x);
101101
GPUd() constexpr static bool IsNaN(float x);
102-
#pragma GCC diagnostic push
103-
#if defined(__FAST_MATH__) && defined(__clang__)
104-
#pragma GCC diagnostic ignored "-Wnan-infinity-disabled"
105-
#endif
102+
#ifndef __FAST_MATH__
106103
GPUd() constexpr static float QuietNaN() { return GPUCA_CHOICE(std::numeric_limits<float>::quiet_NaN(), __builtin_nanf(""), nan(0u)); }
107-
#pragma GCC diagnostic pop
104+
#endif
108105
GPUd() constexpr static uint32_t Clz(uint32_t val);
109106
GPUd() constexpr static uint32_t Popcount(uint32_t val);
110107

0 commit comments

Comments
 (0)