shader: keep structured-to-raw descriptor words at compute joins #3689
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!3689
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3687"
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/raw-conversion-join→main· +85 −2 · 3 files · 1 commits · merged 2026-12-01 03:13 UTCRefs #2274
Change
At a branch target,
tools/startup/gfx2hlsl.pykeeps a descriptor word only when every path brings the samesymbol and
names_one_value()accepts it. The tags thatraw_descriptor_alu()adds to the words of thestructured-to-raw conversion (
stride0,byte_count,oob3) were not accepted. A compute buffer access after ajoin therefore refused with
descriptor operand s[a:b]: sN holds a word joined at a branch target, even when everypath brought the same converted words.
raw_conversion_word()accepts those words at compute joins only (names_one_value()is unchanged). Vertex stagesare unchanged. The spill path still refuses a modified word, as
startup_gfx2hlsl_compute_spill_check.pyrequires.The
joined_wordnote indocs/experiments/startup-gfx2hlsl-cselect-descnum.mdgains one sentence.The byte-count tag covers both products (
NUM_RECORDS * strideandNUM_RECORDS * max(stride, 1)). No computeconsumer reads the count: raw loads and stores are unbounded, and a numeric read of a descriptor word is
refused. #3100 gives the clamped product its own tag (
('byte_count', 'min1')). The new helper checks only thefirst tag, so either merge order keeps both forms at a join.
Fixture
tests/startup_gfx2hlsl_load_desc_check.py(compute case A, source-built words) gains joins after the conversion:runs the clamped conversion and the other the plain one; both arms clear the stride.
joined at a branch target: one arm converts and the other does not; one arm clears the strideonly; a loop enters the load with the loaded words and converts them before its back edge.
numeric use of ...: a vector read of the joined byte-count word, and of a scalar computed from it,after the clamped/plain diamond.
raw_conversion_wordreplaced bylambda sym: False, the kept diamond refuses again.Evidence
Commit under test:
be5efdf7onmain1a9ccbc4(fixture and join checks rerun after the rebase; the retranslation numbers are fromfbb76499ona3bfd019).Single checks, all exit 0:
Offline retranslation of a local set of compute requests that refused with this message (37 programs): none
refuse with it now. 3 translate, and their HLSL compiles with DXC (
cs_6_0). The rest stop at later, separaterefusals: a readfirstlane waterfall body,
s_cbranch_execzjoins, and a descriptor used for both a load and a store.The other 119 requests of the same local batch refuse with the same text as before. A further 223 local compute
requests that already translated give byte-identical HLSL and manifests before and after the change. These are
local results and say nothing about run-time behavior.
🤖 Generated with Claude Code
@lukaslw-lab on GitHub · 2026-12-01 02:02 UTC · original · approved these changes
Reviewed
be5efdf7by reading the diff; not built or run.Verdict: approve. A compute join now keeps the converted words only when every path brings the identical symbol, and the only readers check the whole converted descriptor, never the count. No MUST, no SHOULD.
stride0andoob3name one value on every path.oob3isword | 0x30000000, whether or not theoob0mask ran first, so the two spellings that share the tag give the same bits.byte_countis the one tag that can stand for two values:NUM_RECORDS * strideandNUM_RECORDS * max(stride, 1)differ when the stride is 0. Its only readers,load_descriptorandstore_descriptor(gfx2hlsl.py:7504-7552), compare the four-word tuple and emit an unbounded raw access without reading the count. A single path with either product was already accepted, so the clamped/plain join adds no new run-time case. The two numeric-read controls pin the other way the count could be used.oob0only, or the stride cleared on one arm) still fails at the use, because the consumers need the full(w0, stride0, byte_count, oob3)tuple. The "one arm clears the stride only" control covers the join side of that.kind == 'cs', andnames_one_valueis unchanged, so spill proofs and other stages behave as before.keptentry could otherwise get wrong.Tests: the four kept diamonds prove the join path (
gfx2hlsl.py:4257-4259) translates the same load as one path does. The refused diamonds, the loop and the mutant (raw_conversion_word = lambda sym: False) prove the new condition is what keeps them. CI did not runstartup_gfx2hlsl_load_desc_check.py: it is not in the Windowsprfilter or in the Linux job's script list, so the author's local run is the only one.