Skip to content

startup: explain formatted MUBUF descriptor refusals - #1965

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
avt0m4t48:fix/startup-mubuf-format-refusal
Nov 24, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
avt0m4t48:fix/startup-mubuf-format-refusal

Conversation

@avt0m4t48

Copy link
Copy Markdown
Contributor

Refs #1809. Give all four non-D16 formatted MUBUF load widths a refusal that identifies the required descriptor FORMAT and DST_SEL fields. Preserve the existing refusal group in startup triage. The documented request-to-binding trace locates the descriptor words and explains what a future lowering needs. No format is inferred from the number of output registers.

python3 -B tests/startup_buffer_address_check.py controls fails on the original translator at the first encoded formatted request and passes with the change. The encoded requests use one synthetic descriptor table and the same address for the formatted refusals, raw MUBUF control and instruction-formatted MTBUF control. python3 -B tests/startup_translator_check.py, the documentation check and git diff --check passed. The agent also ran all 70 Linux workflow Python scripts successfully, with 24 individual optional skips. Windows CTest and GPU execution remain unverified.

Source-built inputs only. AI-assisted using Codex.

@R0Y00
R0Y00 merged commit b1715e1 into R0Y00:main Nov 24, 2026
5 checks passed
@ChazY11

ChazY11 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Ran the control and broke the refusal three ways

Windows 11 build 26300.9974, device-free:

out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls
startup buffer address controls passed      exit 0
out/pe-env/Scripts/python.exe -B tests/startup_translator_check.py    # exit 0
mutation result
the refusal text back to a generic is not lowered caught
the guard covers only _x and drops _xyzw from the tuple caught
the triage grouping regex narrowed to buffer_load_format_xyz only caught

The third is the one I did not expect to be covered: the triage classifier is a separate file (tools/startup/triage_run.py), and
narrowing its alternation means three of the four widths would fall out of the buffer_* instruction group while the translator
still refuses them. The control notices, so the refusal text and the classifier are kept in step by a test rather than by
convention.

The claim I checked and could not find a case for

The description says "No format is inferred from the number of output registers." That is the right rule, and the danger is
concrete: a buffer_load_format_x whose destination happens to be v[4:7] must still be refused, because treating four
destination registers as xyzw would silently read the wrong descriptor fields.

The controls I can see exercise tbuffer_load_format_xyzw v[8:11] (line 255) and the refusals for the four widths, but I did not
find a case pairing an _x/_xy mnemonic with a wider destination. If it is there and I missed it, ignore this; if not, it is the
one case that would catch a future "infer from the destination" shortcut:

# An _x request into four registers must not be read as _xyzw.
refused(shader(opcode_x, dest="v[4:7]"), "requires descriptor FORMAT and DST_SEL")

What is good here

  • One refusal text per width is replaced by a single message naming both descriptor fields (FORMAT, DST_SEL) and their word
    (V# word 3), so a reader of the triage report knows which fields to supply rather than only that the form is missing.
  • Keeping the existing refusal group in the triage report means the census counts do not move because of a message change — the
    reason the regex was touched at all.
  • The documented request-to-binding trace is what makes the message actionable: it says where the descriptor words are, instead of
    only that they are needed.

What this does not establish

Nothing about a draw: the refusals are text-level, and the "future lowering needs these fields" sentence is a plan, not a
measurement. Windows CTest and GPU execution are unverified here, as the description states.

Verdict

Reviewed. Three behaviours pinned, including the triage classifier staying in sync; one case I would add for the no-inference
rule.

Notes

  • AI-assisted review.

@ChazY11

ChazY11 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

#1965 and this PR are green alone and red together — textually clean merge, broken test

Both change the refusal for the same four mnemonics (buffer_load_format_{x,xy,xyz,xyzw}), and both are Part of #1809. I merged
both heads onto current main (889cd3f4) locally:

git merge review-1965   ->  clean
git merge review-1973   ->  clean, no conflict markers

git is happy because the two edits are on different lines — but two refusals now exist for the same instruction:

tools/startup/gfx2hlsl.py:590   raise Unsupported('%s requires descriptor FORMAT and DST_SEL' % base)          # #1965
tools/startup/gfx2hlsl.py:1058  raise Unsupported('buffer_load_format_%s needs the descriptor DATA_FORMAT…')   # this PR

and this PR's dispatch wins, because op_buffer_load_format_x … _xyzw (lines 1052–1070) route to buffer_format_load() before the
older generic path at 590 is reached. Running #1965's own control on the merged tree:

out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls
AssertionError: buffer_load_format_x needs the descriptor DATA_FORMAT, which is not tracked
exit 1

This PR's check still passes (startup_gfx2hlsl_buffer_format_check.py → PASS), so whichever lands second decides whether main is
green.

The triage census breaks silently too

#1965 also narrows a classifier in tools/startup/triage_run.py to keep the refusal in the existing group:

re.compile(r"buffer_load_format_(?:x|xy|xyz|xyzw) requires descriptor FORMAT and DST_SEL\Z")

Checked against both texts:

matched=True   buffer_load_format_xyzw requires descriptor FORMAT and DST_SEL
matched=False  buffer_load_format_xyzw needs the descriptor DATA_FORMAT, which is not tracked
matched=False  buffer_load_format_x needs the descriptor DATA_FORMAT, which is not tracked

So after this PR's text takes effect, those four refusals fall out of the buffer_* instruction group and the census counts move
without anyone editing a test.

What I would do

  1. Pick one message — both name the missing field, and the choice is editorial; the shorter one here (needs the descriptor DATA_FORMAT, which is not tracked) also states why it is missing, which is the more useful half.
  2. Whichever survives, the other PR's guard, its control and the triage regex have to move with it in the same change, so no single
    merge leaves main red.
  3. Please run tests/startup_buffer_address_check.py controls and tests/startup_gfx2hlsl_buffer_format_check.py after a
    rebase, not just your own check — that pair is the failing combination.

I am not asking for either PR to be dropped; the point is that the two are one decision, and it is easier to take it now than after
whichever merges first.

Notes

@ChazY11

ChazY11 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Correction: the case I suggested here cannot be constructed, so nothing is missing

In my earlier review I asked for a case pairing an _x/_xy mnemonic with a wider destination, to pin "no format is inferred from
the number of output registers". Checking the fixture on main after the merge, that state is not expressible at the encoding level:

formats = (('x', 'v6'), ('xy', 'v[6:7]'), ('xyz', 'v[6:8]'), ('xyzw', 'v[6:9]'))
for op, (suffix, dest) in enumerate(formats):
    load = encode_mubuf(op, vdata=6, srsrc=32)
    assert G.decode(load) == [(0, 8, mnemonic, f'{mnemonic} {dest}, off, s[32:35], 0')]

The opcode selects both the element count and the destination range, so buffer_load_format_x v[6:9] is not a word the decoder
can produce. The refusal itself does not look at the destination at all (op_buffer_load_format_* raises unconditionally), so even a
hand-written assembly form would be refused.

So the suggestion in my previous comment was a guard against a shortcut that cannot currently arise — please ignore it. The four
refusals and the triage grouping, which are the behaviours that exist, are pinned by the controls that merged.

Notes

  • AI-assisted correction to my own review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants