Repository navigation
Conversation
gpu_nonfused_mad_and_mac_prevent_fma_contraction put the fused control in the same program as the mad_nf ops it checks, on the same inputs. RADV (Mesa 26.2, through vkd3d-proton) then merges the fma's v0 * v1 with the identical precise products of the mad_nf ops and rounds it twice, so the control fails although a lone v_fma_f32 is fused there. Running the control as its own program measures what it is meant to: whether the backend fuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent GPU test report on Tested
Not tested
AI use
|
|
Native Windows AMD run, the other half of Not tested (NVIDIA is above): Tested
Not tested
Run and report by Claude Code (Claude Opus 5.5). |
towiice
left a comment
There was a problem hiding this comment.
Tested:
- Hardware: NVIDIA GeForce GTX 1650 SUPER (Turing TU116, 4 GB VRAM, 32-wide subgroups / wave32, driver 610.88), Windows 11 x64 (26H2 / 10.0.26300), DXC v1.9.2609 (
01b62ad4), toolchainstable-x86_64-pc-windows-gnullvm(llvm-mingw 23.1.6). - Test command:
cargo test -p xcl --lib gpu_nonfused_mad_and_mac_prevent_fma_contraction -- --nocapture - Result: 1 passed, 0 failed (0.65 s).
Separating the v_fma_f32 control into its own isolated program avoids driver shader optimization merging with precise products while verifying hardware fused multiply-add behavior. Passes cleanly on NVIDIA Turing.
|
Full-suite run on this PR's head Tested
Not tested: AMD / wave64; no retail title (this PR changes only AI-assisted (Claude Code). |
There was a problem hiding this comment.
Tested on RDNA2 under Wine (RADV). Same result as the RX 9070 XT in the description.
Tested (head bbf6c40, and merged onto main 1ec4c98: no conflicts)
- AMD Radeon RX 6700 XT (RDNA2, gfx1031, RADV NAVI22, Mesa 26.3.1), Ryzen 7 5700X, Linux 7.3.5 (CachyOS)
- Wine: Proton Experimental 11.0-20261112 (its
files/bin/wine, kernel write watches), with its own vkd3d-proton (stock, not the #257 patch) and DXVK v3.1.1-209dxgi;VKD3D_CONFIG=ignore_shared_fence; DXC 1.9.2609 - Cross-built on Linux for
x86_64-pc-windows-msvc(clang-cl / lld-link 23.1.5, xwin SDK 10.0.26100), Rust 1.99.1, debug; the lib test binary run under Wine - On
main1ec4c98,gpu_nonfused_mad_and_mac_prevent_fma_contractionfails here:v_fma_f32 overflow control should stay fused, left2139095040(+inf), right1946157055. - At
bbf6c40it passes, and it also passes with the PR merged onto1ec4c98. So the lonev_fma_f32is fused on gfx1031 / RADV too. - Whole lib suite, one test per process (see note):
main664 ok / 4 failed / 21 ignored / 5 aborted at the #241 assertion / 1 exits with code 5 (mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares, right after its mid-list split; newer than this PR and probably the same stock-vkd3d-proton limit); PR head 644 ok / 3 failed / 21 ignored / 5 aborted. The only status change in tests present on both sides is this test, FAILED -> ok. The 3 that still fail aregpu_f64_rootsandgpu_f64_math_random(#530) andxma2_source_voice_decodes_and_manages_lifetime(#890), and all three fail onmaintoo.
Under stock vkd3d-proton, D3D12.X tests take down the test process (iface->lpVtbl == &d3d12_heap_vtbl, #241), so the suite was run one test per process: every test in the binary, each with --exact <name> --test-threads=1, compared against main the same way.
Not tested
- Windows, NVIDIA, a retail title. The full suite with a patched vkd3d-proton.
AI use
- Claude Code (Claude Opus 5.5) built the branches, ran the tests and wrote this report; I checked the results.
Update: re-run at bbf6c40 after @pablogonz12's RDNA4 result. On RDNA2 it still passes with every vkd3d-proton / dxil-spirv build I have, including the dxil-spirv master 7c048638 used there. So the difference looks like it's in RADV's RDNA4 (gfx12) backend, not in dxil-spirv.
- RX 6700 XT (gfx1031), Mesa 26.3.1 RADV (the same Mesa as the RX 9070 XT run), Proton Experimental's Wine;
--exact gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction --test-threads=1:
| vkd3d-proton | dxil-spirv | result |
|---|---|---|
| Proton Experimental's own | (Proton's) | pass 2/2 |
v3.1 + #257's patch, -Db_ndebug=true |
53aac418 (#775) |
pass 2/2 |
v3.1, no patch, -Db_ndebug=true |
53aac418 |
pass 2/2 |
v3.1 + #257's patch, -Db_ndebug=true |
7c048638 (master, as in the RDNA4 run) |
pass 3/3 |
RADV_DEBUG=shaderson gfx1031: the lone control program compiles to one fused op,v_fmac_f32_e32 v10, v3, v4(v10holdingv5, the addend).- So the PR's premise (a lone
v_fma_f32is fused) holds on gfx1031 with Mesa 26.3.1, but per the RDNA4 report it does not on gfx1201. ComparingRADV_DEBUG=shaders(ornir) for the control on the RX 9070 XT would show whether ACO splits it there.
|
Test report for head Tested
Not tested
AI use
|
|
@pablogonz12 for comparison: same Mesa 26.3.1 on RDNA2 (RX 6700 XT, gfx1031). At |
Empirical test report (bbf6c40)Hardware / environment
Commands and results
& $testExe gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction --exact --nocapture --test-threads=1
Observed behavior The selected test exercised both shaders in one test case. The non-fused MAD and MAC assertions passed for positive infinity on overflow ( Not tested The full GPU workspace suite, game smoke runs, and the RADV/vkd3d-proton configuration were omitted. AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr676-focused.log and published. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
On RADV,
gpu_nonfused_mad_and_mac_prevent_fma_contractionfails its fused control. The cause is the test's layout, not missing FMA: thev_fma_f32control sits in the same program as themad_nfops, on the same inputs. RADV merges the fma'sv0 * v1with their identicalpreciseproducts and rounds it twice. A lonev_fma_f32is fused there. This runs the control as its own program, so it checks what it is meant to check: that the backend fuses. Part of #472.How I narrowed it down (RX 9070 XT, RADV / Mesa 26.2.6, vkd3d-proton v3.1,
maindd2ae9a):FMadwithout!dx.precise(DXC 2026_09_29), and the SPIR-V that vkd3d-proton hands to RADV hasOpExtInst Fma %v0 %v1 %v2withoutNoContraction(VKD3D_SHADER_DUMP_PATH).RADV_DEBUG=shaders) there is noffmaleft: the value stored to v16 isfadd(fmul(v0, v1) // exact, v2) // exact, the same instructions as themad_nflines.V_FMA_F32line in the program, both lanes pass (0x73FFFFFF,0x28800000). With thev_mad_f32line (v12) removed but the othermad_nflines kept, it still fails, because they share thev0 * v1product.Folding an fma's product into an identical exact product is arguably a Mesa bug. A real shader with both patterns would round that fma twice on RADV. I can report it to Mesa separately. This PR only keeps the test from depending on it.
What is in it
crates/xcl/src/gpu/recomp/tests.rs:gpu_nonfused_mad_and_mac_prevent_fma_contractiontranslates and runs thev_fma_f32control as a second program on the same register state, and asserts both lanes of v16 there. The non-fused checks are unchanged.Tested
x86_64-pc-windows-gnu, debug. No Windows build.cargo test -p xcl --lib --locked --target x86_64-pc-windows-gnu -- --test-threads=4(under Wine) on this branch (main91f9a5e+ this commit): 650 passed, 2 failed, 21 ignored, 0SKIPPED. The two failures aregpu_f64_rootsandgpu_f64_math_random, which fail onmaintoo and are fixed by Recompiler: v_rcp_f64 and v_rsq_f64 keep NaN, infinities and denormals #530. Onmainthe same run also fails this test.Regression run
tests.rs), no runtime code, so nosmoke.ps1run.Not tested
mad()unfused too, the control will still fail there, which is then correct.AI use