victory-shader: decode once across bounded-loop IR rebuilds (DECODE-ONCE-BOUNDED-RANGE / #3357) #3709
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3709"
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 cloph-dsp on 2026-11-28T10:10:42Z.
Depends on: #1633
What
Decode each GFX10 program once and reuse the decoded instruction list across the bounded-loop IR rebuilds in
range::build. Previously every iteration of the M0 induction re-rangfx10::decode; now a program with relative moves is decoded once and each rebuild takes the already-decoded instructions.A fast path covers programs with no
v_movrel*/v_swaprel_b32instructions: it builds and structures the IR once and returns, so such programs never enter the induction.Change
crates/victory-shader/src/ir.rs: exposedecode(),build_bounded_decoded()andbuild_bounded_owned()(pub(crate));build_bounded()now decodes once and delegates.crates/victory-shader/src/range.rs: decode once inbuild(), addbuild_decoded()/build_with()so the induction reuses the list; factorrelative_name()for the fast path; add synthetic testan_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structure.Validation
Windows, Rust 1.100.0/MSVC, per-worktree
CARGO_TARGET_DIR,CARGO_BUILD_JOBS=2,--locked:cargo test --locked -p victory-shader --lib -- range::tests::an_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structure --exact --test-threads=1 --quiet-> 1 passed, 0 failed, 305 filtered, exit 0.git diff --check origin/main HEAD-> clean.The test asserts the cached build equals both the public
build()and an uncached rebuild that counts decodes (>1), and that the structured IR fields (exits, guards, reach, masks, other, highs, active, restored, discards) match.AI-assisted: Hy4 flash. GPU/driver: N/A (pure CPU synthetic shader). No game data, assets, extracted shaders, DRM or decrypt used.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T10:46:19Z.
I compared
1af7df4against the exactmainrange builder on 12 generated shaders. The programs and compared structured fields matched for Wave32 and Wave64, with and without the bounded relative-move loop.d1c523dsits directly on your head and adds a forward-branching shader with no relative moves. It compares the fast path with a direct IR build and structuring in both wave widths. All five range tests, strict shader Clippy, and the asset policy passed. The timing fixture was temporary and uses no title data or GPU.@cloph-dsp, the test is ready to cherry-pick if you want the fast path covered alongside your loop test. Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the test into your commit.AI-assisted with OpenAI Codex.
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.