From e9767f26cec384579b6b842757cf36d313550dfc Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 10 Jun 2025 12:53:06 +0200 Subject: [PATCH] GPU Math: Suppress compiler warnings about NaN in ffast-math --- GPU/Common/GPUCommonMath.h | 5 +++++ GPU/GPUTracking/Definitions/GPULogging.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/GPU/Common/GPUCommonMath.h b/GPU/Common/GPUCommonMath.h index 350ef173467d5..01067ca032650 100644 --- a/GPU/Common/GPUCommonMath.h +++ b/GPU/Common/GPUCommonMath.h @@ -99,7 +99,12 @@ class GPUCommonMath GPUhdi() static float Remainderf(float x, float y); GPUd() constexpr static bool Finite(float x); GPUd() constexpr static bool IsNaN(float x); +#pragma GCC diagnostic push +#if defined(__FAST_MATH__) && defined(__clang__) +#pragma GCC diagnostic ignored "-Wnan-infinity-disabled" +#endif GPUd() constexpr static float QuietNaN() { return GPUCA_CHOICE(std::numeric_limits::quiet_NaN(), __builtin_nanf(""), nan(0u)); } +#pragma GCC diagnostic pop GPUd() constexpr static uint32_t Clz(uint32_t val); GPUd() constexpr static uint32_t Popcount(uint32_t val); diff --git a/GPU/GPUTracking/Definitions/GPULogging.h b/GPU/GPUTracking/Definitions/GPULogging.h index c8ba635d1af7a..800890045ec45 100644 --- a/GPU/GPUTracking/Definitions/GPULogging.h +++ b/GPU/GPUTracking/Definitions/GPULogging.h @@ -28,7 +28,12 @@ #define GPUFatal(...) #elif defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_NO_FMT) #include + #pragma GCC diagnostic push + #if defined(__FAST_MATH__) && defined(__clang__) + #pragma GCC diagnostic ignored "-Wnan-infinity-disabled" + #endif #include + #pragma GCC diagnostic pop #define GPUInfo(string, ...) \ { \ fmt::printf(string "\n", ##__VA_ARGS__); \