perf(mesh): fold literal Wave32 lane counts to the console lane index #656

Open
github-bot wants to merge 9 commits from github-bot/gh-656 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-06 01:11 UTC · original
tommiehansen:perf/phase13-mesh-lane-count-20261206 → main · +194 −4 · 4 files · 9 commits · draft

Why

Mesh-heavy workloads can spend substantial GPU time on geometry preparation and export (#293, #74). The translated all-ones Wave32 v_mbcnt_lo reconstructs a lane index using bit-mask arithmetic and population count, even though the console lane is already available in the mesh shader.

What changes

Opt-in VICTORY_MESH_LANE_COUNT=1 replaces only the literal all-ones Wave32 guest mesh count with console lane + src1. Other masks, guest Wave64, and other stages keep their original translation. Cache identity is separated for the opt-in. This does not change vertex/primitive counts, culling or exports, and is independent of #469.

Benchmark results

Matched production DXIL -> SPIR-V -> pinned Mesa RADV/ACO compiler audit 47589861252, 36 compiler cases, 18 pairs (plain, edge, cull x Navi31/GFX1200/GFX1201 x host wave32/64).

Host wave Before instructions After Reduction Code bytes saved Latency estimate
32 19 16 15.79% 20 50 -> 40
64 30 27 10.00% 20 71–72 -> 63–64

Guest admission is Wave32 in both rows; host compiler wave selection is separate. Register allocation, LDS, scratch and occupancy estimates unchanged; no spills. These are compiler statistics, not elapsed GPU timing or gameplay FPS. Real-title frequency and larger shader coverage are unknown.

Why this should be merged

Removes proven redundant arithmetic without altering rendering quality or semantics; exact output preserved in the tested shapes, and unsupported cases retain the baseline.

Validation

Isolated upstream-base CI 47591505348: Linux 309 tests passed; Windows three exact WARP rendered image comparisons and two byte-identical rejected guest-wave/mask controls; all-targets production check passed. The AMD compiler audit is on the earlier BTD audit branch with identical production lower.rs; no new final-head AMD audit claimed. No physical GPU execution measured.

Compatibility and dependencies

Clean main-based candidate, no dependency on #469, disabled by default. Need representative real shader corpus coverage and physical AMD timing before promotion; exact fallback retained.

Final-head validation and occurrence census

5917d4a: CI 47592893535 passed Linux and Windows, with seven exact WARP mesh renders (including constant and varying src1, masked EXEC and two guest waves) and two byte-identical rejection controls. Diagnostics-only VICTORY_MESH_LANE_CENSUS=1 reports translated opportunities/eligibility, not GPU invocation frequency. The exact final-head DXIL artifact is used by expanded ACO audit 47593329716, completed 84 compilations / 42 matched pairs. All 42 pairs remove three instructions and 20 code bytes, without changes in SGPR/VGPR allocation, LDS, scratch or estimated occupancy; zero spills. Six shapes: host wave32 19→16, wave64 30→27; two-guest-waves: host wave32 32–33→29–30, wave64 28→25. These are compiler statistics, not elapsed GPU timing. Raw artifact 15963688519. Draft remains pending representative shader coverage and physical AMD timing.

Combined Wave32/Wave64 validation

CI 47595204584 passed Linux and Windows on the isolated PRC integration branch: all four switch-combination compatibility controls exact, separate guest-wave admission/cache identity and four Wave64 rendering oracles exact with the Wave32 flag enabled. The shared diagnostics distinguish guest widths; synthetic counts are not title frequency. Both candidates remain default-off drafts pending representative shader coverage and physical AMD execution.

**@⁠tommiehansen** on GitHub · 2026-12-06 01:11 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/656) `tommiehansen:perf/phase13-mesh-lane-count-20261206` → `main` · +194 −4 · 4 files · 9 commits · draft ## Why Mesh-heavy workloads can spend substantial GPU time on geometry preparation and export (#293, #74). The translated all-ones Wave32 v_mbcnt_lo reconstructs a lane index using bit-mask arithmetic and population count, even though the console lane is already available in the mesh shader. ## What changes Opt-in VICTORY_MESH_LANE_COUNT=1 replaces only the literal all-ones Wave32 guest mesh count with console lane + src1. Other masks, guest Wave64, and other stages keep their original translation. Cache identity is separated for the opt-in. This does not change vertex/primitive counts, culling or exports, and is independent of #469. ## Benchmark results Matched production DXIL -> SPIR-V -> pinned Mesa RADV/ACO compiler audit [47589861252](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47589861252), 36 compiler cases, 18 pairs (plain, edge, cull x Navi31/GFX1200/GFX1201 x host wave32/64). | Host wave | Before instructions | After | Reduction | Code bytes saved | Latency estimate | |---|---:|---:|---:|---:|---:| | 32 | 19 | 16 | 15.79% | 20 | 50 -> 40 | | 64 | 30 | 27 | 10.00% | 20 | 71–72 -> 63–64 | Guest admission is Wave32 in both rows; host compiler wave selection is separate. Register allocation, LDS, scratch and occupancy estimates unchanged; no spills. These are compiler statistics, not elapsed GPU timing or gameplay FPS. Real-title frequency and larger shader coverage are unknown. ## Why this should be merged Removes proven redundant arithmetic without altering rendering quality or semantics; exact output preserved in the tested shapes, and unsupported cases retain the baseline. ## Validation [Isolated upstream-base CI 47591505348](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47591505348): Linux 309 tests passed; Windows three exact WARP rendered image comparisons and two byte-identical rejected guest-wave/mask controls; all-targets production check passed. The AMD compiler audit is on the earlier BTD audit branch with identical production lower.rs; no new final-head AMD audit claimed. No physical GPU execution measured. ## Compatibility and dependencies Clean main-based candidate, no dependency on #469, disabled by default. Need representative real shader corpus coverage and physical AMD timing before promotion; exact fallback retained. ### Final-head validation and occurrence census `5917d4a`: [CI 47592893535](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47592893535) passed Linux and Windows, with seven exact WARP mesh renders (including constant and varying src1, masked EXEC and two guest waves) and two byte-identical rejection controls. Diagnostics-only `VICTORY_MESH_LANE_CENSUS=1` reports translated opportunities/eligibility, not GPU invocation frequency. The exact final-head DXIL artifact is used by [expanded ACO audit 47593329716](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47593329716), completed 84 compilations / 42 matched pairs. All 42 pairs remove three instructions and 20 code bytes, without changes in SGPR/VGPR allocation, LDS, scratch or estimated occupancy; zero spills. Six shapes: host wave32 19→16, wave64 30→27; two-guest-waves: host wave32 32–33→29–30, wave64 28→25. These are compiler statistics, not elapsed GPU timing. [Raw artifact 15963688519](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47593329716/artifacts/15963688519). Draft remains pending representative shader coverage and physical AMD timing. ### Combined Wave32/Wave64 validation [CI 47595204584](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47595204584) passed Linux and Windows on the isolated PRC integration branch: all four switch-combination compatibility controls exact, separate guest-wave admission/cache identity and four Wave64 rendering oracles exact with the Wave32 flag enabled. The shared diagnostics distinguish guest widths; synthetic counts are not title frequency. Both candidates remain default-off drafts pending representative shader coverage and physical AMD execution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 01:17:24 +00:00
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/656/head:github-bot/gh-656'
git switch 'github-bot/gh-656'

Merge

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