fix(victory-shader): enforce inactive-lane EXEC rules for DPP16 and DPP8 #435

Open
github-bot wants to merge 4 commits from github-bot/gh-435 into main AGit
Owner

@⁠mauroalvare on GitHub · 2026-11-26 18:44 UTC · original
mauroalvare:fix/victory-dpp-inactive-exec → main · +407 −133 · 4 files · 4 commits · open

Change

In VIctory's RDNA2-to-DXIL translator (third_party/victory/crates/victory-shader/src/emit/lower.rs), Lower::dpp ignored fi (fetch-inactive) and the source lane's EXEC activity for both DPP16 (Dpp::Row) and DPP8 (Dpp::Lanes), and passed out-of-bounds lane indices (e.g. 0xFFFF_FFFF on row_shr lane 0, or >= wave_size on row_shl lane 31) directly to waveReadLaneAt.

Under AMD RDNA 2 ISA semantics, unless fi:1 is set, reading an inactive source lane (EXEC == 0) must:

  • supply 0 when bound_ctrl:1 (DPP16), or
  • leave vdst unmodified when bound_ctrl:0 (DPP16 and DPP8 0xE9).

On 32-lane NVIDIA hosts this broke both guarded wave32 / divergent wave32 shaders and paired wave64 compute shaders (where every divergent branch is lowered wave-wide with EXEC as a per-lane guard, so all host lanes stay physically active and waveReadLaneAt silently read stale inactive-lane VGPRs).

Fix:

  • Clamp out-of-bounds row-shift source lanes to lane before waveReadLaneAt / quad_pick.
  • When !fi, check source-lane activity via waveActiveBallot(guard.unwrap_or(true)) (or quad_pick(guard) for mesh quads), covering both guarded blocks (including paired wave64) and divergent branches (guard == None).
  • Combine inside and src_active into valid: substitute 0 if bound_ctrl is set, or gate the destination write otherwise.

Linked issue: none

Verification

Base SHA: c3cc02932fc596ee9d937e5743f73007c538365a (LooperSalty/AnyXboxX:main)
Hardware: Windows 11, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver 621.40), dxil.dll 10.0.26100.0, Rust 1.98.1 (MSVC).

Before the fix (failing on base c3cc029 on RTX 5070 Ti):

cargo test --locked -p victory-shader dpp16_and_dpp8_honor_inactive -- --test-threads=1 --nocapture
-> FAILED: thread 0, dword 0: 0xb, the console's 0xaaaa

After the fix (from third_party/victory):

cargo test --locked -p victory-shader dpp16_and_dpp8_honor_inactive -- --test-threads=1 --nocapture
-> ran on the hardware device: DPP16 and DPP8 honored EXEC, bound_ctrl, and fi in wave32 (guarded & branched) and paired wave64
-> test result: ok. 1 passed; 0 failed; 0 ignored
cargo test --locked -p victory-shader -- --test-threads=1
-> test result: ok. 258 passed; 0 failed; 2 ignored
cargo xtask policy
-> asset policy: 201 files ok

Oracle and test data

The new regression test dpp16_and_dpp8_honor_inactive_source_lanes_and_fi in third_party/victory/crates/victory-shader/src/emit/wave64_tests.rs synthesizes three minimal GFX10 compute shaders (guarded wave32, divergent-branch wave32, and paired wave64 on a 32-lane host) with EXEC narrowed to even lanes, executing DPP16 quad_perm:[1,0,3,2] (bound_ctrl:0 fi:0, bound_ctrl:1 fi:0, bound_ctrl:0 fi:1), DPP8 dpp8:[1,0,3,2,5,4,7,6] (fi:0), and DPP16 quad_perm:[2,3,0,1] (reading an active even lane). All shaders are validated with dxil.dll and checked dword-for-dword on RTX 5070 Ti against AMD RDNA 2 ISA semantics (matching PrototypeScarlett/emu/rdna2_exec_ext.py).

No game, console, or SDK files were used.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success.
  • README: unchanged (not applicable).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: none (synthetic tests only).
  • Code taken from another project: none.

AI assistance: investigated, implemented, tested on RTX 5070 Ti, and drafted with Antigravity (Gemini).

**@⁠mauroalvare** on GitHub · 2026-11-26 18:44 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/435) `mauroalvare:fix/victory-dpp-inactive-exec` → `main` · +407 −133 · 4 files · 4 commits · open ## Change In VIctory's RDNA2-to-DXIL translator (`third_party/victory/crates/victory-shader/src/emit/lower.rs`), `Lower::dpp` ignored `fi` (fetch-inactive) and the source lane's `EXEC` activity for both DPP16 (`Dpp::Row`) and DPP8 (`Dpp::Lanes`), and passed out-of-bounds lane indices (e.g. `0xFFFF_FFFF` on `row_shr` lane 0, or `>= wave_size` on `row_shl` lane 31) directly to `waveReadLaneAt`. Under AMD RDNA 2 ISA semantics, unless `fi:1` is set, reading an inactive source lane (`EXEC == 0`) must: - supply `0` when `bound_ctrl:1` (DPP16), or - leave `vdst` unmodified when `bound_ctrl:0` (DPP16 and DPP8 `0xE9`). On 32-lane NVIDIA hosts this broke both guarded wave32 / divergent wave32 shaders and paired wave64 compute shaders (where every divergent branch is lowered wave-wide with `EXEC` as a per-lane guard, so all host lanes stay physically active and `waveReadLaneAt` silently read stale inactive-lane VGPRs). Fix: - Clamp out-of-bounds row-shift source lanes to `lane` before `waveReadLaneAt` / `quad_pick`. - When `!fi`, check source-lane activity via `waveActiveBallot(guard.unwrap_or(true))` (or `quad_pick(guard)` for mesh quads), covering both guarded blocks (including paired wave64) and divergent branches (`guard == None`). - Combine `inside` and `src_active` into `valid`: substitute `0` if `bound_ctrl` is set, or gate the destination write otherwise. Linked issue: none ## Verification Base SHA: `c3cc02932fc596ee9d937e5743f73007c538365a` (`LooperSalty/AnyXboxX:main`) Hardware: Windows 11, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver `621.40`), `dxil.dll` `10.0.26100.0`, Rust `1.98.1` (MSVC). Before the fix (failing on base `c3cc029` on RTX 5070 Ti): ``` cargo test --locked -p victory-shader dpp16_and_dpp8_honor_inactive -- --test-threads=1 --nocapture -> FAILED: thread 0, dword 0: 0xb, the console's 0xaaaa ``` After the fix (from `third_party/victory`): ``` cargo test --locked -p victory-shader dpp16_and_dpp8_honor_inactive -- --test-threads=1 --nocapture -> ran on the hardware device: DPP16 and DPP8 honored EXEC, bound_ctrl, and fi in wave32 (guarded & branched) and paired wave64 -> test result: ok. 1 passed; 0 failed; 0 ignored cargo test --locked -p victory-shader -- --test-threads=1 -> test result: ok. 258 passed; 0 failed; 2 ignored cargo xtask policy -> asset policy: 201 files ok ``` ## Oracle and test data The new regression test `dpp16_and_dpp8_honor_inactive_source_lanes_and_fi` in `third_party/victory/crates/victory-shader/src/emit/wave64_tests.rs` synthesizes three minimal GFX10 compute shaders (guarded wave32, divergent-branch wave32, and paired wave64 on a 32-lane host) with `EXEC` narrowed to even lanes, executing DPP16 `quad_perm:[1,0,3,2]` (`bound_ctrl:0 fi:0`, `bound_ctrl:1 fi:0`, `bound_ctrl:0 fi:1`), DPP8 `dpp8:[1,0,3,2,5,4,7,6]` (`fi:0`), and DPP16 `quad_perm:[2,3,0,1]` (reading an active even lane). All shaders are validated with `dxil.dll` and checked dword-for-dword on RTX 5070 Ti against AMD RDNA 2 ISA semantics (matching `PrototypeScarlett/emu/rdna2_exec_ext.py`). No game, console, or SDK files were used. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. - [x] README: unchanged (not applicable). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: none (synthetic tests only). - [x] Code taken from another project: none. *AI assistance: investigated, implemented, tested on RTX 5070 Ti, and drafted with Antigravity (Gemini).*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:46:58 +00:00
github-bot force-pushed github-bot/gh-435 from d46815d06f to d29015283f 2026-11-26 19:34:49 +00:00 Compare
github-bot force-pushed github-bot/gh-435 from 774299d345 to 721c3209dd 2026-11-27 00:37:47 +00:00 Compare
Author
Owner

@⁠mauroalvare on GitHub · 2026-11-26 23:37 UTC · original

The Vice-Tay port is up in 721c320. The DPP16 and DPP8 GPU regression passed for guarded and branched wave32 and for split wave64, covering inactive EXEC lanes, bound_ctrl, and fi. The asset-policy check passed too.

**@⁠mauroalvare** on GitHub · 2026-11-26 23:37 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/435#issuecomment-7205709406) The Vice-Tay port is up in `721c320`. The DPP16 and DPP8 GPU regression passed for guarded and branched wave32 and for split wave64, covering inactive EXEC lanes, `bound_ctrl`, and `fi`. The asset-policy check passed too.
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/435/head:github-bot/gh-435'
git switch 'github-bot/gh-435'

Merge

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