From: Jim Wu Date: Thu, 13 Aug 2026 06:38:02 +0000 (-0700) Subject: ggml-hip : remove -funsafe-math-optimizations (#26696) X-Git-Tag: upstream/0.0.10438~33 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=e79e4bf660e19f2ad851e06c6913f7a8c5852621;p=pkg%2Fggml%2Fsources%2Fllama.cpp ggml-hip : remove -funsafe-math-optimizations (#26696) It enables -fassociative-math, which reassociates FP reductions and can flip greedy argmax on RDNA3.5 (e.g. MTP speculative decode diverging from the non-speculative baseline). Drop it so HIP builds are IEEE-conformant. Co-authored-by: Jim Wu --- diff --git a/ggml/src/ggml-hip/CMakeLists.txt b/ggml/src/ggml-hip/CMakeLists.txt index bbc51797c..47f16f56c 100644 --- a/ggml/src/ggml-hip/CMakeLists.txt +++ b/ggml/src/ggml-hip/CMakeLists.txt @@ -126,9 +126,6 @@ if (GGML_HIP_EXPORT_METRICS) set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -Rpass-analysis=kernel-resource-usage --save-temps") endif() -# Fast math for HIP, like CUDA's -use_fast_math. Not -ffast-math: that implies -ffinite-math-only, which breaks ggml's INFINITY masking and produces NaNs. -set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -funsafe-math-optimizations") - if (NOT GGML_CUDA_FA) add_compile_definitions(GGML_CUDA_NO_FA) endif()