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

Open
loyodea wants to merge 3 commits from upstream-pr/236 into main
loyodea commented 2026-11-26 08:01:59 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by loyodea on 2026-11-26T08:01:59Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:5506231350 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/236). Originally posted by [loyodea](https://github.com/loyodea) on 2026-11-26T08:01:59Z. --- 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.
adrianmjim commented 2026-11-26 21:42:20 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by adrianmjim on 2026-11-26T21:42:20Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7203981231 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/236#issuecomment-7203981231). Originally posted by [adrianmjim](https://github.com/adrianmjim) on 2026-11-26T21:42:20Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/236:upstream-pr/236'
git switch 'upstream-pr/236'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/236'
git switch 'upstream-pr/236'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/236'
git switch 'upstream-pr/236'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/236'
git switch 'main'
git merge --squash 'upstream-pr/236'
git switch 'main'
git merge --ff-only 'upstream-pr/236'
git switch 'main'
git merge 'upstream-pr/236'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Belobug/VIctory-Belobug-AMD!236
No description provided.