A spilled SGPR reloaded inside a whole-wave section is refused in pixel programs (8 shaders) #421

Closed
opened 2026-11-27 17:39:03 +00:00 by github-bot · 3 comments
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 17:29 UTC · original

A small shape from #4: "a cross-lane operation outside compute: v_readlane_b32 of a constant lane in a pixel program" is refused in 8 pixel shaders of my corpus (26,849 shaders, Series S, main b998bb6).

In each one, the v_readlane_b32 reloads an SGPR the program spilled to a VGPR lane (v_writelane_b32 v127, s15, 1, then v_readlane_b32 s54, v127, 1). The reload sits inside a whole-wave section (s_or_saveexec -1 ... restore), just before a reduction. Outside a section, Lower::spill_slot already turns such a reload into the spilled SGPR. Inside one, the section's shape is Shape::ReadLane, a real lane read, which a pixel program cannot make.

Plan: for Shape::ReadLane, take the spill slot when every path fills that lane with v_writelane_b32, as outside a section. Add a test and a by-output sweep.

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 17:29 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/417) A small shape from #4: "a cross-lane operation outside compute: v_readlane_b32 of a constant lane in a pixel program" is refused in 8 pixel shaders of my corpus (26,849 shaders, Series S, main `b998bb6`). In each one, the `v_readlane_b32` reloads an SGPR the program spilled to a VGPR lane (`v_writelane_b32 v127, s15, 1`, then `v_readlane_b32 s54, v127, 1`). The reload sits inside a whole-wave section (`s_or_saveexec -1` ... restore), just before a reduction. Outside a section, `Lower::spill_slot` already turns such a reload into the spilled SGPR. Inside one, the section's shape is `Shape::ReadLane`, a real lane read, which a pixel program cannot make. Plan: for `Shape::ReadLane`, take the spill slot when every path fills that lane with `v_writelane_b32`, as outside a section. Add a test and a by-output sweep.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:39:03 +00:00
Author
Owner

@⁠tiagonogueiraa-bit on GitHub · 2026-11-27 17:29 UTC · original

/claim

**@⁠tiagonogueiraa-bit** on GitHub · 2026-11-27 17:29 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/417#issuecomment-7224467999) /claim
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-27 17:29 UTC · original

Claimed by @⁠tiagonogueiraa-bit. Open a draft pull request with Refs #417 in its description within 24 hours, or the claim expires.

**@⁠github-actions[bot]** on GitHub · 2026-11-27 17:29 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/417#issuecomment-7224471345) Claimed by @⁠tiagonogueiraa-bit. Open a draft pull request with `Refs #417` in its description within 24 hours, or the claim expires.
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-28 00:36 UTC · original

Thank you for this. It is fixed on main by #423. I have not checked every case from this report in the game myself, so please retest on main a6a58361 and reopen this if you still see it. Closing as fixed.

**@⁠LakshanSivakumar** on GitHub · 2026-11-28 00:36 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/417#issuecomment-7231040872) Thank you for this. It is fixed on main by #423. I have not checked every case from this report in the game myself, so please retest on main a6a58361 and reopen this if you still see it. Closing as fixed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.