Shaders: walk a live set's registers a bit at a time #1833
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1833
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1833/head"
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?
@slatefield on GitHub · 2026-11-24 23:08 UTC · original
slatefield:shader/live-set-bits→main· +13 −3 · 1 files · 1 commits · merged 2026-11-25 21:51 UTCmembers()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).
@upipibi on GitHub · 2026-11-24 23:15 UTC · original
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.
@dcastell1 on GitHub · 2026-11-24 23:42 UTC · original
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).
@Marvisak on GitHub · 2026-11-25 06:32 UTC · original
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
@sinan-cmyk on GitHub · 2026-11-25 12:19 UTC · original
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).