shader: share directory lookups across proven same-page guest-load clusters #305
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!305
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-305"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tommiehansen on GitHub · 2026-12-03 09:58 UTC · original
tommiehansen:perf/t01-global-load-clusters→main· +318 −8 · 5 files · 2 commits · merged 2026-12-03 17:11 UTCProblem
Compatible guest-memory loads can repeatedly look up one 64 KiB directory page and select the same descriptor. These lookups and selections add dependent work before the actual loads.
Implementation and correctness
The first commit groups an eligible adjacent pair. The follow-up extends it to 2–8 consecutive compatible instructions spanning at most 256 bytes. A cluster needs the same SSA address base and available lane guard, a static same-page proof and non-overlapping destinations. Sparse groups share the descriptor but read only the requested contiguous runs. Every original instruction retains its fault note. Unsupported cases return to ordinary lowering before emitting cluster code. The revised opt-in cache key separates the generated translations from earlier variants.
Source and dependencies
The approach is inspired by ReVIctory 925ac0a3. This PR includes the one-commit extension reviewed in fork PR #2. It needs neither upstream #303 nor the native RayQuery stack. Test with the independent scalar uniform-handle optimization in #302 when evaluating the whole stack.
Quantified improvements — synthetic translation fixtures
For eligible consecutive loads sharing a proven 64 KiB page, the emitted descriptor-handle count scales as follows:
These are emitted-handle counts, not measured GPU instruction counts or FPS gains. Rejected cases retain byte-identical DXIL in the reported fixtures.
Evidence from related implementations
ReVIctory 925ac0a3 identifies seven consecutive TLAS matrix loads as a real coalescing opportunity and describes reducing them to a single directory lookup and handle. Its implementation supports a runtime page-fit check; this PR instead requires a static proof and preserves each original fault note. The other fork reports successful DXIL validation and PSO compilation of five RT shaders on RX 9070 XT for its broader change, not isolated timings for load clustering.
Issue #14 reports low occupancy (typically 25–40%), GPU idle time of 4.35%, and long-lived small waves on RX 9070. Dependent accesses to system-memory-backed title data are a plausible explanation, not a proven attribution. Reducing repeated directory selection addresses one part of that dependency chain.
Why this should be merged
This offers a bounded, independently switchable way to reduce repeated guest-address lookup work without reading gaps or weakening page, guard or fault semantics. It is suitable for opt-in evaluation alongside #302 and #301. With #262 enabled, some software-traversal opportunities may disappear; measure remaining active builder and general rendering shaders before judging net benefit.
Validation
The extended standalone branch previously passed 283 portable shader tests, with two ignored, and the diagnostics Windows-target check. Synthetic translation fixtures emitted one descriptor handle for eligible groups of 2–8 loads and verified byte-identical DXIL for rejected page crossings, overlapping destinations and other rejected ranges. The Phase 2 combination passed 293 portable shader tests, with two ignored, and both Windows-target modes. These results were reused for this publication update.
Limits and testing
Hardware benchmarking was unavailable. Real shader coverage, driver validation, register pressure and frame-time impact remain unverified. Please compare the same RT-enabled route on RX 9060 XT 16 GB at native 1080p and RX 9070 XT at native 1440p with frame generation disabled. Collect compiler and GPU timings for the shaders this affects. Use
VICTORY_CLUSTER_GUEST_LOADS=1to opt in and unset it to restore ordinary lowering.shader: share a directory lookup for proven guest load pairsto shader: share directory lookups across proven same-page guest-load clusters@lucamzanon on GitHub · 2026-12-03 13:02 UTC · original · edited 2026-12-03 13:25 UTC
Automated A/B/B/A Benchmark Feedback (RX 9070 XT / Linux RADV)
Test setup:
RADV GFX1201), Ryzen 7 5700X, 46 GB RAM, Ubuntu 26.04.1 LTS (kernel7.0.0-44-generic), repo-built Mesa 26.3.1 RADV + vkd3d-protonVICTORY_BENCH=rt,VICTORY_BENCH_MINUTES=2(first 60 s discarded, second 60 s measured), 2560x1440 → 4K FSR 4 Quality, no Frame GenerationA -> B -> B -> A(4 runs per scene), identical save restored before every run, shared warm pipeline cache (94,199 pipelines), clustered shaders pre-translated (./run.sh shaders VICTORY_CLUSTER_GUEST_LOADS=1, 25,694 shaders in 108 s)main(842767a)44f5b82),VICTORY_CLUSTER_GUEST_LOADS=1Results:
2m x 4)30.75 fps(31.0/30.5) /10.4530.45 fps(29.9* /31.0) /10.70-0.98%avg (+1.64%warm B vs A2) /+2.39%1% low2m x 4)21.25 fps(21.5/21.0) /6.4521.45 fps(21.4/21.5) /6.20+0.94%avg /-3.88%1% low*Boat Run 2 (B) took 248.9 s vs ~142 s due to first-time RADV pipeline compilation for the clustered shaders; Boat Run 3 (warm B, 144.2 s) hit
31.00 fpsavg /11.00 fps1% low vs Run 4 (A)30.50 fps/10.50.Per-run Prison breakdown (all warm):
21.50 fps(1% low6.10, peak28.30)21.40 fps(1% low6.20, peak29.80)21.50 fps(1% low6.20, peak29.00)21.00 fps(1% low6.80, peak27.90)Summary: Zero crashes or visual issues. On RX 9070 XT at 4K RT (heavily GPU-bound), warm performance is neutral to slightly positive (~+0.9% to +1.6% avg, higher peak FPS on Prison: 29.0–29.8 vs 27.9–28.3).