Shaders: a lane mask spilled to a VGPR lane is still that mask #1074
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!1074
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1074/head"
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?
@undeadhuman37 on GitHub · 2026-11-24 15:28 UTC · original
undeadhuman37:fix/mask-spill→main· +168 −4 · 3 files · 2 commits · closed without mergingThe 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
The console compiler spills scalars, lane-mask pairs among them, with v_writelane_b32 into constant lanes of a VGPR and restores them with v_readlane_b32 of the same lane. The restored pair was an opaque mask, so the 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"). structure now 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). Offline corpus, against fix/mask-phi-ballot (neither branch carries #585): vertex/pixel programs emitted 12250 -> 12269, compute 1443 -> 1452, "a lane-mask join of an untracked mask" 20 -> 0, "an opaque lane mask" 29 -> 8, "a conditional export" 8 -> 0. Synthetic pixel program fails before, lowers after. Stacked on fix/mask-phi-ballot (shares its test helper). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>@LooperSalty on GitHub · 2026-11-24 16:37 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 00:31 UTC · original
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