Shaders: a live set's registers are walked by their bits (port of Marvisak#1833) #651
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/651"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T02:45:13Z.
The change
members(crates/victory-shader/src/ir.rs) returns the registers of a live set. It tested every one of the 513 places of aRegSetto find the few that are set, and it runs twice for each block of a program.It now walks the set's nine words by their lowest set bit (
trailing_zeros, thenbits &= bits - 1), and gives the registers in the same order. Onlyinsertsets bits, so none lies pastREGS; one there would end the walk rather than reachreg_at.This is a port of slatefield's change (Marvisak/VIctory#1833). It measured
ir::build4.5 % faster, andrange::build4.1 % faster, on synthetic GFX10 programs of 12,000 and 24,000 instructions. I did not measure it again here.It is a change to the translator's source, so cached translations are made again once (
VICTORY_TRANSLATOR).Tests
ir::tests::a_live_set_walked_by_its_bits_is_every_place_tested. It compares the walk with a test of every place for:cargo test -p victory-shader --locked: 291 passed, 4 ignored.cargo clippy -p victory-shader --all-targets -- -D warnings, with and without--all-features: no warnings.No game files, dumps or extracted data are included.