[bug] A guarded write that keeps a refused value reads 0 in the other lanes (wrong accept in write_placed / fill_phis) #256
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T05:31:43Z.
What is wrong
Lower::write_placedbuilds a guarded register write asselect(guard, new, old). Whenoldis a join that nothing has read yet, commita7fc47afun-marks the join as read.fill_phisthen puts 0 on an edge that carries a value we refused to translate. So this shape translates on main:and the then-lanes read 0. A GPU probe with a synthetic program showed it.
a7fc47af's own case is fine: there the kept value is overwritten by an unguarded write before any read. The shortcut is only right when no lane outside the guard reads the kept result.
How many shaders
Measured over the corpus with a lane-aware measurement patch (it tracks the set of lanes that still hold the kept value, and counts a read only if the reader can see such a lane):
The 616 keep their exact output. None of the G-buffer, culling or mesh-record shaders is among the refused. 346 is an upper bound on "wrong today", not a count: many of the 336 are probably harmless but not proven.
The 336 pixel refusals by the refused value they keep: 191 the first half of an interpolation, 69 barycentrics read directly, 52 a descriptor read only as data, 24 a hardware SGPR input.
Plan
Related, not yet decided
place_bitsand the 16-bit keep also turn a missing old value's kept bits into 0. 794 translating shaders reach that code (almost allv_interp_p2_f16writing the low half over a dead intermediate). Whether the kept half is ever read is not measured.Help wanted
Proofs, or counter-examples, for the two win-back rules. A counter-example as a synthetic program is as useful as a proof.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by gagarinyury on 2026-11-27T10:30:32Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T10:30:43Z.
Claimed by @gagarinyury. Open a draft pull request with
Refs #256in its description within 24 hours, or the claim expires.