Shaders: a lane mask spilled to a VGPR lane is still that mask #1074
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1074"
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 undeadhuman37 on 2026-11-24T15:28:32Z.
The console compiler spills scalars, lane-mask pairs among them, with
v_writelane_b32into constant lanes of a VGPR and restores them withv_readlane_b32of the same lane. The restored pair was an opaque mask, so selects, EXEC writes and joins that used it refused ("a select on an untracked mask", "an opaque lane mask", "a lane-mask join of an untracked mask").structurenow follows a constant-lane readlane back through a plain chain of writelanes to the scalar written to that lane, and gives the restored pair that scalar pair's mask. A chain with a phi or another write of the VGPR stays opaque (shortcut noted in code).Stacked: this branch contains the commit of the lane-mask-join PR (shares its test helper), so it should merge after that one.
Measured offline over the shader corpus (26148 programs), against the first commit alone:
Tests: a synthetic pixel program fails to lower before and lowers after.
cargo clippy -p victory-shader --all-targets -- -D warningsis clean. Not run on a GPU, hence draft.No game data. AI-assisted: written with Claude Code (Claude Sonnet 5.5).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T15:32:49Z.
Review: APPROVED
Tested merged cleanly onto
main(ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP:cargo test -p victory-shader: 122 passed, 0 failed, 1 ignored (all hardware + WARP VALU/waterfall/diff tests green on RTX 5090 and WARP)cargo clippy -p victory-shader --all-targets: 0 warningscargo xtask policy: okClean lane-mask spill tracking across VGPR lanes, verified on Blackwell hardware and WARP. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T15:37:33Z.
Review: COMMENTED
Draft noted — this carries the same
emit/lower.rsballot fallback as #1073 plus thestructure.rsspilled()chain analysis (straight-linev_writelane_b32/v_readlane_b32pairs with a constant lane, capped at 64 hops, phi/other writes end the search conservatively). The two tests cover both the scalar-join case and the spilled-mask case, and both run on macOS.Same caveats as #1073, plus one specific to
spilled(): the lane constant is decoded asOperand::Const(128..=192)(lane = c-128), which matches the console spill encoding, but a non-constant lane (v_readlane_b32with a variable lane) returnsNoneand the mask stays opaque — safe, but it means the optimization silently doesn't apply there; a test with a variable lane asserting the refusal (rather than the success path) would document that boundary. Also the 64-hop cap: a longer spill chain silently stops tracking; fine as a shortcut, worth a comment in the code.Verified locally: test-merge with main clean;
cargo test -p victory-shader --locked(macOS arm64, rustc 1.98.1) → 98 passed / 0 failed / 1 ignored.Imported from Marvisak/VIctory. Originally posted by LooperSalty on 2026-11-24T16:37:36Z.
From a tester working with Claude (AI-assisted); measured on my own machine (i7-13700KF, RTX 4070 Super). No game data involved.
We carry the same fix independently (this PR, #298 and our local commit all follow a
v_readlane_b32of a constant lane back to thev_writelane_b32that wrote it), so I am not opening another PR. Our version resolves the restored pair insidestructure.rs's mask lookup, using the same spill map the resource tracer already builds (spilled_sgprs), with a cycle guard for joins through the spill; one test (a_mask_spilled_to_a_vgpr_lane_is_the_mask_read_back, fails without it).Measured offline over the translation corpus on an integration tree (with other open PRs merged), before/after this one change:
If useful, I can post the exact diff or test as a comment here.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:31:44Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Draft. A mask restored from a VGPR lane is that mask in main (structure.rs restored, with a test of the same name). Same as #298.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed