Shaders: visit resource::track blocks in reverse postorder #2422
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!2422
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2422"
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?
@makmatvey on GitHub · 2026-11-25 13:12 UTC · original
makmatvey:cursor/shaders-rpo-resource-track-a13d→main· +45 −1 · 1 files · 1 commits · openWhat
resource::trackwalked blocks in vector index order. After CFG transforms that append blocks (for examplesplit_irreducible), a lower-indexed consumer could run before a higher-indexeds_loadproducer, soout.scalardid not yet hold the load when the consumer looked it up and waterfall / descriptor tracing missed it.Tracked as VIC-BT-024 in #1249. Focused slice of the stalled bundle in #1336 (needs rebase); does not include the SMEM alignment or lane-index pieces of that PR.
Change
In
crates/victory-shader/src/resource.rs, the main walk usesreverse_postorderso producers populateout.scalarbefore consumers.Tests
cargo test -p victory-shader --locked --lib track_visits_blocks_in_reverse_postorder— pass (fails onmainwithout the walk change)cargo test -p victory-shader --locked --lib resource::— 34 passedcargo clippy -p victory-shader --locked -- -D warnings— cleancargo xtask policy— okNo game data used.
Fixes VIC-BT-024 in #1249.
@oni-swr on GitHub · 2026-11-25 13:34 UTC · original
WARP verification
Tested: PR head
750445401e3f486a75cb58a5dcfd4d1fd01c83e2, onorigin/main940d32f69b22265690a0b5a15d6ded572ba33baf(the PR is one commit on that base, so the merge was a no-op).Environment:
VICTORY_D3D12_WARP=1(software WARP), Windows 11 Pro 10.0.26200, rustc 1.98.1, DXC 1.9.0.5512 (dxcompiler), dxil.dll 1.8.2502.11 onPATH.cargo test -p victory-shader --lib --lockeddefect_test, all ignored on main too)cargo clippy -p victory-shader --all-targets --locked -- -D warningscargo xtask policyasset policy: 182 files ok, exit 0The new test
resource::tests::track_visits_blocks_in_reverse_postorderran and passed (not skipped).Diff review (
resource.rsonly):tracknow iteratescrate::ir::reverse_postorder(&p.blocks)instead of index order. It compiles against main as-is, so the helper already exists. There are no process, network or filesystem actions. I did not check what happens to blocks that are unreachable from the entry, which reverse postorder would not visit. That is worth confirming iftrackpreviously processed them.Limits: WARP only, no physical hardware GPU, no game files or dumps. The test uses synthetic instruction words only.
AI use: Claude Code (Claude Sonnet 5.5)
@Marvisak on GitHub · 2026-11-25 15:32 UTC · original
Automated triage for the maintainers.
Needs work (test). This makes the main walk of
crates/victory-shader/src/resource.rstrackuseir::reverse_postorder, the order lowering already uses (emit/lower.rs); it is plausible and small, and unreachable blocks are now skipped, matching what lowering emits. Intrack, only one lookup depends on the order:out.scalar.iter().find(|s| s.0 == load), which decides whether an access joins the waterfall offset path (offset_at->waterfall.loads). The new test does not check that effect: it checks the order of entries inout.scalar(what the code does, not what the result should be), anddescriptors[0].source == Loaded { load: (2, 0), .. }, whichTracer::descriptorcomputes independently of the order, so it holds onmaintoo. Please add a test whose result differs onmain, for example a lower-indexed block reading a table offset throughv_readfirstlaneand loading the descriptor from a higher-indexed block, assertingr.waterfall.loads; ideally also name a shader that hits this. CI: passing.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 16:53 UTC · original
Right fix for the ordering bug: index order isn't a topological order — a producer in a higher-indexed block (e.g. appended by
split_irreducible) was visited after a consumer that needed it. RPO gives producer-before-consumer for every reachable edge except irreducible-loop backedges, which is the best a forward dataflow can do anyway.ir::reverse_postorderexists and the regression test pins exactly the split-block scenario.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.