Preserve wave64 lane IDs in full-LDS local allocations on wave32 hosts #4778

Open
github-bot wants to merge 1 commit from github-bot/gh-4777 into main AGit
Owner

@⁠LogicGrove on GitHub · 2026-12-01 07:39 UTC · original
LogicGrove:fix/local-wave-lds-bounds-20261201 → main · +424 −25 · 4 files · 1 commits · open

What it changes

A compute shader can use the entire 32 KiB of group-shared memory and reserve output slots by having its first active lane add the wave total to an LDS counter. Splitting the guest wave64 into two host waves of 32 can preserve every output slot, but reserving additional LDS for wave exchange or a ticket puts this shader over the host limit.

This ports the local allocation analysis to current main. The scratch-free path requires the exact allocation classifier, a one-dimensional group of complete host waves and no paired meetings. It uses the existing LDS ordering analysis and preserves the high half of the guest lane number using the linear thread mapping. Guarded overwrites are fresh only for reads in the same block under the same predicate. An LDS atomic must address a wave-independent location and its active mask must imply a first-lane predicate.

How it was tested

  • Synthetic compute programs on Windows with a physical RTX 2060, 32-lane host waves and wave64 guest programs. D3D12 compute tests have no display or frame-generation settings.
  • The Windows DXIL validator accepted the output. For groups of 128 and 1,024 threads, the GPU produced a unique output for every active thread across 48 dispatches. Two additional dispatches checked each thread's console lane number with 512 bytes and 32 KiB of guest LDS.
  • With the new tests applied to main at 5fabb46 and a separate build directory, three regressions failed. The classifier rejected the full-LDS allocation and guarded reuse, and lane-ID lowering hit the 32 KiB host limit. Two rejection tests passed and the GPU test was ignored by default.
  • At fd81b67, the full victory-shader library suite passed in debug (541 passed, 11 ignored). All six local_lds tests passed in release with --include-ignored on the RTX 2060, including the numeric GPU test.
  • Negative cases cover 2-D and 3-D groups, reads outside a guarded overwrite, complemented first-lane masks and an atomic that overwrites its own address register.
  • Targeted Clippy with all features and warnings denied passed. The staged asset-policy check passed. The new hardware test can be run with cargo test --locked -p victory-shader full_lds_local_allocations_and_lane_numbers_are_correct_on_nvidia -- --ignored --nocapture.

Checked for overlap

  • Compared against main at 5fabb46, #388, #822 and the entry-block lane fix in #865. Credits to fromrivertothesea (#388) and henriazz10 (#822) for the allocation analysis and original synthetic fixture. The overlap is substantial. This version adds geometry and exact-mode restrictions, verifies the LDS address and predicate, and exercises the upper half and guarded register reuse on current main.

The change is confined to the shader translator and its tests. Reverting this commit restores the previous lowering. Native wave64 hardware and game performance were not measured.

**@⁠LogicGrove** on GitHub · 2026-12-01 07:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4777) `LogicGrove:fix/local-wave-lds-bounds-20261201` → `main` · +424 −25 · 4 files · 1 commits · open ## What it changes A compute shader can use the entire 32 KiB of group-shared memory and reserve output slots by having its first active lane add the wave total to an LDS counter. Splitting the guest wave64 into two host waves of 32 can preserve every output slot, but reserving additional LDS for wave exchange or a ticket puts this shader over the host limit. This ports the local allocation analysis to current main. The scratch-free path requires the exact allocation classifier, a one-dimensional group of complete host waves and no paired meetings. It uses the existing LDS ordering analysis and preserves the high half of the guest lane number using the linear thread mapping. Guarded overwrites are fresh only for reads in the same block under the same predicate. An LDS atomic must address a wave-independent location and its active mask must imply a first-lane predicate. ## How it was tested - Synthetic compute programs on Windows with a physical RTX 2060, 32-lane host waves and wave64 guest programs. D3D12 compute tests have no display or frame-generation settings. - The Windows DXIL validator accepted the output. For groups of 128 and 1,024 threads, the GPU produced a unique output for every active thread across 48 dispatches. Two additional dispatches checked each thread's console lane number with 512 bytes and 32 KiB of guest LDS. - With the new tests applied to `main` at `5fabb46` and a separate build directory, three regressions failed. The classifier rejected the full-LDS allocation and guarded reuse, and lane-ID lowering hit the 32 KiB host limit. Two rejection tests passed and the GPU test was ignored by default. - At `fd81b67`, the full `victory-shader` library suite passed in debug (541 passed, 11 ignored). All six `local_lds` tests passed in release with `--include-ignored` on the RTX 2060, including the numeric GPU test. - Negative cases cover 2-D and 3-D groups, reads outside a guarded overwrite, complemented first-lane masks and an atomic that overwrites its own address register. - Targeted Clippy with all features and warnings denied passed. The staged asset-policy check passed. The new hardware test can be run with `cargo test --locked -p victory-shader full_lds_local_allocations_and_lane_numbers_are_correct_on_nvidia -- --ignored --nocapture`. ## Checked for overlap - [x] Compared against main at `5fabb46`, #388, #822 and the entry-block lane fix in #865. Credits to fromrivertothesea (#388) and henriazz10 (#822) for the allocation analysis and original synthetic fixture. The overlap is substantial. This version adds geometry and exact-mode restrictions, verifies the LDS address and predicate, and exercises the upper half and guarded register reuse on current main. The change is confined to the shader translator and its tests. Reverting this commit restores the previous lowering. Native wave64 hardware and game performance were not measured.
Port the LDS reservation and same-guard analysis from #822 and #388 to the current lowering. Constrain scratch-free groups to complete linear waves, preserve both console halves, and check the LDS address and first-lane mask before admitting an atomic. Cover positive and negative cases with synthetic programs and a hardware dispatch oracle.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:42:50 +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/4778/head:github-bot/gh-4777'
git switch 'github-bot/gh-4777'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4777'
git switch 'github-bot/gh-4777'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4777'
git switch 'github-bot/gh-4777'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4777'
git switch 'main'
git merge --squash 'github-bot/gh-4777'
git switch 'main'
git merge --ff-only 'github-bot/gh-4777'
git switch 'main'
git merge 'github-bot/gh-4777'
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!4778
No description provided.