Shaders: walk a live set's registers a bit at a time #1831
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1833"
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?
Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-24T23:08:48Z.
members()bit-tests all 385 register slots and returns the few that are live, twice per block. a 1651 block shader = 1.27M tests per translation for nothing.now it walks the 7 u64 words by their lowest set bit (
trailing_zeros,bits &= bits - 1), same register order out. the set only ever gets bits frominsert(reg), so nothing past 385 can be set.measured (min of 5, alternating binaries, taskset): ir::build -4.5% on 12.1k and 24.2k instruction synthetic GFX10 programs, range::build -4.1%. 118 lib tests pass.
not #369 (CFG traversal) or #1757 (operand arena).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:52:14Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.Live set registers walked a bit at a time: replaces per-register iteration with bit-scan liveness — perf refactor in the liveness analysis.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:15:22Z.
NVIDIA run: RTX 3070 8 GB, driver 616.56, plus WARP, Windows 11, debug,
f52b800(onmain70564ae).cargo test -p victory-shader --locked: 206 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA heap-cap failures onmain, so there are no new failures.AI-assisted (Claude Code). Synthetic tests only.
Imported from Marvisak/VIctory. Originally posted by dcastell1 on 2026-11-24T23:42:01Z.
Verified on native Windows (no Wine): NVIDIA GeForce RTX 5090 (driver 621.24), Windows 11 10.0.26300, Rust 1.98.1, MSVC 14.44.35207, debug build.
main@ffe310ebaseline on this box: 342 passed, 0 failed, 6 ignored.Same count as the baseline: walking a live set's registers a bit at a time changes no verdict here.
Tree restored afterwards; no game data. AI-assisted (opencode).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:32:51Z.
Automated triage for the maintainers.
Merge candidate.
membersincrates/victory-shader/src/ir.rswalked all 385 register indices and tested a bit for each. It now visits only the set bits, word by word, withtrailing_zeros. I checked that it is equivalent. The order is the same, ascending index, which the callers rely on ("inRegorder").RegSetis[u64; REGS.div_ceil(64)], and bits pastREGSare never set, so the extra 63 bit positions in the last word yield nothing. The change is small and local, on a path the liveness analysis runs for every instruction.No measurement is given. A before/after time for
translateover a pack would show how much it saves.CI: no check runs on the head commit.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T12:19:22Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
f52b8006ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).