shader: prove formatted load descriptor words across a join #3488
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!3488
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3486"
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?
@Leyukaka on GitHub · 2026-11-29 17:25 UTC · original
Leyukaka:shader-gfx2hlsl-format-load-proof→main· +104 −21 · 3 files · 1 commits · merged 2026-11-30 08:45 UTCRefs #3480 (item 3).
What changes
buffer_load_format_*past the entry block was accepted only when the descriptor load sat in the same block (formatted_descriptor_from_block). A load in an earlier block that dominates the use was refused withformatted buffer load requires descriptor words proven in the entry block or a local table load.formatted_descriptor_from_predecessor(tools/startup/gfx2hlsl.py) adds a second proof. It runs only after the existing checks inmubuf_format: all four words still carry the loaded symbol, the source is a hardware table, and the block proof failed. It accepts when:s_load_dwordx4/8/16is the last writer of all four descriptor words on every incoming path. Any other writer of any word on any path, back edges included, is a second writer and refuses. A path that carries the entry value refuses;glc/dlcmodifiers, a destination covering the four words at the expected position, an immediate offset equal to the descriptor's table offset, and a 64-bit SGPR base;s_mov_b32 s<hi>, 0;s_mov_b32copy, with no write on any path;formatted_pointer_copyis refactored onto the shareddescriptor_last_writerswalk.Refusal texts and conditions are unchanged. One existing control changed meaning: the compute case
s_branch 0followed by the load ("at a branch target there is no local descriptor load to prove") is removed and replaced by an accepted join case, since that is the shape the proof now accepts.This does not touch "buffer load through a modified descriptor" (#3100): that control is unchanged and the new path is reached only when all four words are unmodified.
Tests
New controls:
startup_gfx2hlsl_compute_check.py): join accepted with the same manifest; refused with a word-3 write on one arm, with high word = 1, and with the entry pointer rewritten (s_mov_b32 s6, s6).startup_gfx2hlsl_join_symbols_check.py):s_load_dwordx8join accepted, stride and format taken from the second descriptor; refused with a word-3 write on a forward arm and on a back edge.Passed (17, 0 FAIL): gfx2hlsl_compute, gfx2hlsl_join_symbols, gfx2hlsl_load_desc, gfx2hlsl_compute_spill, gfx2hlsl_readfirstlane_load_recompute, gfx2hlsl_readfirstlane_uniform, gfx2hlsl_tbuffer_16f, gfx2hlsl_heap_record, gfx2hlsl_handler_arity, buffer_address, buffer_format_word3_table, gfx2hlsl_refusals, gfx2hlsl_op_refusals, gfx2hlsl_spill_branches, gfx2hlsl_compute_mask_spill, mesh57_skeleton, vertex_fetch_formats controls.
Mutation: with the predecessor proof walking word 0 only, compute_check fails (
accepted, expected a refusal naming 'local table load') and join_symbols fails (FORMATTED_REWRITE accepted). Restored, both pass.Not run
binary <llvm-mc>modes of compute and join_symbols:llvm-mcis not installed on our host, so the newSOURCE_L_JOINandFORMATTED*word encodings are not checked against an assembler.startup_mubuf_descriptor_checkand thestartup_compute_store_*ctests (need built binaries).gfx2hlsl.py. They merge without conflict; the combined tree was not tested.@lukaslw-lab on GitHub · 2026-11-30 08:20 UTC · original · approved these changes
Reviewed
4a1e9685by reading the diff; not built or run.Verdict: approve. The predecessor proof is a sound reaching-definition check, and stricter than the block proof it sits behind. One SHOULD, which can follow. No MUST.
321e63a9) kept on purpose: "Graphics stages keep the previous rule. Descriptor words loaded in another block than the formatted load stay refused." The new path accepts a cross-block load in every stage, and callsformatted_pointer_copywithout the block proof'skind == 'cs'guard (gfx2hlsl.py:7882vs:7918). So a pixel shader whose table pointer is copied in a block above is now accepted, while theFORMATTED*cases uses[8:9]directly. Say so in the body and add one pixel case with a copy, or keep the guard for the copy.descriptor_scalar_writes(destinations,vcc, a VOP3v_cmpdestination) plusscalar_destinations(movrelgives'any'). Av_readlane_b32reload is a writer that is not ans_load, so it refuses. That is conservative.first[2], onlyglc/dlcare allowed, an SGPR soffset refuses (_lit_u32gives None), and the high word must bes_mov_b32 s<hi>, 0on every path.formatted_pointer_copyrefactor keeps the old behaviour: an entry-reaching path addsNone, and bothlen != 1andindex is Nonestill return None.Tests: the compute join plus three refusals, the pixel
dwordx8join (stride and format from the second descriptor) plus forward-arm and back-edge refusals, and the word-0 mutation all reach the new function. CI ran both files on Linux and inbinarymode withllvm-mc-15in the gfx1013 job (both ok), so the new encodings match the assembler. That closes the body's first "Not run" item.github-bot referenced this pull request2026-11-30 14:26:17 +00:00