Shaders: assign distinct console IDs to packed compute waves #236

Open
github-bot wants to merge 3 commits from github-bot/gh-236 into main AGit
Owner

@⁠loyodea on GitHub · 2026-11-26 08:01 UTC · original
loyodea:victory-compute-lane-ids → main · +276 −27 · 2 files · 3 commits · open

Related to #216. In eligible multidimensional compute groups, use one shared counter to give each full host wave a distinct wave-aligned range of console IDs. A dense partial wave takes the tail. Native lane indices, threadgroup dimensions, and in-wave operations stay intact. The previous mapping is used for unsupported occupancy and other excluded paths.

Tested

  • On Windows 11 build 26300, Radeon RX 9060 XT driver 32.0.32029.2010, Rust 1.100.0 GNU x64, DXIL validator 1.9.2609.5.
  • A translated 32x2 Wave32 group produced 32 distinct IDs out of 64 before the change. All eight translated regression cases passed after it. These cover multidimensional and partial groups, both native wave widths, and groupshared exchange.
  • Serial victory-shader suite: 281 passed, 0 failed, 7 ignored. The first parallel attempt aborted in a process access violation before the new regression ran.
  • The repository policy check flags lower.rs. It already exceeded the 512 KiB limit at the upstream base.

Eligible groups gain two group barriers, one atomic per host wave, and one groupshared dword. Gameplay impact, other drivers, and performance remain unverified. The tests use synthetic programs. Codex contributed the implementation and verification.

CI follow-up

The follow-up commit makes the test's LDS-unit shift explicit. The focused multidimensional regression passed all eight cases on the RX 9060 XT with Rust 1.98.1. Clean upstream main also reproduces the ten inherited shader Clippy diagnostics.

Review follow-up

The same ID collision also appeared in the split-wave path on main. In a synthetic 32×2 dispatch, both host waves used IDs 0–31. With the follow-up, the existing counter gives each split half its own 32-lane block.

On an RX 9060 XT using the forced 32-lane host path and DXIL validation, all four split-wave shapes and all eight native-wave shapes passed. The serial shader suite reported 279 passed and six ignored. Four compiler-dependent cases returned early. These tests used synthetic inputs. The separate a-publier implementation is #442.

**@⁠loyodea** on GitHub · 2026-11-26 08:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/236) `loyodea:victory-compute-lane-ids` → `main` · +276 −27 · 2 files · 3 commits · open Related to #216. In eligible multidimensional compute groups, use one shared counter to give each full host wave a distinct wave-aligned range of console IDs. A dense partial wave takes the tail. Native lane indices, threadgroup dimensions, and in-wave operations stay intact. The previous mapping is used for unsupported occupancy and other excluded paths. **Tested** - On Windows 11 build 26300, Radeon RX 9060 XT driver 32.0.32029.2010, Rust 1.100.0 GNU x64, DXIL validator 1.9.2609.5. - A translated 32x2 Wave32 group produced 32 distinct IDs out of 64 before the change. All eight translated regression cases passed after it. These cover multidimensional and partial groups, both native wave widths, and groupshared exchange. - Serial victory-shader suite: 281 passed, 0 failed, 7 ignored. The first parallel attempt aborted in a process access violation before the new regression ran. - The repository policy check flags lower.rs. It already exceeded the 512 KiB limit at the upstream base. Eligible groups gain two group barriers, one atomic per host wave, and one groupshared dword. Gameplay impact, other drivers, and performance remain unverified. The tests use synthetic programs. Codex contributed the implementation and verification. **CI follow-up** The follow-up commit makes the test's LDS-unit shift explicit. The focused multidimensional regression passed all eight cases on the RX 9060 XT with Rust 1.98.1. Clean upstream main also reproduces the ten inherited shader Clippy diagnostics. **Review follow-up** The same ID collision also appeared in the split-wave path on main. In a synthetic 32×2 dispatch, both host waves used IDs 0–31. With the follow-up, the existing counter gives each split half its own 32-lane block. On an RX 9060 XT using the forced 32-lane host path and DXIL validation, all four split-wave shapes and all eight native-wave shapes passed. The serial shader suite reported 279 passed and six ignored. Four compiler-dependent cases returned early. These tests used synthetic inputs. The separate a-publier implementation is #442.
Allocate wave-aligned ranges for eligible multidimensional threadgroups and preserve native lane indices. Keep the previous mapping for unsupported occupancy. Synthetic Wave32 and Wave64 cases cover ID uniqueness and shared-memory exchange. Related to #216.

Co-authored-by: Codex <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:18:07 +00:00
Compute the LDS allocation units before constructing the test program resource flags, avoiding the precedence diagnostic while keeping the encoded bits identical.

Co-authored-by: Codex <[email protected]>
(cherry picked from commit 110795e9e96923b4041907aad6d2b4e401f4ddc7)
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-26 21:42 UTC · original

Tested #236 at df09987 (base main @ 4f62c2a) on an RX 7900 XT (Windows 11, driver 32.0.32029.2010). This builds on the probe and census in #216.

Probe

  • I added the id probe from my #216 comment as a test on this branch. With #236, every shape is exact for console wave32 and wave64 programs (WaveSize(32) and WaveSize(64) on this host): 32x2, 32x8, 64x2, 64x4, 32x32, 32x2x2, 10x10, 12x12, 24x8, 6x6, 8x8, 16x16, 16x2x4. So the partial-wave tail works here for 10x10, 12x12 and 6x6.
  • Both your test and mine fail on 4f62c2a and pass with the PR.

Archive (translate --validate --list, compared per program)

  • --host-lanes 32-64: 27 compute programs change, nothing else. They are exactly the 27 from the #216 census. All 27 validate and create pipelines on the 7900 XT.
  • --host-lanes 32-32: only 3 of the 90 from the census change (CS_GatherRaymarchedLocalLights and the two CS_TAA2_Resolve).
  • The other 87 are console wave64 programs that run as two 32-lane halves (split), which console_thread_prologue skips. 85 are 8x8 and 2 are 4x4x4. They keep the rounding.
  • None of the 27 or 90 hits the other exclusions: partial dispatch addresses, no thread-id input, or 8192 LDS dwords. The only two console-lane programs at 8192 dwords are 1-D (1024x1x1, vfx_triangleClip CS_CollectTriangles*).
  • None of these groups has a size that is not a multiple of the wave. So the tail path is only covered by the tests.

Split halves

  • I translated the same probe for a 32-lane-only host (wave64 as halves) and ran it on the 7900 XT. With #236 the counts are the same as on main and as the WaveSize(32) column in #216: 10 of 15 shapes collide (32x2, 32x8, 64x2, 64x4, 32x32, 32x2x2, 10x10, 12x12, 24x8, 6x6).
  • The 87 archive shapes (8x8, 4x4x4) are among the exact ones here. So this only matters on a host with a different 32-lane layout, such as NVIDIA (32..32), which I cannot test.
  • In a local branch, giving each 32-lane half its own block from the same counter made all 15 shapes exact. I can share it. Is there a reason split has to stay on the rounding?

Other checks

  • victory-shader lib tests, single-threaded, 3 runs each, base and PR interleaved: base 277 passed, PR 278 passed, no failures. Other heavy jobs ran on the machine at the same time.

Not tested: no game run (the game is not on this machine), no NVIDIA card, no performance numbers.

**@⁠adrianmjim** on GitHub · 2026-11-26 21:42 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/236#issuecomment-7203981231) Tested #236 at df09987 (base `main` @ 4f62c2a) on an RX 7900 XT (Windows 11, driver 32.0.32029.2010). This builds on the probe and census in #216. **Probe** - I added the id probe from my #216 comment as a test on this branch. With #236, every shape is exact for console wave32 and wave64 programs (WaveSize(32) and WaveSize(64) on this host): 32x2, 32x8, 64x2, 64x4, 32x32, 32x2x2, 10x10, 12x12, 24x8, 6x6, 8x8, 16x16, 16x2x4. So the partial-wave tail works here for 10x10, 12x12 and 6x6. - Both your test and mine fail on 4f62c2a and pass with the PR. **Archive (translate --validate --list, compared per program)** - `--host-lanes 32-64`: 27 compute programs change, nothing else. They are exactly the 27 from the #216 census. All 27 validate and create pipelines on the 7900 XT. - `--host-lanes 32-32`: only 3 of the 90 from the census change (CS_GatherRaymarchedLocalLights and the two CS_TAA2_Resolve). - The other 87 are console wave64 programs that run as two 32-lane halves (`split`), which `console_thread_prologue` skips. 85 are 8x8 and 2 are 4x4x4. They keep the rounding. - None of the 27 or 90 hits the other exclusions: partial dispatch addresses, no thread-id input, or 8192 LDS dwords. The only two console-lane programs at 8192 dwords are 1-D (1024x1x1, vfx_triangleClip CS_CollectTriangles*). - None of these groups has a size that is not a multiple of the wave. So the tail path is only covered by the tests. **Split halves** - I translated the same probe for a 32-lane-only host (wave64 as halves) and ran it on the 7900 XT. With #236 the counts are the same as on main and as the WaveSize(32) column in #216: 10 of 15 shapes collide (32x2, 32x8, 64x2, 64x4, 32x32, 32x2x2, 10x10, 12x12, 24x8, 6x6). - The 87 archive shapes (8x8, 4x4x4) are among the exact ones here. So this only matters on a host with a different 32-lane layout, such as NVIDIA (32..32), which I cannot test. - In a local branch, giving each 32-lane half its own block from the same counter made all 15 shapes exact. I can share it. Is there a reason `split` has to stay on the rounding? **Other checks** - victory-shader lib tests, single-threaded, 3 runs each, base and PR interleaved: base 277 passed, PR 278 passed, no failures. Other heavy jobs ran on the machine at the same time. Not tested: no game run (the game is not on this machine), no NVIDIA card, no performance numbers.
This pull request can be merged automatically.
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/236/head:github-bot/gh-236'
git switch 'github-bot/gh-236'

Merge

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