tests: GPU-free repro of the FMA denormal-product divergence (TEST-FMA-DENORM-PRODUCT) #1692
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1692
Loading…
Reference in a new issue
No description provided.
Delete branch "test/fma-nvidia-repro"
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?
Pull request successfully merged and closed
Claimed as: TEST-FMA-DENORM-PRODUCT (standalone claim issue #1594: #14 is at GitHub's 2,500-comment cap and rejects new comments)
What and why
whoalin1 reported on #14 (7150696174 (a), 7152027316 (c)) that on an RTX 4070 SUPER
v_fmamk_f32with an exact product of-2^-127and addend0x00ffffffreturns the addend instead of RDNA2's0x00bfffff: the driver flushes the denormal intermediate product. Nothing in the tree pinned that mix (cs_fma_fusedprobes rounding on normal products). This adds a repro that needs no GPU.tests/semantic/fixtures/ps_fma_denorm_product.asm: hand-written,v_fmamk_f32,v_fmaak_f32,v_fma_f32,v_fmac_f32on push-constant operands.tests/semantic/test_fma_denorm_product.py, 12 tests, per--fmamode:glslone GLSL.std.450Fmaper op;khroneOpFmaKHRper op withFMAKHRandSPV_KHR_fma;exactnoOpFmaKHR, everyOpFMul/OpFAdd/OpFSubNoContraction, and its 4 GLSLFmafeed onlyOpSelect;glslandkhrgive the addend, the reported NVIDIA word;exactkeeps the hardware word, also with every f32 denormal result flushed); NaN for every finite operand triple (exactunchanged).Test only: no translator change, no docs change. Whether NVIDIA's
OpFmaKHRkeeps the product has not been measured by anyone; the file only pins thatkhrleaves it to that one op. The sNaN item of 7152027316 is #1554's and is not part of this.Tested
Windows 10 22H2, Python 3.12, SPIRV-Tools from Vulkan SDK 1.4.363.0.
python -m unittest discover -s tests/semantic -p test_fma_denorm_product.py: 12 tests OK, onmain3f81d46ac (after rebase) and on c7e82e26e.python -I scripts/run_semantic_tests.py tests/semantic -j 8, same base c7e82e26e: without the commit 487 files / 6,279 tests / 0 files failed; with it 488 / 6,291 / 0 files failed. Not re-run after the rebase onto 3f81d46ac.python -I scripts/check_no_game_data.pyon both files: clean.GPUs tested: n/a (CPU interpreter only; the divergence itself was not measured on this box's RTX 2080 Ti)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: test only)🤖 Generated with Claude Code
Verified on native Windows: head
12f177867merged onto currentmainbcaa13dad(merges cleanly, test-only diff of 2 files). Windows 11 Pro 26200, CPython 3.14.4, 16 cores. No GPU, no game files.python -m unittest discover -s tests/semantic -p test_fma_denorm_product.py: 12 tests OK.test_spirv_tools_accept_every_modewas skipped: SPIRV-Tools is not on PATH on this machine.python -I scripts/run_semantic_tests.py tests/semantic(16 jobs), main + this PR: 489 files / 6,299 tests / 0 files failed. On main alone the same machine gave 488 / 6,287 / 0 failed, so this also covers the rebase the PR body says was not re-run.emit_fmain a copy oftools/rdna2spirv.pychanged so that--fma exactfalls back to GLSLFma(elif FMA_EXACT:->elif False:), run throughLEONIDA_TOOLS_DIR, 4 of the 12 tests fail (15 subtest failures): bothEmittedOpsexact checks plustest_exact_keeps_the_product_under_a_flushing_driverandtest_exact_takes_no_finite_word_from_the_driver_fma. The file guards the exact path, not only the current output.-2^-64 * 2^-63 + 0x00ffffff= (2^24 - 1 - 2^22) * 2^-149 =0x00bfffff;2^-130 + 2^-126=0x00880000;2^-130 + 0x00ffffffis the tie (2^24 - 1 + 2^19) * 2^-149, which rounds to the even0x01040000. All matchCASES.scripts/check_no_game_data.pyon both files: clean.git diff --check: clean.tests/test_text_write_line_endings.py: OK.No changes requested from me.
AI-assisted (Claude Code, Claude Opus 5.5).
Reviewed 12f1778: the new semantic test passes (12 tests; the spirv-as/val subtest skips here, so its spirv-val claim is not verified by me), and the same two files copied onto main pass too, as expected for a test-only change; test_fma_exact and test_fma_khr pass on both trees; check_no_game_data is clean. Checked the central claim: with exact's tiny-product 2^96 scaling disabled in a copy of tools/, exactly the 4 predicted exact-mode subtests fail, so the GPU-free repro really does pin the divergence. The full suite was not rerun.
AI-assisted review.
Recommendation: Merge
#1692 | head
12f177867863936c83dc49ac81f211ddb720e47d|python3 -m unittest discover -s tests/semantic -p test_fma_denorm_product.py -v| red: 12 passed | green: 12 passed | Passed on both trees. Fused results on both trees, AMD KHR skippedTest-only PR. The CPU suite exercises the fused, flushing and poisoned driver models. All 12 tests passed in both phases.
Captured 3 distinct complete SPIR-V module(s) emitted while rerunning test_fma_denorm_product.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.
Additional physical-device measurement using this PR’s fixture.translate(mode), CASES inputs and expected four words per pixel. I drew an 8×8 target for each mode/input pair with the unmodified Vulkan harness and vs_ids. On both trees RTX 5070 Ti returned the fused result in GLSL, KHR and exact modes. AMD did so in GLSL and exact, and returned skip 77 for KHR (shaderFmaFloat32 unavailable). All 64 pixels matched in every executed draw, including both subnormal products. The previously reported product flush on RTX 4070 SUPER did not reproduce on this RTX 5070 Ti and driver.
Windows Vulkan adapters: AMD Radeon(TM) Graphics (26.11.2) and NVIDIA GeForce RTX 5070 Ti (610.74).
Additional commands
vk_harness vs_ids.spv <mode>.spv <out.raw> 8 8 (VKH_SGPRS from each PR test vector)Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Native runs used Windows 11, Python 3.12.10. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Merged, thank you @GTAVIB4GTAVI! This translator PR (tests: GPU-free repro of the FMA denormal-product divergence (TEST-FMA-DENORM-PRODUCT)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.