Port the sparse live-register walk from VIctory and Darner #147

Manually merged
github merged 2 commits from github-bot/gh-147 into main 2026-12-05 20:45:50 +00:00 AGit
Owner

@⁠yyc160 on GitHub · 2026-12-05 19:43 UTC · original
yyc160:perf/iterate-live-registers → main · +29 −4 · 1 files · 2 commits · merged 2026-12-05 20:42 UTC

Port slatefield's sparse live-register iterator from VIctory (original project change #1833), also present in Darner's shader IR. Credit for the algorithm belongs to its original contributor.

The SSA builder enumerates live register sets per block. Walk the set bits in each word instead of probing all 513 possible register indices. The order is unchanged, including the SCC boundary; bits past the last register are not emitted. No changes to decoding, cache format, or shader semantics. As with other translator-source changes the translator cache key changes once.

Checks: cargo test --release --locked -p larp-shader --lib. The regression compares sparse, boundary and padded dense sets against the full-scan reference. A separate CPU-pinned ABBA comparison of complete ir::build calls used generated branching programs, not game shaders. Median of 14 runs per binary: 513 blocks, 1.794 -> 1.685 ms; 2049 blocks, 7.253 -> 7.189 ms. The complete IR fingerprints matched for both. The second timing difference is small relative to run-to-run variation. No claim about gameplay FPS.

AI-assisted by GPT-6.2 Astra.

**@⁠yyc160** on GitHub · 2026-12-05 19:43 UTC · [original](https://github.com/gamingwithhomie/larp/pull/147) `yyc160:perf/iterate-live-registers` → `main` · +29 −4 · 1 files · 2 commits · merged 2026-12-05 20:42 UTC Port slatefield's sparse live-register iterator from VIctory (original project change #1833), also present in [Darner's shader IR](https://github.com/tyr0nsur/Darner/blob/75441c1b5a84ecfe1592ec11eb3f789fc47c50ec/crates/darner-shader/src/ir.rs). Credit for the algorithm belongs to its original contributor. The SSA builder enumerates live register sets per block. Walk the set bits in each word instead of probing all 513 possible register indices. The order is unchanged, including the SCC boundary; bits past the last register are not emitted. No changes to decoding, cache format, or shader semantics. As with other translator-source changes the translator cache key changes once. Checks: `cargo test --release --locked -p larp-shader --lib`. The regression compares sparse, boundary and padded dense sets against the full-scan reference. A separate CPU-pinned ABBA comparison of complete `ir::build` calls used generated branching programs, not game shaders. Median of 14 runs per binary: 513 blocks, 1.794 -> 1.685 ms; 2049 blocks, 7.253 -> 7.189 ms. The complete IR fingerprints matched for both. The second timing difference is small relative to run-to-run variation. No claim about gameplay FPS. AI-assisted by GPT-6.2 Astra.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:49:25 +00:00
github-bot referenced this pull request from a commit 2026-12-05 20:45:11 +00:00
github manually merged commit e4fbad8665 into main 2026-12-05 20:45:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.