Shaders: fix ds_bpermute_b32 lane selection on Wave32 hosts #1019

Closed
github-bot wants to merge 2 commits from github-bot/gh-1019 into main AGit
Owner

@⁠invismann on GitHub · 2026-11-28 11:14 UTC · original
invismann:fix/shader-backward-permute-wave32 → main · +14765 −360 · 45 files · 78 commits · closed without merging

RDNA2 ds_bpermute_b32 gathers within the caller's 32-lane half and produces zero when the source lane is inactive. Treating it as a cross-half operation can reject a valid Wave64 shader on Wave32 hosts. Computing a source index across all 64 lanes can also read the wrong value.

Wrap the index within the caller's half, account for active source lanes, and allow this gather in independent host Wave32 halves.

Validation

  • The synthetic regression translates for both host wave widths and checks wrapped indices and inactive sources.
  • RTX 4090 GPU readbacks pass on Wave32 with both 64- and 128-thread groups.
**@⁠invismann** on GitHub · 2026-11-28 11:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1019) `invismann:fix/shader-backward-permute-wave32` → `main` · +14765 −360 · 45 files · 78 commits · closed without merging RDNA2 `ds_bpermute_b32` gathers within the caller's 32-lane half and produces zero when the source lane is inactive. Treating it as a cross-half operation can reject a valid Wave64 shader on Wave32 hosts. Computing a source index across all 64 lanes can also read the wrong value. Wrap the index within the caller's half, account for active source lanes, and allow this gather in independent host Wave32 halves. ## Validation - The synthetic regression translates for both host wave widths and checks wrapped indices and inactive sources. - RTX 4090 GPU readbacks pass on Wave32 with both 64- and 128-thread groups.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:31:54 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 11:44 UTC · original · approved these changes

Tested locally merged onto main (63b902f).

  • Merge & Policy: Clean merge; cargo xtask policy passed (294 files ok).
  • Tests (RTX 5090, Wave32 host):
    • cargo test -p victory-shader --lib emit::wave64_tests:: passed (14 passed; 0 failed, including the new backward_permute_wraps_within_its_half_and_zeros_inactive_sources GPU test).
    • cargo test -p victory-shader --lib emit::tests:: passed (22 passed; 0 failed; 1 ignored, including a_backward_permute_reads_the_lane_its_address_names).
  • Lint: cargo clippy -p victory-shader --lib -- -D warnings passed with 0 warnings.

Great NVIDIA/Wave32 correctness fix for ds_bpermute_b32 lane selection and inactive-source zeroing. LGTM.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 11:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1019#pullrequestreview-6097584379) · **approved these changes** Tested locally merged onto `main` (`63b902f`). - **Merge & Policy**: Clean merge; `cargo xtask policy` passed (`294 files ok`). - **Tests (RTX 5090, Wave32 host)**: - `cargo test -p victory-shader --lib emit::wave64_tests::` passed (`14 passed; 0 failed`, including the new `backward_permute_wraps_within_its_half_and_zeros_inactive_sources` GPU test). - `cargo test -p victory-shader --lib emit::tests::` passed (`22 passed; 0 failed; 1 ignored`, including `a_backward_permute_reads_the_lane_its_address_names`). - **Lint**: `cargo clippy -p victory-shader --lib -- -D warnings` passed with 0 warnings. Great NVIDIA/Wave32 correctness fix for `ds_bpermute_b32` lane selection and inactive-source zeroing. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Bj0rnis on GitHub · 2026-11-28 13:29 UTC · original

Independent RTX 5070 Ti 16 GB (Blackwell, Wave32 host) headless verification of 0f5e7e4 (Windows 11, Ryzen 7 9800X3D, 32 GB RAM, driver 621.24, Rust 1.98.1):

  • Clean merge-tree against main (63b902f).
  • cargo test --release --locked -p victory-shader --lib -- --test-threads=1: 294 passed, 0 failed, 5 ignored (245.04 s), including the new GPU readback regression emit::wave64_tests::backward_permute_wraps_within_its_half_and_zeros_inactive_sources (ok) and all other wave64_tests on Blackwell Wave32.
  • Wave32 shader corpus (victory.exe shaders, VICTORY_HOST_WAVE=32): 25,760 translated / 225 failed (92 s) — matches main (63b902f) with 0 regressions.
  • cargo xtask policy: 294 files ok; cargo build --release --locked -p victory succeeded cleanly.

Not tested: live gameplay workload. No game data, shader hashes, logs, or captures attached.

AI-assisted test run and summary.

**@⁠Bj0rnis** on GitHub · 2026-11-28 13:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1019#issuecomment-7239969075) Independent RTX 5070 Ti 16 GB (Blackwell, Wave32 host) headless verification of `0f5e7e4` (Windows 11, Ryzen 7 9800X3D, 32 GB RAM, driver `621.24`, Rust 1.98.1): - **Clean merge-tree** against `main` (`63b902f`). - **`cargo test --release --locked -p victory-shader --lib -- --test-threads=1`:** **294 passed, 0 failed, 5 ignored** (`245.04 s`), including the new GPU readback regression `emit::wave64_tests::backward_permute_wraps_within_its_half_and_zeros_inactive_sources` (`ok`) and all other `wave64_tests` on Blackwell Wave32. - **Wave32 shader corpus (`victory.exe shaders`, `VICTORY_HOST_WAVE=32`):** `25,760` translated / `225` failed (`92 s`) — matches `main` (`63b902f`) with 0 regressions. - **`cargo xtask policy`:** **294 files ok**; `cargo build --release --locked -p victory` succeeded cleanly. *Not tested:* live gameplay workload. No game data, shader hashes, logs, or captures attached. *AI-assisted test run and summary.*
Author
Owner

@⁠Exopus-0x65f7ad0 on GitHub · 2026-11-28 13:39 UTC · original

On a second NVIDIA architecture: RTX 5060 Ti 8 GB (Blackwell, 10de:2d04), Windows 11 26300, native D3D12. 63b902f + this PR.

cargo test --release --locked -p victory-shader --lib backward_permute_wraps_within_its_half_and_zeros_inactive_sources → passed.

The GPU readbacks you ran on the 4090 aren't in the PR, so I couldn't repeat those. If you push the readback test (even #[ignore]), I'll run it on this Blackwell card.

**@⁠Exopus-0x65f7ad0** on GitHub · 2026-11-28 13:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1019#issuecomment-7240095938) On a second NVIDIA architecture: RTX 5060 Ti 8 GB (Blackwell, `10de:2d04`), Windows 11 26300, native D3D12. `63b902f` + this PR. `cargo test --release --locked -p victory-shader --lib backward_permute_wraps_within_its_half_and_zeros_inactive_sources` → **passed**. The GPU readbacks you ran on the 4090 aren't in the PR, so I couldn't repeat those. If you push the readback test (even `#[ignore]`), I'll run it on this Blackwell card.
Keep the upstream LDS analysis and diagnostics. Report only forward permutes as cross-half operations and retain the regression for wrapped indices and inactive lanes.
github-bot closed this pull request 2026-11-28 19:43:41 +00:00

Pull request closed

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!1019
No description provided.