Translate scalar conditional moves (s_cmov_b32, s_cmov_b64, s_cmovk_i32) #3389

Open
github-bot wants to merge 5 commits from github-bot/gh-3389 into main AGit
Owner

@⁠xiepeixuan on GitHub · 2026-11-29 22:42 UTC · original
xiepeixuan:auto/s-cmovk-i32 → main · +151 −2 · 3 files · 5 commits · open

No issue in this repo. Related upstream: Marvisak/VIctory#91, #1649.

What it changes

The RDNA 2 ISA, §§5.5, 12.2 and 12.3 specifies that these moves read SCC without writing it: when SCC is set, copy the source (sign-extend the immediate for s_cmovk_i32); otherwise, keep the old destination.

s_cmov_b32 and s_cmovk_i32 each emit one i32 select. s_cmov_b64 emits one per dword, using the same SCC and sign-extending negative inline integers into the high dword. This matches fold.rs's split into two b32 moves. No branch, wave operation, or DXIL INT64 requirement is added. The decoder, IR, resource tracing, fold logic, and cache settings are unchanged.

Design follows Marvisak/VIctory#1649 by geiyiliyabumo. See #1649 and tedin7's related #91.

Expected effect on NVIDIA

Tier A — shader refusal. A shader that uses one of these scalar move results can now translate instead of dropping its draw or dispatch. This is reproduced with synthetic shaders. No in-game frequency or visual effect was measured.

How it was tested

  • GPU: none for the regression. Four CPU-evaluated GFX10 tests cover Wave32 and Wave64, both SCC values, unchanged SCC (including a zero move), both dwords of a register pair, inline -2 for b64, and immediate -17 for cmovk.
  • Main 41adb55167fa778fcaa5dc36fa18a1fa8dacd657 plus tests only (da0ac9b687e0570181fba499630d8221ea0b96f6): all four failed with Unsupported on Linux and Windows, exit 101.
  • Exact fix 9d0a44ad5b5a38441c0b6948f26131d6ea9955d6: all four passed. Linux suite: 295 → 299 passed, 0 failed, 2 ignored. Windows suite: 457 → 461 passed, with the same five device-availability failures and nine ignored on both. Excluding only those five: 461 passed, 0 failed. Windows cargo check --workspace --locked passed at both SHAs.
  • Rollback restored the main emitter in a separate checkout and reproduced all four refusals.

Checked for overlap

  • Searched 1,565 all-state PR titles and bodies, checked 88 pinned open diffs through the affected files, and reread #1138. No other VIctory-NVIDIA PR ports #91 or #1649.

AI-assisted (Codex). Not run in the game.

**@⁠xiepeixuan** on GitHub · 2026-11-29 22:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3389) `xiepeixuan:auto/s-cmovk-i32` → `main` · +151 −2 · 3 files · 5 commits · open No issue in this repo. Related upstream: Marvisak/VIctory#91, #1649. ## What it changes The [RDNA 2 ISA, §§5.5, 12.2 and 12.3](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content#page=119) specifies that these moves read SCC without writing it: when SCC is set, copy the source (sign-extend the immediate for `s_cmovk_i32`); otherwise, keep the old destination. `s_cmov_b32` and `s_cmovk_i32` each emit one i32 `select`. `s_cmov_b64` emits one per dword, using the same SCC and sign-extending negative inline integers into the high dword. This matches [`fold.rs`'s split into two b32 moves](https://github.com/trustno1-coder/VIctory-NVIDIA/blob/41adb55167fa778fcaa5dc36fa18a1fa8dacd657/crates/victory-shader/src/fold.rs#L1276-L1298). No branch, wave operation, or DXIL `INT64` requirement is added. The decoder, IR, resource tracing, fold logic, and cache settings are unchanged. Design follows Marvisak/VIctory#1649 by geiyiliyabumo. See [#1649](https://github.com/Marvisak/VIctory/pull/1649) and [tedin7's related #91](https://github.com/Marvisak/VIctory/pull/91). ## Expected effect on NVIDIA **Tier A — shader refusal.** A shader that uses one of these scalar move results can now translate instead of dropping its draw or dispatch. This is reproduced with synthetic shaders. No in-game frequency or visual effect was measured. ## How it was tested - GPU: none for the regression. Four CPU-evaluated GFX10 tests cover Wave32 and Wave64, both SCC values, unchanged SCC (including a zero move), both dwords of a register pair, inline `-2` for b64, and immediate `-17` for cmovk. - Main `41adb55167fa778fcaa5dc36fa18a1fa8dacd657` plus tests only (`da0ac9b687e0570181fba499630d8221ea0b96f6`): all four failed with `Unsupported` on [Linux](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46329991130/job/141557357100) and [Windows](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46329991130/job/141557356862), exit 101. - Exact fix `9d0a44ad5b5a38441c0b6948f26131d6ea9955d6`: all four passed. [Linux suite](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46330781309/job/141559843201): 295 → 299 passed, 0 failed, 2 ignored. [Windows suite](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46330781309/job/141559843452): 457 → 461 passed, with the same five device-availability failures and nine ignored on both. Excluding only those five: 461 passed, 0 failed. Windows `cargo check --workspace --locked` passed at both SHAs. - [Rollback](https://github.com/xiepeixuan/VIctory-NVIDIA/actions/runs/46330781309/job/141559843388) restored the main emitter in a separate checkout and reproduced all four refusals. ## Checked for overlap - [x] Searched 1,565 all-state PR titles and bodies, checked 88 pinned open diffs through the affected files, and reread [#1138](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/1138). No other VIctory-NVIDIA PR ports #91 or #1649. AI-assisted (Codex). Not run in the game.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:46:14 +00:00
github-bot changed title from Translate scalar conditional moves with immediates to Translate scalar conditional moves (s_cmov_b32, s_cmov_b64, s_cmovk_i32) 2026-11-30 00:51:54 +00:00
Author
Owner

@⁠nick0451 on GitHub · 2026-11-30 01:51 UTC · original

Exact translation check, with no game run: the title's shaders (game folder: 26,599 containers, 26,180 programs, 25,789 with emitted DXIL hashes), victory translate --list with VICTORY_HOST_WAVE=32, main 41adb551 (v2026.11.29.05) against this PR merged onto it.

Result: the output is the same for every program. All 25,789 output hashes match main, nothing fails to translate, and the summary counts are unchanged. So this title doesn't hit the pattern this PR changes, and the PR changes nothing for it, which also means no risk of a regression there. The fix may still matter for other titles or for the hand-written cases in the PR's tests.

(RTX 3090 host. The listing doesn't depend on the card, only on VICTORY_HOST_WAVE.)

🤖 Generated with Claude Code

**@⁠nick0451** on GitHub · 2026-11-30 01:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3389#issuecomment-7266495526) Exact translation check, with no game run: the title's shaders (game folder: 26,599 containers, 26,180 programs, 25,789 with emitted DXIL hashes), `victory translate --list` with `VICTORY_HOST_WAVE=32`, main `41adb551` (v2026.11.29.05) against this PR merged onto it. **Result: the output is the same for every program.** All 25,789 output hashes match main, nothing fails to translate, and the summary counts are unchanged. So this title doesn't hit the pattern this PR changes, and the PR changes nothing for it, which also means no risk of a regression there. The fix may still matter for other titles or for the hand-written cases in the PR's tests. (RTX 3090 host. The listing doesn't depend on the card, only on `VICTORY_HOST_WAVE`.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 03:12 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-30 03:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3389#issuecomment-7267676805) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.
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/3389/head:github-bot/gh-3389'
git switch 'github-bot/gh-3389'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3389'
git switch 'github-bot/gh-3389'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3389'
git switch 'github-bot/gh-3389'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3389'
git switch 'main'
git merge --squash 'github-bot/gh-3389'
git switch 'main'
git merge --ff-only 'github-bot/gh-3389'
git switch 'main'
git merge 'github-bot/gh-3389'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3389
No description provided.