perf(shader): speed up control-flow structurisation #1013
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!1013
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1013"
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?
@matheusfrta on GitHub · 2026-11-24 15:02 UTC · original
matheusfrta:patch-1795532539→main· +272 −80 · 1 files · 1 commits · openRebased onto main keeping all recent structurisation fixes (discards, spilled masks, bounded memo). Applies pure BDD implication checking, per-block forced-atom restriction, and dirty-block propagation in paths. Added trailing newline for cargo fmt.
@Zipettte on GitHub · 2026-11-24 15:40 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at cbbb17e:
cargo test -p victory-gpu -p victory-shaderpasses, 173 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:32 UTC · original · edited 2026-11-26 00:21 UTC
Automated triage for the maintainers.
Needs work. Rebased cleanly. The change is now only
crates/victory-shader/src/structure.rs: a recursiveBools::impliesthat no longer buildsand(a, not b), normalization and argument ordering inite, an early contradiction check in the refutation path, and dirty-block propagation. This is a performance change to the code that decides lane masks for every shader, so it needs the two things asked for before. Neither needs game files:crates/victory-shader/benches/guard_runs.rs, which is inmain, to show the speed-up.victory-shadertests plus a check that structured output (or emitted DXIL) is byte-identical on the synthetic programs in the test suite.Also worth a sentence in the description: the new early
return falsewhen the sorted list holds the sameBooltwice changes what that function returns. Say why that is equivalent.On your reply: understood that you have no game dump. The benchmark and the test-suite comparison above don't need one. Until then there is no evidence of a speed-up, and the risk is a silent change in lane masks.
CI: passing.
Generated by Claude Code
@matheusfrta on GitHub · 2026-11-25 01:21 UTC · original
Rebased onto
mainand dropped thepipeline/make.rschanges sincemainalready prioritizes live draws ahead of early starts. All CI checks are passing now with no conflicts.@matheusfrta on GitHub · 2026-11-25 15:33 UTC · original
Fixed the trailing newline in
crates/victory-shader/src/structure.rs.I don't have a game dump available locally to run
victory translateand compare real-world timings and DXIL hashes. If anyone following this PR with the game shaders handy (maybe @Zipettte or @pablogonz12 since it was tested/merged in Scarlight) could share a before/aftervictory translaterun and check the output hashes, that would help verify the speedup on real title shaders.@matheusfrta on GitHub · 2026-11-25 23:10 UTC · original
Rebased onto
main(keeping the recentdiscards/kill_exitchanges) and ensured the trailing newline incrates/victory-shader/src/structure.rs.@catminou4 on GitHub · 2026-11-25 03:56 UTC · original · approved these changes
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.146 passed / 0 failed / 2 ignored. Control-flow structurisation speedup (+2 tests) — perf work on the structurizer; suite green.
@smaxxey on GitHub · 2026-11-26 10:23 UTC · original
Numbers for the two things the triage asked for, neither of which needs game files. Laptop with an i7-13620H, Windows 11 26300, Rust 1.98.1. Head
ab9de6fmerged locally ontomain63bcca4.benches/guard_runs.rs, median per program, three rounds alternatingmainand this PR:mainAbout 1.9× faster on short runs and no change on unmasked; long runs stay within this laptop's noise.
Output unchanged. A local example (not part of this PR) put 312 synthetic compute programs through
range::build→resource::track→io::raise→emit::emit: wave32 and wave64; 0–12v_cmpxnarrowings; runs of 1, 2, 7 and 64 adds; three shapes (each narrowing followed by its run, the same withs_cbranch_execzover each run, and all narrowings first). All 312 DXIL containers are byte-identical betweenmainand this PR, and none is refused on either.Tests.
cargo test -p victory-shader --lib --locked -- --test-threads=1 --skip heap_direct_texture_reads_mark_their_heap_index(that test kills the process onmainhere, #2571): 300 passed, 3 failed. The 3 are the same NVIDIA failuresmainhas on this card (#1835); the 2 more passing are this PR's new tests.Tested with Claude Code's help.
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.