Legacy multiply-add as RDNA 2 runs it (fused, sources flushed): faces' lips #454

Open
github-bot wants to merge 2 commits from github-bot/gh-454 into main AGit
Owner

@⁠LofisMusk on GitHub · 2026-11-27 10:31 UTC · original
LofisMusk:legacy-fma → main · +118 −8 · 5 files · 2 commits · open

Characters' lips looked pursed and pushed out on Linux under Wine (RX 7900 XTX). This came up as the follow-up to #449, once the head skin was back.

v_mac_legacy_f32 and v_mad_legacy_f32 were translated as a legacy multiply followed by an add. RDNA 2 decodes the legacy encoding as fused (v_fma_legacy_f32) and flushes its sources, keeping the legacy rule that a zero factor gives a zero product. This ports fxceless f6a09d3 (fork PR #1026).

Measured: 6,040 of the title's 25,790 shader translations change. With them the lips close and open naturally, in the same place and with the same moves as before. For comparison, the SDWA sext fix (upstream #3124) changes none of this title's translations.

The translator's output changes, so run victory shaders again (or delete the shader cache).

🤖 Generated with Claude Code

https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr

**@⁠LofisMusk** on GitHub · 2026-11-27 10:31 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/454) `LofisMusk:legacy-fma` → `main` · +118 −8 · 5 files · 2 commits · open Characters' lips looked pursed and pushed out on Linux under Wine (RX 7900 XTX). This came up as the follow-up to #449, once the head skin was back. `v_mac_legacy_f32` and `v_mad_legacy_f32` were translated as a legacy multiply followed by an add. RDNA 2 decodes the legacy encoding as fused (`v_fma_legacy_f32`) and flushes its sources, keeping the legacy rule that a zero factor gives a zero product. This ports fxceless f6a09d3 (fork PR #1026). **Measured:** 6,040 of the title's 25,790 shader translations change. With them the lips close and open naturally, in the same place and with the same moves as before. For comparison, the SDWA sext fix (upstream #3124) changes none of this title's translations. The translator's output changes, so run `victory shaders` again (or delete the shader cache). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr
The pipeline workers get a 64 MiB stack (reserved): under Wine the
DXIL to SPIR-V conversion inside the driver call can pass the default
2 MiB. VICTORY_LOG_THREADS=1 names the thread on each log line (how the
pipelines that kill a worker were found). VICTORY_KEYS also gives a
scripted run with no pad a host pad in slot 0 (diagnostics builds).

docs/linux-wine.md: what it takes on Linux (a wineserver with the view
tree, vkd3d-proton with dxil-spirv from 2026-11-25, a low
VICTORY_PIPELINE_WAIT_MS) and what was measured: 23.5-25.5 fps in
release on an RX 7900 XTX in the prison cell.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr
On Linux under Wine (RX 7900 XTX) characters' lips stood pursed and
pushed out. v_mac_legacy_f32 and v_mad_legacy_f32 were translated as a
legacy multiply then an add (two roundings, subnormals kept); RDNA 2
decodes the legacy encoding as fused (v_fma_legacy_f32) and flushes its
sources, with the legacy zero-factor rule. Ported from fxceless f6a09d3
(fork pull request #1026).

Measured: 6,040 of the title's 25,790 shader translations change; with
them the lips close and open naturally (runs h32 against h34, same
place, same moves). The SDWA sext fix (upstream #3124) changes none of
this title's translations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018VwqyDRnxhcvy1dojRs4Cr
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 10:39:04 +00:00
Author
Owner

@⁠UwUCammie on GitHub · 2026-11-27 10:54 UTC · original · edited 2026-11-27 10:56 UTC

I ran a generated v_mad_legacy_f32 fixture against this change on the RX 7900 XT with Wine 11.22, RADV 26.3.1 and vkd3d-proton 71cae091b06571e. (1 + 2^-23) * (1 - 2^-23) - 1 returned 0x00000000. The fused result is 0xa8800000 (-2^-46).

The same fixture hit this on vkd3d-proton 3.1 with the earlier fx change. Decorating the generated SPIR-V Fma with NoContraction made all four cases pass there. This is a game-free repro, so I can’t tell from it what happens to the mouth in-game.

Fixture · Earlier driver test

The follow-up on the current driver confirmed that the generated SPIR-V has one Fma and no NoContraction on its result. I added that single decoration to the fixture SPIR-V, ran spirv-val, and reran with the same executable and driver, with the driver cache disabled in both runs. All four cases passed. The override was scoped to the generated fixture. The Wine gameplay candidate is still held.

**@⁠UwUCammie** on GitHub · 2026-11-27 10:54 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/454#issuecomment-7216444516) · edited 2026-11-27 10:56 UTC I ran a generated `v_mad_legacy_f32` fixture against this change on the RX 7900 XT with Wine 11.22, RADV 26.3.1 and vkd3d-proton `71cae091b06571e`. `(1 + 2^-23) * (1 - 2^-23) - 1` returned `0x00000000`. The fused result is `0xa8800000` (`-2^-46`). The same fixture hit this on vkd3d-proton 3.1 with the earlier fx change. Decorating the generated SPIR-V `Fma` with `NoContraction` made all four cases pass there. This is a game-free repro, so I can’t tell from it what happens to the mouth in-game. [Fixture](https://github.com/UwUCammie/VIctory-7900XTX/commit/2d6dfec8) · [Earlier driver test](https://github.com/fxceless/victory-fork/pull/1026#issuecomment-7187623405) The follow-up on the current driver confirmed that the generated SPIR-V has one `Fma` and no `NoContraction` on its result. I added that single decoration to the fixture SPIR-V, ran `spirv-val`, and reran with the same executable and driver, with the driver cache disabled in both runs. All four cases passed. The override was scoped to the generated fixture. The Wine gameplay candidate is still held.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/pipeline/make.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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