Repository navigation
ggml-hip : add -fno-finite-math-only alongside -ffast-math - #25373
Merged
Merged
Conversation
-ffast-math implies -ffinite-math-only under ROCm/clang 22, which disables INFINITY/NaN and triggers -Wnan-infinity-disabled (errors under -Werror in CI). Re-enable infinity handling without dropping the rest of fast-math. Fixes #25361
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts ggml-hip build flags to keep -ffast-math enabled for performance while explicitly re-enabling non-finite math (INFINITY / NaN) on newer ROCm/LLVM toolchains where -ffast-math implies -ffinite-math-only, which can trigger -Wnan-infinity-disabled and break -Werror CI.
Changes:
- Add
-fno-finite-math-onlyalongside-ffast-mathfor HIP compilation to avoidINFINITY/NaN-related warnings becoming errors in CI.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
IMbackK
approved these changes
Jul 7, 2026
Collaborator
|
I think it would be nice to adjust hip-quality-check to run on all changes associated with the hip backend in future: diff --git a/.github/workflows/hip-quality-check.yml b/.github/workflows/hip-quality-check.yml
index 14b9f41a6..5d23f01cf 100644
--- a/.github/workflows/hip-quality-check.yml
+++ b/.github/workflows/hip-quality-check.yml
@@ -9,6 +9,8 @@ on:
'.github/workflows/hip-quality-check.yml',
'**/*.cu',
'**/*.cuh',
+ 'ggml/src/ggml-hip/CMakeLists.txt',
+ 'ggml/src/ggml-cuda/vendors/hip.h',
'scripts/hip/gcn-cdna-vgpr-check.py'
]
@@ -18,6 +20,8 @@ on:
'.github/workflows/hip-quality-check.yml',
'**/*.cu',
'**/*.cuh',
+ 'ggml/src/ggml-hip/CMakeLists.txt',
+ 'ggml/src/ggml-cuda/vendors/hip.h',
'scripts/hip/gcn-cdna-vgpr-check.py'
]@IMbackK do you agree? |
Contributor
|
yes, absolutely |
ORippler
added a commit
that referenced
this pull request
Jul 8, 2026
Improvement of the CI to run on all hip-related changes as a follow-up to #25373 so breakage is more likely to be caught in future
1 task done
satindergrewal
pushed a commit
to satindergrewal/llama.cpp
that referenced
this pull request
Aug 12, 2026
…25373) -ffast-math implies -ffinite-math-only under ROCm/clang 22, which disables INFINITY/NaN and triggers -Wnan-infinity-disabled (errors under -Werror in CI). Re-enable infinity handling without dropping the rest of fast-math. Fixes ggml-org#25361
satindergrewal
pushed a commit
to satindergrewal/llama.cpp
that referenced
this pull request
Aug 12, 2026
Improvement of the CI to run on all hip-related changes as a follow-up to ggml-org#25373 so breakage is more likely to be caught in future
zbrad
pushed a commit
to zbrad/llama.cpp
that referenced
this pull request
Sep 10, 2026
…25373) -ffast-math implies -ffinite-math-only under ROCm/clang 22, which disables INFINITY/NaN and triggers -Wnan-infinity-disabled (errors under -Werror in CI). Re-enable infinity handling without dropping the rest of fast-math. Fixes ggml-org#25361
zbrad
pushed a commit
to zbrad/llama.cpp
that referenced
this pull request
Sep 10, 2026
Improvement of the CI to run on all hip-related changes as a follow-up to ggml-org#25373 so breakage is more likely to be caught in future
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes #25361. PR #23862 enabled
-ffast-mathfor HIP builds. Under ROCm/LLVM 22-ffast-mathimplies-ffinite-math-only, which disablesINFINITY/ NaN and produces-Wnan-infinity-disabledwarnings. With-Werrorin CI this breaks the HIP job across all template instances that touchINFINITYincommon.cuh(return -INFINITY;,make_half2(-INFINITY, -INFINITY)).Add
-fno-finite-math-onlyalongside-ffast-mathto re-enable infinity/NaN handling while keeping the rest of fast-math. Equivalent to how CUDA builds use-use_fast_math(which does not disable infinity).Additional information
Builds clean on Strix Halo (gfx1151), ROCm 7.2.4, Ubuntu 26.04, with
-DCMAKE_HIP_FLAGS="-Werror -Wno-tautological-compare". No-Wnan-infinity-disabledwarnings, all template instances compile.Requirements