Tests: run the v_fma_f32 control of the no-contraction test on its own #676

Open
github-bot wants to merge 1 commit from github-bot/gh-676 into main AGit
Owner

@⁠Tjabooo on GitHub · 2026-11-24 03:18 UTC · original
Tjabooo:tests/fma-control-own-program → main · +12 −4 · 1 files · 1 commits · open

On RADV, gpu_nonfused_mad_and_mac_prevent_fma_contraction fails its fused control. The cause is the test's layout, not missing FMA: the v_fma_f32 control sits in the same program as the mad_nf ops, on the same inputs. RADV merges the fma's v0 * v1 with their identical precise products and rounds it twice. A lone v_fma_f32 is 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, main dd2ae9a):

  • The DXIL has the control as a plain FMad without !dx.precise (DXC 2026_09_29), and the SPIR-V that vkd3d-proton hands to RADV has OpExtInst Fma %v0 %v1 %v2 without NoContraction (VKD3D_SHADER_DUMP_PATH).
  • In RADV's NIR (RADV_DEBUG=shaders) there is no ffma left: the value stored to v16 is fadd(fmul(v0, v1) // exact, v2) // exact, the same instructions as the mad_nf lines.
  • With only the V_FMA_F32 line in the program, both lanes pass (0x73FFFFFF, 0x28800000). With the v_mad_f32 line (v12) removed but the other mad_nf lines kept, it still fails, because they share the v0 * v1 product.

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_contraction translates and runs the v_fma_f32 control as a second program on the same register state, and asserts both lanes of v16 there. The non-fused checks are unchanged.

Tested

  • AMD Radeon RX 9070 XT (RDNA4, GFX1201), RADV / Mesa 26.2.6; Arch Linux; Wine 11.21; vkd3d-proton v3.1 with #257's patch; DXC 2026_09_29. Rust 1.100.0, cross-built for 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 (main 91f9a5e + this commit): 650 passed, 2 failed, 21 ignored, 0 SKIPPED. The two failures are gpu_f64_roots and gpu_f64_math_random, which fail on main too and are fixed by #530. On main the same run also fails this test.

Regression run

  • Test-only change (tests.rs), no runtime code, so no smoke.ps1 run.

Not tested

  • Windows: neither the MSVC build nor the native AMD / NVIDIA drivers. This may not fix #472's RDNA1 Windows driver: if that driver leaves a lone mad() unfused too, the control will still fail there, which is then correct.
  • NVIDIA under Wine.

AI use

  • Claude Code with Claude Opus 5.5: ran the investigation (DXIL / SPIR-V / NIR dumps), wrote the change and this description. I read the diff.
**@⁠Tjabooo** on GitHub · 2026-11-24 03:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/676) `Tjabooo:tests/fma-control-own-program` → `main` · +12 −4 · 1 files · 1 commits · open On RADV, `gpu_nonfused_mad_and_mac_prevent_fma_contraction` fails its fused control. The cause is the test's layout, not missing FMA: the `v_fma_f32` control sits in the same program as the `mad_nf` ops, on the same inputs. RADV merges the fma's `v0 * v1` with their identical `precise` products and rounds it twice. A lone `v_fma_f32` is 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, `main` `dd2ae9a`): - The DXIL has the control as a plain `FMad` without `!dx.precise` (DXC 2026_09_29), and the SPIR-V that vkd3d-proton hands to RADV has `OpExtInst Fma %v0 %v1 %v2` without `NoContraction` (`VKD3D_SHADER_DUMP_PATH`). - In RADV's NIR (`RADV_DEBUG=shaders`) there is no `ffma` left: the value stored to v16 is `fadd(fmul(v0, v1) // exact, v2) // exact`, the same instructions as the `mad_nf` lines. - With only the `V_FMA_F32` line in the program, both lanes pass (`0x73FFFFFF`, `0x28800000`). With the `v_mad_f32` line (v12) removed but the other `mad_nf` lines kept, it still fails, because they share the `v0 * v1` product. 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_contraction` translates and runs the `v_fma_f32` control as a second program on the same register state, and asserts both lanes of v16 there. The non-fused checks are unchanged. **Tested** - AMD Radeon RX 9070 XT (RDNA4, GFX1201), RADV / Mesa 26.2.6; Arch Linux; Wine 11.21; vkd3d-proton v3.1 with #257's patch; DXC 2026_09_29. Rust 1.100.0, cross-built for `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 (`main` `91f9a5e` + this commit): **650 passed, 2 failed**, 21 ignored, 0 `SKIPPED`. The two failures are `gpu_f64_roots` and `gpu_f64_math_random`, which fail on `main` too and are fixed by #530. On `main` the same run also fails this test. **Regression run** - Test-only change (`tests.rs`), no runtime code, so no `smoke.ps1` run. **Not tested** - Windows: neither the MSVC build nor the native AMD / NVIDIA drivers. This may not fix #472's RDNA1 Windows driver: if that driver leaves a lone `mad()` unfused too, the control will still fail there, which is then correct. - NVIDIA under Wine. **AI use** - Claude Code with Claude Opus 5.5: ran the investigation (DXIL / SPIR-V / NIR dumps), wrote the change and this description. I read the diff.
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 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:29:09 +00:00
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 03:38 UTC · original

Independent GPU test report on bbf6c40:

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build, DXC 1.9.2609.5 (01b62ad4)
  • Command: cargo test -p xcl --lib gpu_nonfused_mad_and_mac_prevent_fma_contraction -- --nocapture
  • Result: 1 passed, 0 failed, 0 ignored in 0.80s (gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction ok)

Not tested

  • AMD / wave64, Intel GPU, retail title

AI use

  • Antigravity (Google DeepMind agent) — fetched bbf6c40 in a detached worktree, audited the diff, ran the GPU test, and posted this report.
**@⁠lordon1a** on GitHub · 2026-11-24 03:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7121278728) Independent GPU test report on `bbf6c40`: **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build, DXC `1.9.2609.5` (`01b62ad4`) - Command: `cargo test -p xcl --lib gpu_nonfused_mad_and_mac_prevent_fma_contraction -- --nocapture` - Result: **1 passed, 0 failed, 0 ignored** in `0.80s` (`gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction` ok) **Not tested** - AMD / wave64, Intel GPU, retail title **AI use** - Antigravity (Google DeepMind agent) — fetched `bbf6c40` in a detached worktree, audited the diff, ran the GPU test, and posted this report.
Author
Owner

@⁠joeypercia on GitHub · 2026-11-24 03:39 UTC · original

Native Windows AMD run, the other half of Not tested (NVIDIA is above): bbf6c40 merged onto main 91f9a5e (clean merge).

Tested

  • AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, 32–64 lanes, no mesh shaders), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, 32 lanes); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug
  • gpu_nonfused_mad_and_mac_prevent_fma_contraction: passes on the RDNA2 iGPU and on the RTX 4070 Ti, the separate fused control included
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on the RDNA2 iGPU: 692 passed, 0 failed, 41 ignored; SKIPPED: gpu_geometry_mode_es_gs_strip, gpu_mesh_mode_two_passes (no mesh shaders)

Not tested

  • RDNA1. Note this driver build (32.0.21045.29003) is the one in #472's RX 5700 XT report, and on this RDNA2 iGPU the old combined form passes too (#472), so this adapter can't tell the two forms apart.

Run and report by Claude Code (Claude Opus 5.5).

**@⁠joeypercia** on GitHub · 2026-11-24 03:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7121303968) Native **Windows AMD** run, the other half of **Not tested** (NVIDIA is above): `bbf6c40` merged onto `main` `91f9a5e` (clean merge). **Tested** - AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, 32–64 lanes, no mesh shaders), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, 32 lanes); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug - `gpu_nonfused_mad_and_mac_prevent_fma_contraction`: passes on the RDNA2 iGPU and on the RTX 4070 Ti, the separate fused control included - `cargo test --workspace --no-fail-fast -- --test-threads=4` on the RDNA2 iGPU: 692 passed, 0 failed, 41 ignored; `SKIPPED`: `gpu_geometry_mode_es_gs_strip`, `gpu_mesh_mode_two_passes` (no mesh shaders) **Not tested** - RDNA1. Note this driver build (32.0.21045.29003) is the one in #472's RX 5700 XT report, and on this RDNA2 iGPU the old combined form passes too (#472), so this adapter can't tell the two forms apart. Run and report by Claude Code (Claude Opus 5.5).
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 05:52 UTC · original

Full-suite run on this PR's head bbf6c40, for the counts CONTRIBUTING.md item 2 asks for, on a GPU family the description doesn't cover:

Tested

  • NVIDIA GeForce RTX 3070 (driver 616.56, wave32), Ryzen 9 5950X, Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug
  • cargo build --workspace then cargo test --workspace --no-fail-fast -- --test-threads=4: 692 passed, 0 failed, 41 ignored (16 test binaries, the e2e title included)
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested: AMD / wave64; no retail title (this PR changes only gpu/recomp/tests.rs).

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-24 05:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7123355149) Full-suite run on this PR's head `bbf6c40`, for the counts CONTRIBUTING.md item 2 asks for, on a GPU family the description doesn't cover: **Tested** - NVIDIA GeForce RTX 3070 (driver 616.56, wave32), Ryzen 9 5950X, Windows 11 Pro 26100, rustc 1.100.0 MSVC, debug - `cargo build --workspace` then `cargo test --workspace --no-fail-fast -- --test-threads=4`: **692 passed, 0 failed, 41 ignored** (16 test binaries, the e2e title included) - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64) **Not tested:** AMD / wave64; no retail title (this PR changes only `gpu/recomp/tests.rs`). AI-assisted (Claude Code).
Author
Owner

@⁠pablogonz12 on GitHub · 2026-11-24 17:26 UTC · original

Test report for head bbf6c40 (based on 91f9a5e). It does not fix the test on this setup: the lone v_fma_f32 control is unfused here too.

Tested

  • AMD Radeon RX 9070 XT (RDNA4, RADV / Mesa 26.3.1), Ryzen 9 9900X, CachyOS (Linux 7.3), Wine (GE-Proton11-14), vkd3d-proton v3.1 + the #257 patch with subprojects/dxil-spirv moved to master 7c048638 (#1425), DXC 1.9.2609.5, Rust stable, release, x86_64-pc-windows-gnu, --test-threads=4.
  • gpu_nonfused_mad_and_mac_prevent_fma_contraction on this head fails at its new control: v_fma_f32 overflow control should stay fused, left 2139095040 (0x7F800000), right 1946157055 (0x73FFFFFF). Alone (--test-threads=1) it fails the same way. The non-fused asserts before it pass.
  • Whole xcl lib suite on this head: 716 passed, 6 failed, 21 ignored, 0 SKIPPED (the six: gpu_f64_roots, gpu_f64_math_random, this test, gpu_depth_buffer_created_for_unordered_access_is_placed, xma2_source_voice_decodes_and_manages_lifetime, pe::tests::parses_own_test_binary_tls). main b7aa9f3 plus a test-only commit: 714 passed, 9 failed (the same six plus three interference failures that pass alone).
  • So the result from the description (a lone fma is fused on Mesa 26.2.6) does not hold on Mesa 26.3.1 here. I did not find out why (the SPIR-V I dumped is the non-fused program, not the control).

Not tested

  • Mesa 26.2.6, Windows, NVIDIA; the NIR of the lone control.

AI use

  • Claude Code (Claude Sonnet 5.5) ran the builds and tests on my machine and wrote this report.
**@⁠pablogonz12** on GitHub · 2026-11-24 17:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7139191218) Test report for head `bbf6c40` (based on `91f9a5e`). **It does not fix the test on this setup**: the lone `v_fma_f32` control is unfused here too. **Tested** - AMD Radeon RX 9070 XT (RDNA4, RADV / Mesa 26.3.1), Ryzen 9 9900X, CachyOS (Linux 7.3), Wine (GE-Proton11-14), vkd3d-proton v3.1 + the #257 patch with `subprojects/dxil-spirv` moved to master `7c048638` (#1425), DXC 1.9.2609.5, Rust stable, release, `x86_64-pc-windows-gnu`, `--test-threads=4`. - `gpu_nonfused_mad_and_mac_prevent_fma_contraction` on this head fails at its new control: `v_fma_f32 overflow control should stay fused`, left `2139095040` (`0x7F800000`), right `1946157055` (`0x73FFFFFF`). Alone (`--test-threads=1`) it fails the same way. The non-fused asserts before it pass. - Whole `xcl` lib suite on this head: 716 passed, 6 failed, 21 ignored, 0 `SKIPPED` (the six: `gpu_f64_roots`, `gpu_f64_math_random`, this test, `gpu_depth_buffer_created_for_unordered_access_is_placed`, `xma2_source_voice_decodes_and_manages_lifetime`, `pe::tests::parses_own_test_binary_tls`). `main` `b7aa9f3` plus a test-only commit: 714 passed, 9 failed (the same six plus three interference failures that pass alone). - So the result from the description (a lone fma is fused on Mesa 26.2.6) does not hold on Mesa 26.3.1 here. I did not find out why (the SPIR-V I dumped is the non-fused program, not the control). **Not tested** - Mesa 26.2.6, Windows, NVIDIA; the NIR of the lone control. **AI use** - Claude Code (Claude Sonnet 5.5) ran the builds and tests on my machine and wrote this report.
Author
Owner

@⁠crastinator on GitHub · 2026-11-24 18:03 UTC · original

@⁠pablogonz12 for comparison: same Mesa 26.3.1 on RDNA2 (RX 6700 XT, gfx1031). At bbf6c40 the test passes with every dxil-spirv I have, your master 7c048638 included, and RADV_DEBUG=shaders shows the lone control as one v_fmac_f32. So it looks gfx12-specific. Details in my review above (edited).

**@⁠crastinator** on GitHub · 2026-11-24 18:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7140104061) @⁠pablogonz12 for comparison: same Mesa 26.3.1 on RDNA2 (RX 6700 XT, gfx1031). At `bbf6c40` the test passes with every dxil-spirv I have, your master `7c048638` included, and `RADV_DEBUG=shaders` shows the lone control as one `v_fmac_f32`. So it looks gfx12-specific. Details in my review above (edited).
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:24 UTC · original

Empirical test report (bbf6c406)

Hardware / environment

  • Commit bbf6c406e5c1b831bb7aed57400c797f6e8cc42c (PR #676).
  • Intel Arc A770, driver 32.0.101.9175. AMD Ryzen 7 3800X 8-Core Processor. Windows build 10.0.26200.9974.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), x86_64-pc-windows-msvc. DXC 1.9.2609.5 (01b62ad4) and DXIL 1.9.2609.5.
  • Cargo test profile, unoptimized, with incremental compilation and debug info disabled.

Commands and results

  • cargo test -p xcl --lib --no-run exited 0 outside the Arc lock and produced the library test executable. This step ran zero tests.
  • With XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, ran this command under the lock held by Invoke-ArcTest.ps1. $testExe denotes the executable Cargo reported.
& $testExe gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction --exact --nocapture --test-threads=1
  • The test executable and lock wrapper both exited 0. The log reported 1 passed, 0 failed, 0 ignored, 672 filtered out, and 0 skipped (case-sensitive lines beginning with SKIPPED ). The harness finished in 0.64s.

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 (0x7F800000) and positive zero on cancellation (0x00000000). The separate V_FMA_F32 dispatch used the same inputs and passed the fused-result assertions (0x73FFFFFF and 0x28800000, respectively).

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.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7154761829) ### Empirical test report (bbf6c406) **Hardware / environment** - Commit `bbf6c406e5c1b831bb7aed57400c797f6e8cc42c` (PR #676). - Intel Arc A770, driver `32.0.101.9175`. AMD Ryzen 7 3800X 8-Core Processor. Windows build `10.0.26200.9974`. - Rust `1.100.0 (0ef1bc386 2026-11-09)`, `x86_64-pc-windows-msvc`. DXC `1.9.2609.5 (01b62ad4)` and DXIL `1.9.2609.5`. - Cargo test profile, unoptimized, with incremental compilation and debug info disabled. **Commands and results** - `cargo test -p xcl --lib --no-run` exited 0 outside the Arc lock and produced the library test executable. This step ran zero tests. - With `XCL_ADAPTER=A770` and `RUST_TEST_NOCAPTURE=1`, ran this command under the lock held by `Invoke-ArcTest.ps1`. `$testExe` denotes the executable Cargo reported. ```powershell & $testExe gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction --exact --nocapture --test-threads=1 ``` - The test executable and lock wrapper both exited 0. The log reported 1 passed, 0 failed, 0 ignored, 672 filtered out, and 0 skipped (case-sensitive lines beginning with `SKIPPED `). The harness finished in 0.64s. **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 (`0x7F800000`) and positive zero on cancellation (`0x00000000`). The separate `V_FMA_F32` dispatch used the same inputs and passed the fused-result assertions (`0x73FFFFFF` and `0x28800000`, respectively). **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.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 12:10 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 12:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/676#issuecomment-7162021242) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/676/head:github-bot/gh-676'
git switch 'github-bot/gh-676'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-676'
git switch 'github-bot/gh-676'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-676'
git switch 'github-bot/gh-676'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-676'
git switch 'main'
git merge --squash 'github-bot/gh-676'
git switch 'main'
git merge --ff-only 'github-bot/gh-676'
git switch 'main'
git merge 'github-bot/gh-676'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.