Repository navigation
Shaders: avoid quadratic planning on unconditional empty-block chains - #2640
SinisterRob wants to merge 1 commit into
Conversation
|
Reviewed: two changes, both right. |
|
Independent verification of head
Independent verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or shader names were used. Each PR head was merged (no conflicts) onto |
…al empty-block chains
|
Automated triage for the maintainers. In This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64:
cargo test -p victory-shader --lib emit::bitcode::tests: 12 passed, 0 failed, 1 ignored.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).
Folding a linear chain of empty blocks walks the growing chain twice per block. The writer follows predecessor links back to the source, then scans the source’s successor through the folded blocks to check whether two edges land at the same target.
This change records the resolved source when accepting a fold. If that source later folds, its link still leads to the final source. With only one outgoing edge the source cannot split a critical edge or reach the target twice, so the planner can skip the duplicate-edge walk. The existing cycle check still runs before accepting the fold.
These are CPU planning times, median of nine calls to
Module::planon a prebuilt module, using an optimized standalone Linux test build ofbitcode.rs(rustc 1.97.0). Each module consists of a straight chain of branches ending in a return. All four emitted byte streams matched the base revision. I also compared emitted bytes on 10,000 seeded small control-flow graphs containing branches, joins and back edges. All matched. The 12 existing non-ignored writer tests passed.Title shader chain lengths and frame-time impact are unmeasured. This is independent of the phi correctness change in #2622. AI-assisted, synthetic inputs throughout.