Stop scanning the whole shader on every descriptor-load lookup #88
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/88"
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 Belobug/VIctory-Belobug-AMD. Originally posted by romainhedouin on 2026-11-25T13:43:32Z.
Descriptor loads asked every instruction of the shader whether it reads a value, several times per load, so cost grew with loads × program size. After 32 such scans, the readers come from a map built once per shader, and the loaded descriptor leaves are listed once, in order. The functions the original change touched no longer exist on
a-publier; this fixes the scans that replaced them.loweronly, synthetic programs (Mac, release, medians)Tested:
cargo test -p victory-shader --releasepasses on macOS, and the DXIL of all 17,316 lowerings it runs (the unit tests plus a temporary corpus with 700 descriptor-heavy programs, on both sides of the 32-scan threshold) hashed the same before and after; the Windows GPU tests and the game'sshaders.rpfwere not run.🤖 Generated with Claude Code
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ySKELLETONX on 2026-11-25T16:35:54Z.
Tested on an RX 7600 XT 16 GB (RDNA3, Navi 33), driver 32.0.32015.2008, Windows 11 Pro build 26300, Rust 1.98.1, at
432e92a:cargo test -p victory-shader --lib --locked: 266 passed, 0 failed, 6 ignored, hardware dispatch tests included (mainat01aadd1: 266 passed). Workspace tests only; not run in the title.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by adrianmjim on 2026-11-25T17:47:29Z.
Checked against the game's
shaders.rpfon an RX 7900 XT (Windows 11 build 26300, dxil.dll 10.0.26100.0), with this PR (432e92a) applied to01aadd1and its own target dir.victory translate --validate --list --host-lanes 32-64with a hash of every emitted program's DXIL (a local, uncommitted patch): all 25,623 emitted programs are byte for byte the same as on01aadd1, and the counts are unchanged (VS/PS 14,247/14,247, CS 2,682/2,682, MS 8,694 of 8,765). Two runs of01aadd1give the same hashes, so the comparison is deterministic.cargo test -p victory-shader --lib -- --test-threads=1: 266 passed, 0 failed, 6 ignored. Not run in the game.(I did not time it: the machine was running other jobs, so the translate times are not comparable.)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.