Shaders: emit the valid DXIL intrinsic for f64 FMA #202

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

@⁠loyodea on GitHub · 2026-11-25 21:33 UTC · original
loyodea:shader-f64-fma-dxil → main · +30 −1 · 2 files · 1 commits · open

Double-precision fused multiply-add emitted a declaration that DXIL validation rejects. Use the canonical dx.op.tertiary.f64 entry point for opcode 47 and retain the existing double-precision flags. The regression puts all operands and the destination in disjoint registers and includes cancellation that distinguishes one rounding from separate multiply and add operations.

Tested

  • Windows 11 Pro build 26300, Ryzen 7 5700X3D, Radeon RX 9060 XT driver 32.0.32029.2010, and WARP. Debug with Rust 1.100.0 GNU x64 and DXIL validator 1.9.2609.5.
  • cargo test --locked --jobs 4 -p victory-shader --lib v_fma_f64_rounds_once -- --test-threads=1 --show-output reproduced the validator error before the fix. With the fix all 12 result-word checks passed, six on hardware and six on WARP.
  • The full victory-shader package run reported 281 passed, 0 failed, and 7 ignored. Four compiler-dependent checks returned early because the optional compilers were unavailable.
  • git diff --check passed. The asset-policy check still flags lower.rs for exceeding the 512 KiB file limit, which it already exceeded at upstream base 4f62c2a.

Retail titles, frame rate, the pinned MSVC toolchain, and other GPU drivers remain unverified. The tests use original synthetic shaders.

AI use

OpenAI Codex with GPT-6.2 Sol (extra-high reasoning for the implementation and final checks) wrote the fix, verified the regression, and ran the tests.

**@⁠loyodea** on GitHub · 2026-11-25 21:33 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/202) `loyodea:shader-f64-fma-dxil` → `main` · +30 −1 · 2 files · 1 commits · open Double-precision fused multiply-add emitted a declaration that DXIL validation rejects. Use the canonical `dx.op.tertiary.f64` entry point for opcode 47 and retain the existing double-precision flags. The regression puts all operands and the destination in disjoint registers and includes cancellation that distinguishes one rounding from separate multiply and add operations. **Tested** - Windows 11 Pro build 26300, Ryzen 7 5700X3D, Radeon RX 9060 XT driver 32.0.32029.2010, and WARP. Debug with Rust 1.100.0 GNU x64 and DXIL validator 1.9.2609.5. - `cargo test --locked --jobs 4 -p victory-shader --lib v_fma_f64_rounds_once -- --test-threads=1 --show-output` reproduced the validator error before the fix. With the fix all 12 result-word checks passed, six on hardware and six on WARP. - The full `victory-shader` package run reported 281 passed, 0 failed, and 7 ignored. Four compiler-dependent checks returned early because the optional compilers were unavailable. - `git diff --check` passed. The asset-policy check still flags `lower.rs` for exceeding the 512 KiB file limit, which it already exceeded at upstream base `4f62c2a`. Retail titles, frame rate, the pinned MSVC toolchain, and other GPU drivers remain unverified. The tests use original synthetic shaders. **AI use** OpenAI Codex with GPT-6.2 Sol (extra-high reasoning for the implementation and final checks) wrote the fix, verified the regression, and ran the tests.
Opcode 47 belongs to dx.op.tertiary.f64. Use its canonical declaration and cover both result words with an original synthetic fused-rounding test on hardware and WARP.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:37:52 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-26 05:00 UTC · original

RDNA2 data point. This PR (3b26bce) merged on main 4f62c2a, cargo test --release -p victory-shader --lib on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1):

  • main: 275 passed, 2 failed.
  • This PR: 276 passed, 2 failed, in 2 runs out of 2. The new test passes on the hardware adapter.

The 2 failures are the same as on main: the RDNA2 wave-size tests scalar_counted_in_a_divergent_loop_read_after_it and scalar_counted_in_nested_divergent_loops, fixed by #110 and #204. No regression here. Not run in the game.

harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-26 05:00 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/202#issuecomment-7183090535) RDNA2 data point. This PR (`3b26bce`) merged on `main` `4f62c2a`, `cargo test --release -p victory-shader --lib` on an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1): - `main`: 275 passed, 2 failed. - This PR: 276 passed, 2 failed, in 2 runs out of 2. The new test passes on the hardware adapter. The 2 failures are the same as on `main`: the RDNA2 wave-size tests `scalar_counted_in_a_divergent_loop_read_after_it` and `scalar_counted_in_nested_divergent_loops`, fixed by #110 and #204. No regression here. Not run in the game. harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300 AI-assisted (Claude Code); no game data.
Author
Owner

@⁠loyodea on GitHub · 2026-11-26 18:53 UTC · original

Thanks for running this twice on the RX 6950 XT. Both runs passed the new fused-rounding regression and reproduced the same two baseline wave-size failures tracked in #110 and #204.

**@⁠loyodea** on GitHub · 2026-11-26 18:53 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/202#issuecomment-7200957627) Thanks for running this twice on the RX 6950 XT. Both runs passed the new fused-rounding regression and reproduced the same two baseline wave-size failures tracked in #110 and #204.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 19:48 UTC · original

Tested on a different GPU, plus a full-title shader run.

Setup: Windows 11 26300, RX 7900 XT (RDNA3), driver 32.0.32029.2010, Rust 1.98.1. Head 3b26bce on base 4f62c2a.

  • v_fma_f64_rounds_once with the fix: all 12 checks pass, 6 on the RX 7900 XT and 6 on WARP. Without the fix on 4f62c2a it fails DXIL validation with the same 'dx.op.fma.f64' is not a DXILOpFuncition for DXILOpcode 'Fma' error.
  • cargo test -p victory-shader --lib -- --test-threads=1: 278 passed, 0 failed, 6 ignored. 4f62c2a gives 277/0/6, so the only difference is the new test.
  • translate --validate --host-lanes 32-64 over the full GTA VI shaders.rpf (26084 programs): the output is identical to 4f62c2a. All 25623 per-program DXIL hashes match, and so do the validation counts, the refusals and the IR instruction total.
  • The reason is that the archive contains no v_fma_f64. shader-info --disasm finds only two f64 VALU instructions: v_add_f64 (5 programs) and v_cvt_f32_f64 (5 programs).

So on RDNA3 the new declaration passes validation and gives single-rounding results, but it has no effect on this game's shaders. Not tested: other titles, in-game rendering, and the tests outside --lib.

**@⁠adrianmjim** on GitHub · 2026-11-26 19:48 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/202#issuecomment-7201978660) Tested on a different GPU, plus a full-title shader run. Setup: Windows 11 26300, RX 7900 XT (RDNA3), driver 32.0.32029.2010, Rust 1.98.1. Head 3b26bce on base 4f62c2a. - `v_fma_f64_rounds_once` with the fix: all 12 checks pass, 6 on the RX 7900 XT and 6 on WARP. Without the fix on 4f62c2a it fails DXIL validation with the same `'dx.op.fma.f64' is not a DXILOpFuncition for DXILOpcode 'Fma'` error. - `cargo test -p victory-shader --lib -- --test-threads=1`: 278 passed, 0 failed, 6 ignored. 4f62c2a gives 277/0/6, so the only difference is the new test. - `translate --validate --host-lanes 32-64` over the full GTA VI `shaders.rpf` (26084 programs): the output is identical to 4f62c2a. All 25623 per-program DXIL hashes match, and so do the validation counts, the refusals and the IR instruction total. - The reason is that the archive contains no `v_fma_f64`. `shader-info --disasm` finds only two f64 VALU instructions: `v_add_f64` (5 programs) and `v_cvt_f32_f64` (5 programs). So on RDNA3 the new declaration passes validation and gives single-rounding results, but it has no effect on this game's shaders. Not tested: other titles, in-game rendering, and the tests outside `--lib`.
This pull request can be merged automatically.
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/202/head:github-bot/gh-202'
git switch 'github-bot/gh-202'

Merge

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