fix(victory-shader): use console lane for DPP row_mask in split wave64-on-wave32 #297

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

@⁠mauroalvare on GitHub · 2026-11-26 01:47 UTC · original
mauroalvare:fix/victory-wave64-dpp-row-mask → main · +145 −1 · 3 files · 4 commits · open

Change

In VIctory's RDNA2-to-DXIL translator (third_party/victory/crates/victory-shader/src/emit/lower.rs), DPP16 row_mask checked self.console_lane() only in the paired form (self.twin.is_some()), falling back to the 0..31 host lane index (waveGetLaneIndex) in split wave64-on-wave32 compute shaders (self.halves.is_some() or self.exchange.is_some() — the default lowering on 32-lane hosts such as NVIDIA GPUs when DPP does not cross 32-lane halves or uses LDS exchange). Furthermore, console_lane() itself returned lane_index() whenever self.exchange.is_none() && self.twin.is_none(), ignoring self.halves.is_some().

As a result, the upper host wave (console lanes 32..63, DPP rows 2 and 3) tested row_mask bits 0 and 1 instead of bits 2 and 3, silently skipping enabled row-2/3 lanes and overwriting masked ones.

Fix:

  • Include self.halves.is_some() in Lower::console_lane() and Lower::lane_bit().
  • Use self.console_lane() for DPP row_mask whenever self.exchange.is_some() || self.halves.is_some() || self.twin.is_some().

Linked issue: Refs #213

Verification

Base SHA: c4c93bdc413191a9dc909998d2d53080a3f0c880 (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 c4c93bd on RTX 5070 Ti):

cargo test --locked -p victory-shader wave64_dpp_row_mask -- --test-threads=1 --nocapture
-> FAILED: thread 33, dword 0: 0x3e8, the console's 0x61

After the fix (from third_party/victory):

cargo test --locked -p victory-shader wave64_dpp_row_mask -- --test-threads=1 --nocapture
-> ran on the hardware device (with_exchange=false): DPP row_mask matched console rows 0..3
-> ran on the hardware device (with_exchange=true): DPP row_mask matched console rows 0..3
-> test result: ok. 1 passed; 0 failed; 0 ignored
cargo test --locked -p victory-shader -- --test-threads=1
-> test result: ok. 243 passed; 0 failed; 2 ignored
cargo xtask policy
-> asset policy: 199 files ok

Oracle and test data

The new regression test wave64_dpp_row_mask_uses_console_rows_in_split_32_lane_waves in third_party/victory/crates/victory-shader/src/emit/wave64_tests.rs synthesizes two 64-thread GFX10 wave64 compute shaders (one with halves only, one with halves + exchange via s_bcnt1_i32_b64) executing v_mov_b32 v4, v1 row_shr:1 row_mask:0x6 bank_mask:0xf. Both are validated with dxil.dll and executed on the RTX 5070 Ti, checking all 64 lanes (256 dwords) against RDNA 2 ISA semantics.

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 01:47 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/297) `mauroalvare:fix/victory-wave64-dpp-row-mask` → `main` · +145 −1 · 3 files · 4 commits · open ## Change In VIctory's RDNA2-to-DXIL translator (`third_party/victory/crates/victory-shader/src/emit/lower.rs`), DPP16 `row_mask` checked `self.console_lane()` only in the paired form (`self.twin.is_some()`), falling back to the 0..31 host lane index (`waveGetLaneIndex`) in split wave64-on-wave32 compute shaders (`self.halves.is_some()` or `self.exchange.is_some()` — the default lowering on 32-lane hosts such as NVIDIA GPUs when DPP does not cross 32-lane halves or uses LDS exchange). Furthermore, `console_lane()` itself returned `lane_index()` whenever `self.exchange.is_none() && self.twin.is_none()`, ignoring `self.halves.is_some()`. As a result, the upper host wave (console lanes 32..63, DPP rows 2 and 3) tested `row_mask` bits 0 and 1 instead of bits 2 and 3, silently skipping enabled row-2/3 lanes and overwriting masked ones. Fix: - Include `self.halves.is_some()` in `Lower::console_lane()` and `Lower::lane_bit()`. - Use `self.console_lane()` for DPP `row_mask` whenever `self.exchange.is_some() || self.halves.is_some() || self.twin.is_some()`. Linked issue: Refs #213 ## Verification Base SHA: `c4c93bdc413191a9dc909998d2d53080a3f0c880` (`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 `c4c93bd` on RTX 5070 Ti): ``` cargo test --locked -p victory-shader wave64_dpp_row_mask -- --test-threads=1 --nocapture -> FAILED: thread 33, dword 0: 0x3e8, the console's 0x61 ``` After the fix (from `third_party/victory`): ``` cargo test --locked -p victory-shader wave64_dpp_row_mask -- --test-threads=1 --nocapture -> ran on the hardware device (with_exchange=false): DPP row_mask matched console rows 0..3 -> ran on the hardware device (with_exchange=true): DPP row_mask matched console rows 0..3 -> test result: ok. 1 passed; 0 failed; 0 ignored cargo test --locked -p victory-shader -- --test-threads=1 -> test result: ok. 243 passed; 0 failed; 2 ignored cargo xtask policy -> asset policy: 199 files ok ``` ## Oracle and test data The new regression test `wave64_dpp_row_mask_uses_console_rows_in_split_32_lane_waves` in `third_party/victory/crates/victory-shader/src/emit/wave64_tests.rs` synthesizes two 64-thread GFX10 wave64 compute shaders (one with `halves` only, one with `halves` + `exchange` via `s_bcnt1_i32_b64`) executing `v_mov_b32 v4, v1 row_shr:1 row_mask:0x6 bank_mask:0xf`. Both are validated with `dxil.dll` and executed on the RTX 5070 Ti, checking all 64 lanes (256 dwords) against RDNA 2 ISA semantics. 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 05:42:19 +00:00
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/297/head:github-bot/gh-297'
git switch 'github-bot/gh-297'

Merge

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