Shaders: reuse decoded instructions across range rebuilds #3357
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!3357
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3357"
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?
@borosf on GitHub · 2026-11-26 20:24 UTC · original
borosf:vibe/shader-decode-once-4b7f→main· +100 −9 · 2 files · 1 commits · openSummary
range::buildand reuse its decoded instructions across M0-bound induction rebuilds.v_movrel*, avoiding clone overhead in the common case.v_movreld_b32loop regression. The cached path accepts an already-decoded stream; the legacy reference takes more than one decode/build round, and the test compares their IR and structured output.Claim: #1633
Census timing
Warmed binaries, wall-clock median of five on this machine (
CARGO_TARGET_DIR=C:\\Users\\bkora\\VIctory\\target):mainThis all-opcode synthetic census completes its test body in 0.03–0.04 s, so Cargo/process startup dominates these wall-clock samples; it does not include a loop-heavy title shader. The change specifically removes repeated decode work for M0-bounded relative-move loops.
Verification
Result: 301 passed, 2 failed, 3 ignored. The two failures match pristine-main Intel Arc B580 baseline failures:
emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zerosemit::valu_tests::fspx_programs_run_with_the_hardwares_dot_productsAll passed.
cargo xtask policy: 191 files OK.Formatting was checked without
cargo fmt:ir.rs: 2/2 rustfmt diff hunks versusorigin/main;range.rs: 0/0.Synthetic tests only; no game data used.
@Dukestar69 on GitHub · 2026-11-26 20:29 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).cargo test -p victory-shader --lib ir:: -- --test-threads=1: 9 passed, 0 failed.cargo test -p victory-shader --lib range:: -- --test-threads=1: 4 passed, 0 failed (includingan_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structure).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@borosf on GitHub · 2026-11-26 20:38 UTC · original
Independent local verification at head
f389683on Windows 11 x64, Intel Arc B580 12 GB:emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products), pristine main fails them too. New regression testrange::tests::an_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structurepasses.-D warnings.range.rs; the non-movrel path is untouched.Synthetic tests only; no game data used.
@fuzeofficlal on GitHub · 2026-11-26 21:02 UTC · original · approved these changes
LGTM — verified against
origin/main(63bcca43) on Windows x64.range::buildand passing it throughir::build_bounded_decodedpreserves identical IR and structured control flow across M0-bounded rebuilds, while leaving non-v_movrel*programs on the existing move-only path without extra cloning.range::tests::an_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structure(crates/victory-shader/src/range.rs),legacy_decodescounts the legacy reference passes in the test closure rather than directly instrumentingrange::build.cargo test --locked -p victory-shader --lib -- --test-threads=1 ir:: range:: structure:: resource::: 61 passed, 0 failed, 1 ignored (includingan_m0_bounded_loop_decodes_once_and_keeps_its_ir_and_structure).cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): clean.cargo xtask policy: 191 files ok;rustfmt --edition 2024: clean on changed hunks.Synthetic tests only; no game data used.
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.