Shader tests: the legacy multiply-add's rounding case takes either rounding #1335
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1335
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1335"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@bihanikeshav on GitHub · 2026-11-26 15:56 UTC · original
bihanikeshav:legacy-mad-test-either-rounding→main· +24 −6 · 2 files · 1 commits · openProblem
legacy_mad_fuses_its_product_and_flushes_its_sourcesfails on my RTX 5060 Laptop (Blackwell, driver 610.62):Case 0 checks that
v_mad_legacy_f32rounds once. We lower it to DXILFMad, and DXIL leaves fusing that op up to the driver. NVIDIA's Ada driver fuses it (#961 ran into that from the other side). This card's driver doesn't, so the product gets rounded to 1.0 before the add and the result is +0 instead of -2^-46. WARP does the same thing, which is why the test already skipped case 0 there. #1026 was only run on WARP, so the hardware branch of that assertion never saw a card like this one.Every other case passed here. Flushing subnormal sources and the zero-factor rule both work, and those are the parts that fixed the water reflections.
Change
0xa8800000) or product rounded first (0x00000000). It prints which one it got. Any other value still fails.legacy_fmadinlower.rsnow says the fusing is asked for, not promised.No change to the translator's output.
I didn't try to force a single rounding (doing the add in f64 with round-to-odd would work). It costs several double ops per instruction, doubles are slow on consumer NVIDIA cards, and I haven't seen this last-bit difference cause anything visible. Happy to look at it if someone has a case where it matters.
Tests
On the RTX 5060 Laptop, Windows 11:
cargo test -p victory-shader --locked: 222 passed, 0 failed, 4 ignored. Before this change: 221 passed, 1 failed.--nocaptureprintshardware: FMad not fused by this host (product rounded first)and the same for warp.cargo clippy -p victory-shader --all-targets --locked -- -D warningsand the--all-featuresrun are both clean.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.