Skip to content

Commit e9767f2

Browse files
committed
GPU Math: Suppress compiler warnings about NaN in ffast-math
1 parent 69bdaa0 commit e9767f2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

GPU/Common/GPUCommonMath.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ 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
102106
GPUd() constexpr static float QuietNaN() { return GPUCA_CHOICE(std::numeric_limits<float>::quiet_NaN(), __builtin_nanf(""), nan(0u)); }
107+
#pragma GCC diagnostic pop
103108
GPUd() constexpr static uint32_t Clz(uint32_t val);
104109
GPUd() constexpr static uint32_t Popcount(uint32_t val);
105110

GPU/GPUTracking/Definitions/GPULogging.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
#define GPUFatal(...)
2929
#elif defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_NO_FMT)
3030
#include <cstdio>
31+
#pragma GCC diagnostic push
32+
#if defined(__FAST_MATH__) && defined(__clang__)
33+
#pragma GCC diagnostic ignored "-Wnan-infinity-disabled"
34+
#endif
3135
#include <fmt/printf.h>
36+
#pragma GCC diagnostic pop
3237
#define GPUInfo(string, ...) \
3338
{ \
3439
fmt::printf(string "\n", ##__VA_ARGS__); \

0 commit comments

Comments
 (0)