shader: prove a graphics formatted load whose table pointer copy is in a block above #3690
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3690
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3688"
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?
@Not-Saii on GitHub · 2026-12-01 01:42 UTC · original
Not-Saii:shader/graphics-formatted-pointer-copy→main· +12 −5 · 3 files · 2 commits · merged 2026-12-01 03:13 UTCRefs #3480 (item 3).
Change
A formatted buffer load (
buffer_load_format_*) placed after the entry block needs proof that its four descriptor words are the table's. The block proof (formatted_descriptor_from_block) accepts a table load in the same block as the use. #2461 extended it to a load made through ans_mov_b32copy of a root table pointer made in an earlier block, provided that copy is the last write to the pointer on every path. That extension was limited to compute (kind == 'cs'). Its PR says graphics "keep the previous rule", and its review thread gives no technical reason.formatted_pointer_copywalks the instruction graph and does not depend on the stage. This change removes the gate, so vertex and pixel stages follow the same copy. Compute behaviour, refusal texts and emitted HLSL/manifest shapes are unchanged.#3488 added the predecessor (join) proof for #3480 item 3. That proof covers a table load in an earlier block. The shape here is different: the table load is in the use block, and only the pointer copy sits in the entry block (
s_mov_b32 sLo, sTable;s_mov_b32 sHi, 0). In a local census of one run, every graphics and render-target-variant request refused with this message had this shape. With this change, all of them get past the proof. None translates fully yet: the next first refusals areimage_sample_lz modifier d16andv_readfirstlane_b32 requires a proven uniform source.Tests
tests/startup_vertex_fetch_formats_check.py controls:srv 0 buf table 0 0in the manifest and the FORMAT switch in the vertex HLSL, and the copied pair's high word is set to 0 as in the measured shape.s_cbranch_scc0writes the pointer copy again. It is refused with... local table load.formatted buffer load requires descriptor words proven in the entry block or a local table load.Commit
9e77e6f4(on maina3bfd019), Windows 11, Python 3.11, each exit 0:Not run or not covered
startup_vertex_fetch_formats_warp/_hardwareorstartup_mubuf_descriptor_*. No emitted HLSL shape changes, so the existing readbacks apply to the newly accepted programs unchanged.s_loadhandler treats a table pointer as 32 bits wide, so this is a pre-existing modelling limit, not one this change adds. Requiring the check here would also change compute behaviour.formatted_descriptor_from_blockis also used byspill_word_provenand by the two formatted store proofs. In graphics stages they now accept the same copy. Their checks above pass.startup_vertex_fetch_formats_check.pyat a different hunk. "Buffer load through a modified descriptor" in pixel stages is #3100's scope and is not touched here.🤖 Generated with Claude Code
@lukaslw-lab on GitHub · 2026-12-01 01:58 UTC · original · approved these changes
Reviewed
9e77e6f4by reading the diff; not built or run.Verdict: approve. The removed gate was not doing any work.
formatted_pointer_copy→descriptor_last_writersis a walk over the instruction graph that does not depend on the stage. #2461's own mutation table lists "thekind == 'cs'gate dropped" as surviving, because no fixture separated stages. No MUST.kind == 'ms',gfx2hlsl.py:2550), so mesh programs now accept the same copy. The body and the doc line (experiments.md:623) name only vertex and pixel. Mentioning mesh there, or adding a one-line mesh control, would make that visible on the P0 path.descriptor_last_writersreturns two writers, soformatted_pointer_copyreturnsNone(gfx2hlsl.py:7836-7848) and the block proof refuses. It is not refused for another reason.None(theindex is Nonearm), and an unknown ('any') writer ends the walk on a non-s_mov_b32.s_swappc_b64, is accepted only at offset 0 (gfx2hlsl.py:1389). That is before any pointer copy, so it cannot hide a write between the copy and the load. The source pointer is still checked byformatted_pointer_reachesup to the copy.Tests: the changed positive control proves a VS with
s_mov_b32 s10, s8; s_mov_b32 s11, 0in the entry block and the table load in the use block now translates (manifestsrv 0 buf table 0 0, the FORMAT switch). The new negative control proves that a rewrite on one arm is refused. CI did not run either:startup_vertex_fetch_formats_controlsis not in the Windowsprfilter or in the Linux job's script list, so the author's local run is the only one.