shader: a spilled SGPR reloaded inside a whole-wave section is the SGPR (#417) #423
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!423
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-419"
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?
@tiagonogueiraa-bit on GitHub · 2026-11-27 17:31 UTC · original
tiagonogueiraa-bit:shader-section-spill-readlane→main· +32 −0 · 3 files · 1 commits · merged 2026-11-28 00:28 UTCRefs #421
Shape. 8 pixel shaders were refused as "a cross-lane operation outside compute: v_readlane_b32 of a constant lane in a pixel program". In each, the
v_readlane_b32reloads an SGPR the program spilled (v_writelane_b32 v127, s15, 1…v_readlane_b32 s54, v127, 1), inside a whole-wave section just before a reduction. Outside a section,Lower::spill_slotturns such a reload into the spilled SGPR. Inside, the section simulation givesShape::ReadLane, a real lane read, which a pixel program cannot make.Change. When every path fills that lane with
v_writelane_b32(spill_slot(.., make = false)succeeds),Shape::ReadLanereturns the spill slot instead of a lane read. Any otherReadLaneis unchanged. In compute this case would also have read the lane, which holds the same SGPR, but no compute output changed in the sweep.By-output corpus sweep. 26,849 containers from my own runs (Series S, boot to the story load), native host options, main
b998bb6against this head:Gained:
1a3e1defd07a2f26,32d13d5707f5750d,62f33c0ea0b0698a,8d9a7c1b0dc8de53,c9489a35f1a79d0d,ee454af0cba74869,f1958b1a9d66126f,ff06abebd5ca9be3. All 8 convert with Apple's Metal Shader Converter 4.0 beta 3.Test.
emit::gfx_refusal_tests::a_pixel_program_reads_back_a_spilled_sgpr_inside_a_whole_wave_sectionis the existing two-path spill test's shape inside a section. It lowers with noWaveReadLaneAt. On main it is refused with the message above.Checks.
cargo test -p victory-shader -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 1054 passed, 0 failed, 11 ignored.-D warnings: clean.cargo xtask policy: ok.docs/native-host.md(whole-wave sections) has a short note. @Olima34, for the board.