shader: refuse unsupported DATA_FORMAT on buffer_load_format in gfx2hlsl (Part of #1809) #1973

Closed
github-bot wants to merge 1 commit from gh-pr/1973/head into gh-pr/1973/base
Owner

@⁠tedin7 on GitHub · 2026-11-24 22:21 UTC · original
tedin7:x2w-frontier-1809-data-format → main · +132 −0 · 4 files · 1 commits · closed without merging

Part of #1809
Part of #870

What this unblocks: buffer_load_format_{x,xy,xyz,xyzw} is now refused by name with its real reason (descriptor DATA_FORMAT not tracked), so the census group is classified and no wrong typed load can be emitted.

Verification:

  • python3 -B tests/startup_gfx2hlsl_buffer_format_check.py -> PASS (9 checks fail against the previous gfx2hlsl.py, all pass with this change)
  • python3 -B tests/startup_gfx2hlsl_tbuffer_16f_check.py -> PASS (typed tbuffer_load_format_* unchanged)
  • git diff --check -> clean
  • Win2025: ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_buffer_format$' -V -> not run yet, to be run on Win2025 before merge

Scope: this does not lower the loads. buffer_load_format_* has no format field; the format lives in the resource descriptor, and Stage.descriptor() tracks only where descriptor words came from. Guessing a format from the destination width would give silently wrong data. Lowering needs pipeline state that supplies the descriptor words, as described in the issue. The test starts from synthetic encoded MUBUF instructions and pins each width's refusal plus the unchanged buffer_load_dword. docs/experiments.md records the finding.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 22:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1973) `tedin7:x2w-frontier-1809-data-format` → `main` · +132 −0 · 4 files · 1 commits · closed without merging Part of #1809 Part of #870 What this unblocks: `buffer_load_format_{x,xy,xyz,xyzw}` is now refused by name with its real reason (descriptor `DATA_FORMAT` not tracked), so the census group is classified and no wrong typed load can be emitted. Verification: - `python3 -B tests/startup_gfx2hlsl_buffer_format_check.py` -> PASS (9 checks fail against the previous `gfx2hlsl.py`, all pass with this change) - `python3 -B tests/startup_gfx2hlsl_tbuffer_16f_check.py` -> PASS (typed `tbuffer_load_format_*` unchanged) - `git diff --check` -> clean - Win2025: `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_buffer_format$' -V` -> not run yet, to be run on Win2025 before merge Scope: this does not lower the loads. `buffer_load_format_*` has no format field; the format lives in the resource descriptor, and `Stage.descriptor()` tracks only where descriptor words came from. Guessing a format from the destination width would give silently wrong data. Lowering needs pipeline state that supplies the descriptor words, as described in the issue. The test starts from synthetic encoded MUBUF instructions and pins each width's refusal plus the unchanged `buffer_load_dword`. `docs/experiments.md` records the finding. AI-assisted; commands listed were executed locally.
The untyped-format MUBUF loads take their element format from the resource
descriptor, which the translator does not track. Refuse each width with that
reason instead of the generic unknown-op message. Part of #1809, #870.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:46:42 +00:00
github-bot closed this pull request 2026-11-26 23:46:42 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 22:29 UTC · original · edited 2026-11-24 22:31 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T22:31:42.622853Z e600cdd Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 22:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1973#issuecomment-7146297259) · edited 2026-11-24 22:31 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"e600cdd5c23c971763337e043dadda0b3347f9d7","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T22:31:42.622853Z">2026-11-24T22:31:42.622853Z</relative-time> | `e600cdd` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 22:31 UTC · original

#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

  • AI-assisted review, posted on both #1965 and #1973 so the two authors see the same evidence.
**@⁠ChazY11** on GitHub · 2026-11-24 22:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1973#issuecomment-7146329240) ## #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: ```text 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: ```text 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: ```powershell 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: ```python re.compile(r"buffer_load_format_(?:x|xy|xyz|xyzw) requires descriptor FORMAT and DST_SEL\Z") ``` Checked against both texts: ```text 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 - AI-assisted review, posted on both #1965 and #1973 so the two authors see the same evidence.
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 22:34 UTC · original

Update after #1965 merged: this PR now breaks a test on main, by itself

My earlier comment described the conflict when #1965 and this PR landed together. #1965 is now merged, so the conflict is no longer
hypothetical — it is main plus this PR alone.

Verified against main 889cd3f4 (git merge clean, no conflict markers):

git checkout -B only-1973 origin/main && git merge pr-1973

out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_buffer_format_check.py     # exit 0  (this PR's own check)
out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls    # exit 1  (a check already on main)

AssertionError: buffer_load_format_x needs the descriptor DATA_FORMAT, which is not tracked

Control, same tree without the merge:

git checkout check-main && git reset --hard origin/main
out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls    # exit 0

So main is green today and this PR makes it red, while this PR's own check stays green.

Why

Two refusals now exist for the same four mnemonics:

tools/startup/gfx2hlsl.py:590   '%s requires descriptor FORMAT and DST_SEL'          # merged with #1965
tools/startup/gfx2hlsl.py:1058  'buffer_load_format_%s needs the descriptor DATA_FORMAT…'  # this PR

op_buffer_load_format_x … _xyzw (this PR, lines 1052–1070) dispatch to buffer_format_load() before the generic path at 590 is
reached, so this PR's text wins and #1965's assertion fails.

tools/startup/triage_run.py is the second half: the classifier merged with #1965 matches
buffer_load_format_(?:x|xy|xyz|xyzw) requires descriptor FORMAT and DST_SEL\Z, and against these two strings

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

the census group would silently lose all four forms.

What fixes it, smallest first

  1. Either adopt #1965's text here (and delete the older guard at 590 in a later cleanup), or re-point #1965's assertion and the
    triage regex at this text in this PR. One message, updated in all three places.
  2. Until that happens, this PR cannot merge without turning main red — the assertion in tests/startup_buffer_address_check.py
    is already merged and is the one that fires.

I have also checked the other open gfx2hlsl.py PRs pairwise against main (#1978, #1969, #1952, #1946): all ten pairs and the
five-way merge are green, so this is the only collision in that file right now.

Notes

  • AI-assisted review.
**@⁠ChazY11** on GitHub · 2026-11-24 22:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1973#issuecomment-7146387727) ## Update after #1965 merged: this PR now breaks a test on `main`, by itself My earlier comment described the conflict when #1965 and this PR landed together. #1965 is now merged, so the conflict is no longer hypothetical — it is `main` plus this PR alone. Verified against `main` `889cd3f4` (`git merge` clean, no conflict markers): ```powershell git checkout -B only-1973 origin/main && git merge pr-1973 out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_buffer_format_check.py # exit 0 (this PR's own check) out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls # exit 1 (a check already on main) AssertionError: buffer_load_format_x needs the descriptor DATA_FORMAT, which is not tracked ``` Control, same tree without the merge: ```powershell git checkout check-main && git reset --hard origin/main out/pe-env/Scripts/python.exe -B tests/startup_buffer_address_check.py controls # exit 0 ``` So `main` is green today and this PR makes it red, while this PR's own check stays green. ## Why Two refusals now exist for the same four mnemonics: ```text tools/startup/gfx2hlsl.py:590 '%s requires descriptor FORMAT and DST_SEL' # merged with #1965 tools/startup/gfx2hlsl.py:1058 'buffer_load_format_%s needs the descriptor DATA_FORMAT…' # this PR ``` `op_buffer_load_format_x` … `_xyzw` (this PR, lines 1052–1070) dispatch to `buffer_format_load()` before the generic path at 590 is reached, so this PR's text wins and #1965's assertion fails. `tools/startup/triage_run.py` is the second half: the classifier merged with #1965 matches `buffer_load_format_(?:x|xy|xyz|xyzw) requires descriptor FORMAT and DST_SEL\Z`, and against these two strings ```text 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 ``` the census group would silently lose all four forms. ## What fixes it, smallest first 1. Either adopt #1965's text here (and delete the older guard at 590 in a later cleanup), or re-point #1965's assertion and the triage regex at this text in this PR. One message, updated in all three places. 2. Until that happens, this PR cannot merge without turning `main` red — the assertion in `tests/startup_buffer_address_check.py` is already merged and is the one that fires. I have also checked the other open `gfx2hlsl.py` PRs pairwise against `main` (#1978, #1969, #1952, #1946): all ten pairs and the five-way merge are green, so this is the only collision in that file right now. ## Notes - AI-assisted review.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 22:44 UTC · original

Thanks for the source-built controls. #1965 is already on main and covers the same four encoded MUBUF widths, as well as the adjacent raw MUBUF and instruction-formatted MTBUF paths. It preserves the refusal group and names both FORMAT and DST_SEL. As the combined run in this thread shows, the two changes would disagree on the exact refusal and break the fixture. Closing the duplicate implementation. #1809 stays open for real bound-descriptor format and swizzle support.

**@⁠R0Y00** on GitHub · 2026-11-24 22:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1973#issuecomment-7146587871) Thanks for the source-built controls. #1965 is already on main and covers the same four encoded MUBUF widths, as well as the adjacent raw MUBUF and instruction-formatted MTBUF paths. It preserves the refusal group and names both FORMAT and DST_SEL. As the combined run in this thread shows, the two changes would disagree on the exact refusal and break the fixture. Closing the duplicate implementation. #1809 stays open for real bound-descriptor format and swizzle support.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.