shader: name the mesh exchange shapes the frontend does not match #3420

Merged
Leyukaka merged 2 commits from upstream-pr/3420 into main 2026-11-29 08:40:18 +00:00
Leyukaka commented 2026-11-29 00:15:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T00:15:20Z.


Change

When an instruction reaches the mesh frontend's fallback in lower_mesh (no handler matched it), the refusal used to be unsupported mesh instruction or EXEC state: <op> in every case. It now names three cases before that generic refusal:

  • mesh group-index exchange shape or entry state is not covered: the instruction is s_mov_b64 exec, 1 (0xbefe0481), the first word of the group-index exchange, and the exchange matcher did not accept the sequence. That covers a different word sequence and also a failed precondition (branch, EXEC state, layout, register use).
  • mesh count exchange shape or entry state is not covered: the instruction is s_barrier (0xbf8a0000) and the next word compares an SGPR against 0 ((word & 0xffffff80) == 0xbf008000, the same test as the count matcher's second word). A barrier alone does not identify the count exchange.
  • mesh group memory outside a proven exchange: any other s_barrier, or any ds_* instruction other than ds_swizzle_b32, ds_permute_b32 and ds_bpermute_b32. The mesh frontend has no ds_* handler.

ds_swizzle_b32, ds_permute_b32 and ds_bpermute_b32 do not use group memory and keep the generic refusal. The new checks sit in the branch that already refused unconditionally, and refuse does not return, so the set of refused programs is unchanged and no accepted program changes. Only refused programs get a more precise reason.

Tests: wrong-count-slot and mismatched-barriers now expect the named reasons. New refused runs: standalone-barrier, standalone-ds-write (group memory), standalone-ds-swizzle (generic, ds_swizzle_b32, holds on main too), unsupported-sleep (generic, s_sleep, holds on main too) and missing-exec-save (group-index). No accepted run or its words changed.

Refs #2413, #3416.

Verification

The checks ran on the change applied to main 0614f68c, Windows 11, release build, before the rebase onto 51472392. git diff --stat 0614f68c 51472392 -- src/gfx1013_direct_mesh.inl tests/native_direct_mesh_check.py is empty (#3353 touches neither file).

  • cmake --build --preset release --target compile_dxil, then ctest --test-dir out\build\release --no-tests=error --output-on-failure -R "^(native_direct_mesh|native_compile_dxil_refusals)$": 2/2 pass.
  • Main's src/gfx1013_direct_mesh.inl with the earlier revision of the test (see below): native_direct_mesh fails at wrong-count-slot with native compute +0x18: unsupported mesh instruction or EXEC state: s_barrier. The three new strings do not occur in main's file, so every new or updated expectation except unsupported-sleep and standalone-ds-swizzle can only fail there.
  • Mutations, each rebuilt (one object recompiled) and run against native_direct_mesh:
Mutation Result
ds exclusion replaced by true fails, standalone-ds-swizzle: +0x0: mesh group memory outside a proven exchange
count reason reworded fails, wrong-count-slot
group-index reason reworded fails (+0x0: mesh group-index exchange shape is not covered)
barrier check without the next-word compare fails, standalone-barrier: +0x0: mesh count exchange shape is not covered
the two named reasons swapped fails, wrong-count-slot
s_barrier dropped from the group memory case fails, standalone-barrier: +0x0: unsupported mesh instruction or EXEC state: s_barrier
s_mov_b64 exec, 1 case disabled (false &&) fails, mismatched-barriers: +0x0: unsupported mesh instruction or EXEC state: s_mov_b64

The first three rows ran on the committed wording. The last four ran on an earlier revision of the same change, whose two named reasons ended in "shape is not covered" and whose group memory case included all ds_*.

  • After each sweep, the source file was restored byte-identical (sha256 matches the backup), the rebuild passed both tests again, and the diff hash was unchanged.

  • Follow-up commit 4fa38d63 adds standalone-ds-permute (0xdac80000) and standalone-ds-bpermute (0xdacc0000), both expecting the generic refusal. Checked on 75fe7c1d with these two cases in the working tree, before the commit was made (same content): both tests pass (2/2); removing ds_permute_b32 or ds_bpermute_b32 from the exclusion makes native_direct_mesh fail at the matching case with the group memory reason.

Evidence and follow-up

Not covered: The effect on the 543 captured slot 57 requests is not measured yet. That needs the entry layouts from the root-input PR (item b in #2413). Apart from the follow-up check above, nothing was re-run after the rebase onto 51472392.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (no capability or build change)
  • No application files, dumps, distribution links or secrets included.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5545945604 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3420). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T00:15:20Z. --- ## Change When an instruction reaches the mesh frontend's fallback in `lower_mesh` (no handler matched it), the refusal used to be `unsupported mesh instruction or EXEC state: <op>` in every case. It now names three cases before that generic refusal: - `mesh group-index exchange shape or entry state is not covered`: the instruction is `s_mov_b64 exec, 1` (`0xbefe0481`), the first word of the group-index exchange, and the exchange matcher did not accept the sequence. That covers a different word sequence and also a failed precondition (branch, EXEC state, layout, register use). - `mesh count exchange shape or entry state is not covered`: the instruction is `s_barrier` (`0xbf8a0000`) and the next word compares an SGPR against 0 (`(word & 0xffffff80) == 0xbf008000`, the same test as the count matcher's second word). A barrier alone does not identify the count exchange. - `mesh group memory outside a proven exchange`: any other `s_barrier`, or any `ds_*` instruction other than `ds_swizzle_b32`, `ds_permute_b32` and `ds_bpermute_b32`. The mesh frontend has no `ds_*` handler. `ds_swizzle_b32`, `ds_permute_b32` and `ds_bpermute_b32` do not use group memory and keep the generic refusal. The new checks sit in the branch that already refused unconditionally, and `refuse` does not return, so the set of refused programs is unchanged and no accepted program changes. Only refused programs get a more precise reason. Tests: `wrong-count-slot` and `mismatched-barriers` now expect the named reasons. New refused runs: `standalone-barrier`, `standalone-ds-write` (group memory), `standalone-ds-swizzle` (generic, `ds_swizzle_b32`, holds on main too), `unsupported-sleep` (generic, `s_sleep`, holds on main too) and `missing-exec-save` (group-index). No accepted run or its words changed. Refs #2413, #3416. ## Verification The checks ran on the change applied to `main` `0614f68c`, Windows 11, release build, before the rebase onto `51472392`. `git diff --stat 0614f68c 51472392 -- src/gfx1013_direct_mesh.inl tests/native_direct_mesh_check.py` is empty (#3353 touches neither file). - `cmake --build --preset release --target compile_dxil`, then `ctest --test-dir out\build\release --no-tests=error --output-on-failure -R "^(native_direct_mesh|native_compile_dxil_refusals)$"`: 2/2 pass. - Main's `src/gfx1013_direct_mesh.inl` with the earlier revision of the test (see below): `native_direct_mesh` fails at `wrong-count-slot` with `native compute +0x18: unsupported mesh instruction or EXEC state: s_barrier`. The three new strings do not occur in main's file, so every new or updated expectation except `unsupported-sleep` and `standalone-ds-swizzle` can only fail there. - Mutations, each rebuilt (one object recompiled) and run against `native_direct_mesh`: | Mutation | Result | |---|---| | ds exclusion replaced by `true` | fails, `standalone-ds-swizzle`: `+0x0: mesh group memory outside a proven exchange` | | count reason reworded | fails, `wrong-count-slot` | | group-index reason reworded | fails (`+0x0: mesh group-index exchange shape is not covered`) | | barrier check without the next-word compare | fails, `standalone-barrier`: `+0x0: mesh count exchange shape is not covered` | | the two named reasons swapped | fails, `wrong-count-slot` | | `s_barrier` dropped from the group memory case | fails, `standalone-barrier`: `+0x0: unsupported mesh instruction or EXEC state: s_barrier` | | `s_mov_b64 exec, 1` case disabled (`false &&`) | fails, `mismatched-barriers`: `+0x0: unsupported mesh instruction or EXEC state: s_mov_b64` | The first three rows ran on the committed wording. The last four ran on an earlier revision of the same change, whose two named reasons ended in "shape is not covered" and whose group memory case included all `ds_*`. - After each sweep, the source file was restored byte-identical (sha256 matches the backup), the rebuild passed both tests again, and the diff hash was unchanged. - Follow-up commit `4fa38d63` adds `standalone-ds-permute` (`0xdac80000`) and `standalone-ds-bpermute` (`0xdacc0000`), both expecting the generic refusal. Checked on `75fe7c1d` with these two cases in the working tree, before the commit was made (same content): both tests pass (2/2); removing `ds_permute_b32` or `ds_bpermute_b32` from the exclusion makes `native_direct_mesh` fail at the matching case with the group memory reason. ## Evidence and follow-up Not covered: The effect on the 543 captured slot 57 requests is not measured yet. That needs the entry layouts from the root-input PR (item b in #2413). Apart from the follow-up check above, nothing was re-run after the rebase onto `51472392`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. (no capability or build change) - [x] No application files, dumps, distribution links or secrets included.
tedin7 commented 2026-11-29 08:40:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-29T08:40:12Z.

Review: COMMENTED


Reviewed 4fa38d637e46893306a83fd77e6c3ba25dd6e363:

  • src/gfx1013_direct_mesh.inl: names unrecognized mesh group-index exchange (0xbefe0481), count exchange (s_barrier followed by candidate wave SGPR compare), and standalone s_barrier / ds_* (non-permute/swizzle) shapes instead of falling through to the generic unsupported-instruction error.
  • tests/native_direct_mesh_check.py: updates wrong-count-slot and mismatched-barriers expected diagnostics and adds 7 negative controls (standalone-barrier, standalone-ds-write, standalone-ds-swizzle, standalone-ds-permute, standalone-ds-bpermute, unsupported-sleep, missing-exec-save).

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 4fa38d637e46893306a83fd77e6c3ba25dd6e363:

  • ctest --preset dev -R '^native_direct_mesh$' --parallel 6 --no-tests=error --output-on-failure: 1/1 passed (1.58s)
  • ctest --preset release -R '^native_direct_mesh$' --parallel 6 --no-tests=error --output-on-failure: 1/1 passed (1.49s)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6102119384 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3420#pullrequestreview-6102119384). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-29T08:40:12Z. **Review:** COMMENTED --- Reviewed `4fa38d637e46893306a83fd77e6c3ba25dd6e363`: - `src/gfx1013_direct_mesh.inl`: names unrecognized mesh group-index exchange (`0xbefe0481`), count exchange (`s_barrier` followed by candidate wave SGPR compare), and standalone `s_barrier` / `ds_*` (non-permute/swizzle) shapes instead of falling through to the generic unsupported-instruction error. - `tests/native_direct_mesh_check.py`: updates `wrong-count-slot` and `mismatched-barriers` expected diagnostics and adds 7 negative controls (`standalone-barrier`, `standalone-ds-write`, `standalone-ds-swizzle`, `standalone-ds-permute`, `standalone-ds-bpermute`, `unsupported-sleep`, `missing-exec-save`). Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `4fa38d637e46893306a83fd77e6c3ba25dd6e363`: - `ctest --preset dev -R '^native_direct_mesh$' --parallel 6 --no-tests=error --output-on-failure`: **1/1 passed** (`1.58s`) - `ctest --preset release -R '^native_direct_mesh$' --parallel 6 --no-tests=error --output-on-failure`: **1/1 passed** (`1.49s`) AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3420
No description provided.