startup: opt-in derived Mesh57 state for immediate-allocation DispatchMesh ExecuteIndirect #3413

Merged
SimSalabimse merged 25 commits from upstream-pr/3413 into main 2026-12-03 12:05:02 +00:00
SimSalabimse commented 2026-11-28 23:38:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T23:38:02Z.


Summary

Opt-in runtime derivation of the Mesh57 state for one graphics/mesh_profile_missing shape, so a direct DispatchMesh ExecuteIndirect can be forwarded without a hand-written .mesh57-state file. Refs #870. Refs #2413.

Opened as a draft because it touches the question @Leyukaka asked in #2413 (whether a derivation from the fixed descriptor and state blocks is acceptable, or whether those values must stay hand-reviewed). The switch is off by default and a reviewed .mesh57-state file always wins, so the reviewed path in #3308 is unchanged. If derived values are not acceptable on the runtime side, I'm happy to close this or narrow it to a tool that only writes candidate layouts for review.

Context: a startup run on the Windows test PC with the refusal census from #3411 refused 653,708 DispatchMesh ExecuteIndirect calls in 420 seconds and forwarded none. Across draw and mesh, the graphics-pipeline census counted graphics/no_translation 446,421 and graphics/mesh_profile_missing 427,428. Most of the mesh_profile_missing programs are outside the shape this PR handles, so this number is not what the flag forwards.

X2W_MESH57_DERIVE_STATE=1 builds a desktop mesh pipeline only for a direct DispatchMesh whose pipeline is slot 57, has captured stages, and has no reviewed .mesh57-state file. The program must be one immediate GS_ALLOC_REQ, and depth and stencil must be off. The guest root may be empty, or one 32-bit-constants block of 1 to 8 dwords copied into desktop b0 at user SGPR s8. A heap-indexed flag on that one-constant root does not by itself refuse it. Any other root, including a five-parameter heap-indexed root, stays refused. A slot 55 pipeline reuses that mesh only when its program matches the slot 57 base and every patch record is blend tag 2, or the patch list is empty. A failure on that pipeline is remembered there, not on the base. The existing ExecuteIndirect path then records the call. The rasterizer stays solid, cull none, and depth clip.

What stays refused: graphics/no_translation, including a slot 57 pipeline with no captured stages; slot 86 meshes that only lack a cached stage; any other allocation shape; a guest root that is neither empty nor that one constant block; a slot 55 patch tag other than 2; or depth or stencil enabled. With the switch off this path is not entered.

Tests

Windows test PC (MSVC, WARP and hardware), head 46be84356b6a47aa5053873d6c4b062133e86d4f:

ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure

cmake --build --preset dev exit 0, 37/37 passed, ctest exit 0. None skipped.

On both backends, mesh-derived, mesh-derived-dxc, mesh-derived-root, mesh-derived-root-heap, and mesh-derived-slot55 paint 1/8 at (2,0) 0xffffffff. mesh-derived-slot55-isolate stays 0/8, then paints 1/8. The other derived modes stay 0/8 0xff000000, including mesh-derived-root-five. That mode now creates the five-parameter root and logs reason=derived mesh guest root is heap indexed with root=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1 and real=0. Unavailable mesh shaders or a missing command signature return 77. The branch is 6 commits behind current main 17b662a2 and still merges cleanly. It is still based on c04e0dd6.

Linux: g++ and clang++ with -std=c++17 -Wall -Wextra -Werror -Werror=narrowing on the host reader; tools/run_checks_parallel.py --from-dir tests/checks/python-linux passed.

AI-assisted (Cursor)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5545691313 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-28T23:38:02Z. --- ## Summary Opt-in runtime derivation of the Mesh57 state for one `graphics/mesh_profile_missing` shape, so a direct `DispatchMesh` `ExecuteIndirect` can be forwarded without a hand-written `.mesh57-state` file. Refs #870. Refs #2413. Opened as a draft because it touches the question @Leyukaka asked in #2413 (whether a derivation from the fixed descriptor and state blocks is acceptable, or whether those values must stay hand-reviewed). The switch is off by default and a reviewed `.mesh57-state` file always wins, so the reviewed path in #3308 is unchanged. If derived values are not acceptable on the runtime side, I'm happy to close this or narrow it to a tool that only writes candidate layouts for review. Context: a startup run on the Windows test PC with the refusal census from #3411 refused 653,708 `DispatchMesh` `ExecuteIndirect` calls in 420 seconds and forwarded none. Across draw and mesh, the graphics-pipeline census counted `graphics/no_translation` 446,421 and `graphics/mesh_profile_missing` 427,428. Most of the `mesh_profile_missing` programs are outside the shape this PR handles, so this number is not what the flag forwards. `X2W_MESH57_DERIVE_STATE=1` builds a desktop mesh pipeline only for a direct `DispatchMesh` whose pipeline is slot 57, has captured stages, and has no reviewed `.mesh57-state` file. The program must be one immediate `GS_ALLOC_REQ`, and depth and stencil must be off. The guest root may be empty, or one 32-bit-constants block of 1 to 8 dwords copied into desktop b0 at user SGPR s8. A heap-indexed flag on that one-constant root does not by itself refuse it. Any other root, including a five-parameter heap-indexed root, stays refused. A slot 55 pipeline reuses that mesh only when its program matches the slot 57 base and every patch record is blend tag 2, or the patch list is empty. A failure on that pipeline is remembered there, not on the base. The existing `ExecuteIndirect` path then records the call. The rasterizer stays solid, cull none, and depth clip. What stays refused: `graphics/no_translation`, including a slot 57 pipeline with no captured stages; slot 86 meshes that only lack a cached stage; any other allocation shape; a guest root that is neither empty nor that one constant block; a slot 55 patch tag other than 2; or depth or stencil enabled. With the switch off this path is not entered. ## Tests Windows test PC (MSVC, WARP and hardware), head `46be84356b6a47aa5053873d6c4b062133e86d4f`: ``` ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure ``` `cmake --build --preset dev` exit 0, 37/37 passed, ctest exit 0. None skipped. On both backends, `mesh-derived`, `mesh-derived-dxc`, `mesh-derived-root`, `mesh-derived-root-heap`, and `mesh-derived-slot55` paint 1/8 at (2,0) `0xffffffff`. `mesh-derived-slot55-isolate` stays 0/8, then paints 1/8. The other derived modes stay 0/8 `0xff000000`, including `mesh-derived-root-five`. That mode now creates the five-parameter root and logs `reason=derived mesh guest root is heap indexed` with `root=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1` and `real=0`. Unavailable mesh shaders or a missing command signature return 77. The branch is 6 commits behind current main `17b662a2` and still merges cleanly. It is still based on `c04e0dd6`. Linux: `g++` and `clang++` with `-std=c++17 -Wall -Wextra -Werror -Werror=narrowing` on the host reader; `tools/run_checks_parallel.py --from-dir tests/checks/python-linux` passed. AI-assisted (Cursor)
Leyukaka commented 2026-11-29 08:39:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T08:39:42Z.

Review: COMMENTED


Comment on 35b0d542 (draft). Evidence: reading the diff and the head blobs; git merge-tree against main aff3b1ad is clean. Nothing was built or run.

  • The derived pipeline uses fixed values where the reviewed path reads them per program. mesh57_alloc.h:89-94 sets 64 threads, topology 2 and wave size 64; the only wave32 signal is an s_mov_b32 into exec_lo (:70-71). native_mesh57.inl:834 uses default_pso_rasterizer(), :845 triangles, and mesh57_alloc.h:223 puts the constant block at s8. The reviewed path takes threads, topology and wave size from the profile (native_mesh57.inl:311-312), the rasterizer from the profile (:403) and the SGPR from the mapping entry (:324). The docs state these defaults. The consequence is that a program with culling, another topology, wave32 without an exec_lo write, or its constant block at another SGPR is forwarded with the defaults, not refused.
  • A slot 55 failure is stored on its slot 57 base. derive_slot55_mesh passes base_info as source (native_mesh57.inl:679), info = source (:690), and remember writes info->mesh57_derive_reason (:696). A desktop pipeline refusal with the slot 55 blend override (:876) is then returned at :693 for the base itself and for every other slot 55 pipeline on that base.
  • derived-root does not observe the constant. The word is 0 (tests/startup_indirect_draw_indexed.cpp:1118) and the MS only adds s_mov_b32 s9, s8 (:2414); no later instruction reads s9. A constant that never reaches b0, or the wrong word, still paints (2,0). A non-zero word that drives the export would catch it.
  • The heap-indexed root with one constant block is only covered as a decision (tests/mesh57_derive_alloc_check.cpp:228-230). No device mode sets a heap flag on the guest root, so the deferred_root branch (native_mesh57.inl:783) is not run by any test.
  • mesh57_stage_copy and mesh57_fixed_stages_kept (mesh57_alloc.h:122, :132) are called only from tests/mesh57_derive_alloc_check.cpp. The capture they describe (d3d12_capture.inl:246-259) does not call them, so that test does not fail if the capture changes.
  • None of the new tests are in the pr ctest filter (CMakePresets.json:51: the startup_indirect_(...|mesh(_xmem_arguments(_skip_wait)?)?|...)_warp alternative does not match startup_indirect_mesh_derived*, and mesh57_derive_alloc is not listed), and pull request CI runs ctest --preset pr (windows.yml:489-493). mesh57_derive_alloc needs no device.
  • The PR body is behind the head: it cites aed2c0c7 and 13/13, and says "the guest root must be empty" and "a non-empty root" stays refused, while the head binds one constant block and slot 55 pipelines. The docs record three 420 s runs with the switch on (075e4611 "forwarded none", f358a2ed "forwarded nothing", 54331137 forwards: 0).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6102117809 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6102117809). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T08:39:42Z. **Review:** COMMENTED --- Comment on 35b0d542 (draft). Evidence: reading the diff and the head blobs; `git merge-tree` against main aff3b1ad is clean. Nothing was built or run. - The derived pipeline uses fixed values where the reviewed path reads them per program. `mesh57_alloc.h:89-94` sets 64 threads, topology 2 and wave size 64; the only wave32 signal is an `s_mov_b32` into `exec_lo` (`:70-71`). `native_mesh57.inl:834` uses `default_pso_rasterizer()`, `:845` triangles, and `mesh57_alloc.h:223` puts the constant block at s8. The reviewed path takes threads, topology and wave size from the profile (`native_mesh57.inl:311-312`), the rasterizer from the profile (`:403`) and the SGPR from the mapping entry (`:324`). The docs state these defaults. The consequence is that a program with culling, another topology, wave32 without an `exec_lo` write, or its constant block at another SGPR is forwarded with the defaults, not refused. - A slot 55 failure is stored on its slot 57 base. `derive_slot55_mesh` passes `base_info` as `source` (`native_mesh57.inl:679`), `info = source` (`:690`), and `remember` writes `info->mesh57_derive_reason` (`:696`). A desktop pipeline refusal with the slot 55 blend override (`:876`) is then returned at `:693` for the base itself and for every other slot 55 pipeline on that base. - `derived-root` does not observe the constant. The word is 0 (`tests/startup_indirect_draw_indexed.cpp:1118`) and the MS only adds `s_mov_b32 s9, s8` (`:2414`); no later instruction reads s9. A constant that never reaches b0, or the wrong word, still paints (2,0). A non-zero word that drives the export would catch it. - The heap-indexed root with one constant block is only covered as a decision (`tests/mesh57_derive_alloc_check.cpp:228-230`). No device mode sets a heap flag on the guest root, so the `deferred_root` branch (`native_mesh57.inl:783`) is not run by any test. - `mesh57_stage_copy` and `mesh57_fixed_stages_kept` (`mesh57_alloc.h:122`, `:132`) are called only from `tests/mesh57_derive_alloc_check.cpp`. The capture they describe (`d3d12_capture.inl:246-259`) does not call them, so that test does not fail if the capture changes. - None of the new tests are in the `pr` ctest filter (`CMakePresets.json:51`: the `startup_indirect_(...|mesh(_xmem_arguments(_skip_wait)?)?|...)_warp` alternative does not match `startup_indirect_mesh_derived*`, and `mesh57_derive_alloc` is not listed), and pull request CI runs `ctest --preset pr` (`windows.yml:489-493`). `mesh57_derive_alloc` needs no device. - The PR body is behind the head: it cites aed2c0c7 and 13/13, and says "the guest root must be empty" and "a non-empty root" stays refused, while the head binds one constant block and slot 55 pipelines. The docs record three 420 s runs with the switch on (075e4611 "forwarded none", f358a2ed "forwarded nothing", 54331137 `forwards: 0`).
SimSalabimse commented 2026-11-29 12:38:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T12:38:07Z.


A 420 s run on the Windows test PC at 35b0d542, with X2W_MESH57_DERIVE_STATE=1, X2W_MESH57_DXC_DIR set, and X2W_TRANSLATED_INDIRECT_DRAW=1, forwarded 0 derived mesh pipelines (x2w-render mesh57-derive forwards: 0). Indirect DispatchMesh stayed refused (864,129).

Last derive census:

  • derived mesh guest root is heap indexed 305,958. Sample: path=57 desc=768 ms=9536 ps=4352, root=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1
  • slot 57 pixel stage is absent from the descriptor 111,185. Sample: path=57 desc=768 ms=1408 ps=0, root=5 const=2 other=4 heap=3072 params=t,t,t,srv,c2
  • slot 55 patch tag 1 is not applied 442,686. Sample: path=55 base=57 desc=332 patches=1:332, same five-parameter root, heap=3072 params=t,t,t,srv,c2
  • slot 55 patch tag 0 is not applied 4,300. Sample: patches=0:332, same root as the tag 1 sample

params is three descriptor tables, one root SRV, then a 1-dword or 2-dword constant. Heap 1024 is the view-heap flag. Heap 3072 is view plus sampler. The slot 55 records are 0x14c bytes, the same size as the reviewed blend tag 2, but the tags here are 0 and 1.

I have not bound that root, and I have not treated tag 0 or tag 1 as blend. No reviewed mesh user-SGPR map in the tree covers a five-parameter heap-indexed root. If one exists, what I would need is the user SGPR of each of those five parameters, the user SGPR of the resource heap, and the user SGPR of the sampler heap when 0x800 is set. Is there a reviewed map for this shape, or should it stay refused?

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7255954341 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#issuecomment-7255954341). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-29T12:38:07Z. --- A 420 s run on the Windows test PC at 35b0d542, with `X2W_MESH57_DERIVE_STATE=1`, `X2W_MESH57_DXC_DIR` set, and `X2W_TRANSLATED_INDIRECT_DRAW=1`, forwarded 0 derived mesh pipelines (`x2w-render mesh57-derive forwards: 0`). Indirect `DispatchMesh` stayed refused (864,129). Last derive census: - `derived mesh guest root is heap indexed` 305,958. Sample: path=57 desc=768 ms=9536 ps=4352, root=5 const=1 other=4 heap=1024 `params=t,t,t,srv,c1` - `slot 57 pixel stage is absent from the descriptor` 111,185. Sample: path=57 desc=768 ms=1408 ps=0, root=5 const=2 other=4 heap=3072 `params=t,t,t,srv,c2` - `slot 55 patch tag 1 is not applied` 442,686. Sample: path=55 base=57 desc=332 `patches=1:332`, same five-parameter root, heap=3072 `params=t,t,t,srv,c2` - `slot 55 patch tag 0 is not applied` 4,300. Sample: `patches=0:332`, same root as the tag 1 sample `params` is three descriptor tables, one root SRV, then a 1-dword or 2-dword constant. Heap 1024 is the view-heap flag. Heap 3072 is view plus sampler. The slot 55 records are 0x14c bytes, the same size as the reviewed blend tag 2, but the tags here are 0 and 1. I have not bound that root, and I have not treated tag 0 or tag 1 as blend. No reviewed mesh user-SGPR map in the tree covers a five-parameter heap-indexed root. If one exists, what I would need is the user SGPR of each of those five parameters, the user SGPR of the resource heap, and the user SGPR of the sampler heap when 0x800 is set. Is there a reviewed map for this shape, or should it stay refused? AI-Assisted
SimSalabimse commented 2026-11-29 13:28:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T13:28:34Z.


Windows test PC (MSVC, --preset dev, -j 1), at 46be84356b6a47aa5053873d6c4b062133e86d4f. cmake --build --preset dev exit 0.

ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure

37/37 passed, ctest exit 0. None skipped. WARP and hardware.

At 6c93fc6f the two mesh-derived-root-five tests failed before any draw with serialize root failed (HRESULT 0x80070057). The fixture's three SRV tables and the root SRV all claimed t0 in space 0. This commit only fills distinct registers: tables are t0 in spaces 0, 1 and 2, the root SRV is t0 in space 3, the constant is b0. The shape is still five parameters with D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED. The mode is still not on the paint list.

On both WARP and hardware, mesh-derived-root-five logged:

x2w-render mesh57-derive sample reason=derived mesh guest root is heap indexed path=57 base=0 desc=768 ms=72 ps=16 state_a=324 state_b=4 vs=0 ms_len=72 ps_len=16 key=0000000000000000 list=0 real=0 mesh86=0 root=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1 patches=- raster=0

x2w-render ExecuteIndirect refused: indirect graphics requires a direct list with a matching desktop pipeline and root

Target (2,0) packed RGBA 0xff000000, 0/8 non-clear pixels, argument guards intact.

Painted 1/8 at (2,0) 0xffffffff on both backends: mesh-derived, mesh-derived-dxc, mesh-derived-root, mesh-derived-root-heap, mesh-derived-slot55. mesh-derived-slot55-isolate was 0/8 then 1/8. The other derived modes stayed 0/8 0xff000000.

No user-SGPR map was added for the five-parameter heap-indexed root. That root was not forwarded (real=0). Slot 55 tags other than 2 are unchanged. The branch is 6 commits behind current main 17b662a2 and still merges cleanly (git merge-tree exit 0). It is still based on c04e0dd6.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256565379 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#issuecomment-7256565379). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-29T13:28:34Z. --- Windows test PC (MSVC, `--preset dev`, `-j 1`), at `46be84356b6a47aa5053873d6c4b062133e86d4f`. `cmake --build --preset dev` exit 0. ``` ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure ``` 37/37 passed, ctest exit 0. None skipped. WARP and hardware. At `6c93fc6f` the two `mesh-derived-root-five` tests failed before any draw with `serialize root failed (HRESULT 0x80070057)`. The fixture's three SRV tables and the root SRV all claimed t0 in space 0. This commit only fills distinct registers: tables are t0 in spaces 0, 1 and 2, the root SRV is t0 in space 3, the constant is b0. The shape is still five parameters with `D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED`. The mode is still not on the paint list. On both WARP and hardware, `mesh-derived-root-five` logged: `x2w-render mesh57-derive sample reason=derived mesh guest root is heap indexed path=57 base=0 desc=768 ms=72 ps=16 state_a=324 state_b=4 vs=0 ms_len=72 ps_len=16 key=0000000000000000 list=0 real=0 mesh86=0 root=5 const=1 other=4 heap=1024 params=t,t,t,srv,c1 patches=- raster=0` `x2w-render ExecuteIndirect refused: indirect graphics requires a direct list with a matching desktop pipeline and root` Target (2,0) packed RGBA `0xff000000`, 0/8 non-clear pixels, argument guards intact. Painted 1/8 at (2,0) `0xffffffff` on both backends: `mesh-derived`, `mesh-derived-dxc`, `mesh-derived-root`, `mesh-derived-root-heap`, `mesh-derived-slot55`. `mesh-derived-slot55-isolate` was 0/8 then 1/8. The other derived modes stayed 0/8 `0xff000000`. No user-SGPR map was added for the five-parameter heap-indexed root. That root was not forwarded (`real=0`). Slot 55 tags other than 2 are unchanged. The branch is 6 commits behind current main `17b662a2` and still merges cleanly (`git merge-tree` exit 0). It is still based on `c04e0dd6`. AI-Assisted
Leyukaka commented 2026-11-29 13:30:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T13:30:03Z.

Review: COMMENTED


Comment on 46be8435 (draft); line numbers are on that commit. Evidence is reading the diff and the blobs. Nothing was built or run here. Checks on 46be8435: Build and test on Windows, Assemble and translate gfx1013 fixtures and the Linux Python checks pass; the /O2 job is skipped. Only points not in the earlier review on 35b0d542.

  1. MUST, code reading. The wave64 claim is wider than the check. docs/startup-runtime.md:1738 says the program is forwarded only when it proves wave64, and docs/experiments/native-fixed-mesh57.md:129 says a 32-bit exec write is refused. mesh57_alloc.h:67-74 and :90-94 flag only s_mov_b32 and eight bitwise SOP2 names with destination 126. Not flagged:

    • the *_saveexec_b32 and *_wrexec_b32 forms the decoder names (gfx1013_isa_tables.inl:59-61): they write exec implicitly and their destination field is the save register, so dst == 126 never matches;
    • other 32-bit writers of exec_lo: s_not_b32, s_movk_i32, s_cselect_b32, shifts, adds;
    • a wave32 program with no exec write at all.

    v_mbcnt_lo_u32_b32 (:63-64, :117) does not separate the cases: a wave32 program computes its lane id with that same instruction. The accepted fixture (tests/mesh57_derive_alloc_check.cpp:37-40) has v_mbcnt_lo and no v_mbcnt_hi. Scenario: a wave32 mesh program that masks with s_and_saveexec_b32, has one immediate allocation, v_mbcnt_lo and a target 20 export returns a layout with wave_size = 64, threads = 64 and is forwarded. Either refuse on every 32-bit instruction that can write exec (by name, including the implicit forms) and require a positive wave64 signal, or state in both docs that wave32 is detected only for the listed spellings.

  2. SHOULD, code reading. Nine negative cases in tests/mesh57_derive_alloc_check.cpp pass with the check they name removed: no allocation (:83), gap (:87), twice (:91), high (:95), zero (:99), wide (:103), exchange (:107), wave32 exec move (:118), from_register (:122). Each program has no v_mbcnt_lo and no export, and each assertion only checks that derive_immediate_mesh_layout returns nothing. With mesh57_alloc.h:77-78, :81-83, :93-94 or :109 deleted, the reader still returns no layout at :117 (thread count is not proven). Only alloc alone, no triangle export and wave32 exec alu (:48-64) compare the reason. Build each negative from the accepted triangle words with one change, and compare mesh57_read_layout(...).reason.

  3. SHOULD, code reading. A slot 57 base that was dispatched once passes its blend refusal to slot 55 children whose patch replaces that blend. A direct dispatch on the base stores the state_block_blend reason on the base (native_mesh57.inl:801-802, stored == shaders). A later slot 55 child with a tag 2 patch reaches :725-726, which returns the base reason before blend_override is looked at (:799-800). The same child dispatched before the base is built. The same applies to derived mesh desktop pipeline was refused (:924), which was decided with the base blend. derived-slot55-isolate (tests/startup_indirect_draw_indexed.cpp:2649-2674) dispatches the two children only, never the base, so it passes either way. native-fixed-mesh57.md:133 says the last blend patch replaces the base blend. Skip the inherited reason when it came from the blend or from pipeline creation and an override is present, and add the base-first order to the test.

  4. SHOULD, code reading. mesh57_rasterizer_reason and Mesh57RasterizerView (mesh57_alloc.h:150-165) are called only from tests/mesh57_derive_alloc_check.cpp:66-81. The runtime decides at native_mesh57.inl:879-881, and it decides differently: the helper refuses an absent rasterizer (:160-161), the runtime forwards it with the default. native-fixed-mesh57.md:135 says slot 57 creation does not pass a rasterizer, so for these pipelines the runtime check does not fire and the culling case from the earlier review is still forwarded. The rasterizer case in the host check does not fail if :879-881 changes.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6103083863 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6103083863). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T13:30:03Z. **Review:** COMMENTED --- Comment on 46be8435 (draft); line numbers are on that commit. Evidence is reading the diff and the blobs. Nothing was built or run here. Checks on 46be8435: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and the Linux Python checks pass; the `/O2` job is skipped. Only points not in the earlier review on 35b0d542. 1. MUST, code reading. The wave64 claim is wider than the check. `docs/startup-runtime.md:1738` says the program is forwarded only when it proves wave64, and `docs/experiments/native-fixed-mesh57.md:129` says a 32-bit `exec` write is refused. `mesh57_alloc.h:67-74` and `:90-94` flag only `s_mov_b32` and eight bitwise SOP2 names with destination 126. Not flagged: - the `*_saveexec_b32` and `*_wrexec_b32` forms the decoder names (`gfx1013_isa_tables.inl:59-61`): they write `exec` implicitly and their destination field is the save register, so `dst == 126` never matches; - other 32-bit writers of `exec_lo`: `s_not_b32`, `s_movk_i32`, `s_cselect_b32`, shifts, adds; - a wave32 program with no `exec` write at all. `v_mbcnt_lo_u32_b32` (`:63-64`, `:117`) does not separate the cases: a wave32 program computes its lane id with that same instruction. The accepted fixture (`tests/mesh57_derive_alloc_check.cpp:37-40`) has `v_mbcnt_lo` and no `v_mbcnt_hi`. Scenario: a wave32 mesh program that masks with `s_and_saveexec_b32`, has one immediate allocation, `v_mbcnt_lo` and a target 20 export returns a layout with `wave_size = 64`, `threads = 64` and is forwarded. Either refuse on every 32-bit instruction that can write `exec` (by name, including the implicit forms) and require a positive wave64 signal, or state in both docs that wave32 is detected only for the listed spellings. 2. SHOULD, code reading. Nine negative cases in `tests/mesh57_derive_alloc_check.cpp` pass with the check they name removed: `no allocation` (`:83`), `gap` (`:87`), `twice` (`:91`), `high` (`:95`), `zero` (`:99`), `wide` (`:103`), `exchange` (`:107`), `wave32 exec move` (`:118`), `from_register` (`:122`). Each program has no `v_mbcnt_lo` and no export, and each assertion only checks that `derive_immediate_mesh_layout` returns nothing. With `mesh57_alloc.h:77-78`, `:81-83`, `:93-94` or `:109` deleted, the reader still returns no layout at `:117` (`thread count is not proven`). Only `alloc alone`, `no triangle export` and `wave32 exec alu` (`:48-64`) compare the reason. Build each negative from the accepted `triangle` words with one change, and compare `mesh57_read_layout(...).reason`. 3. SHOULD, code reading. A slot 57 base that was dispatched once passes its blend refusal to slot 55 children whose patch replaces that blend. A direct dispatch on the base stores the `state_block_blend` reason on the base (`native_mesh57.inl:801-802`, `stored == shaders`). A later slot 55 child with a tag 2 patch reaches `:725-726`, which returns the base reason before `blend_override` is looked at (`:799-800`). The same child dispatched before the base is built. The same applies to `derived mesh desktop pipeline was refused` (`:924`), which was decided with the base blend. `derived-slot55-isolate` (`tests/startup_indirect_draw_indexed.cpp:2649-2674`) dispatches the two children only, never the base, so it passes either way. `native-fixed-mesh57.md:133` says the last blend patch replaces the base blend. Skip the inherited reason when it came from the blend or from pipeline creation and an override is present, and add the base-first order to the test. 4. SHOULD, code reading. `mesh57_rasterizer_reason` and `Mesh57RasterizerView` (`mesh57_alloc.h:150-165`) are called only from `tests/mesh57_derive_alloc_check.cpp:66-81`. The runtime decides at `native_mesh57.inl:879-881`, and it decides differently: the helper refuses an absent rasterizer (`:160-161`), the runtime forwards it with the default. `native-fixed-mesh57.md:135` says slot 57 creation does not pass a rasterizer, so for these pipelines the runtime check does not fire and the culling case from the earlier review is still forwarded. The `rasterizer` case in the host check does not fail if `:879-881` changes.
SimSalabimse commented 2026-11-29 17:12:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T17:12:35Z.


On the review of 46be8435. Head is now 0f69e4edf78cbdd1ea9ff560db1636ee39af6dd7, one commit on top of that review, not a rewrite of it. Windows run of this head is below.

  1. MUST. mesh57_read_layout no longer returns wave size 64 from a missing 32-bit exec flag. A 32-bit exec write is still derived mesh is wave32, and that check still wins when a wave64 signal is also present. The 32-bit writers are by name, from the decoder forms: every *_saveexec_b32 and *_wrexec_b32 (destination field is the saved register), and SOP1, SOP2, and SOPK whose data destination is SGPR 126 and whose result is 32 bits, including s_mov_b32, s_not_b32, s_movk_i32, s_cselect_b32, s_add_u32, and s_lshl_b32. Compares, s_setreg*, s_waitcnt*, s_subvector*, and the PC transfers are not treated as data writes of that field. Wave size 64 now requires a positive signal: v_mbcnt_hi_u32_b32, or a 64-bit exec write (s_mov_b64 of exec, the other 64-bit scalar forms with that destination, *_saveexec_b64, *_wrexec_b64). v_mbcnt_lo_u32_b32 is still only the thread-count proof. A program that has that and the allocation and the triangle export, but no wave64 signal, is derived mesh wave size is not proven and returns no layout. The words that were accepted at 46be8435 are that case. They were not kept green by relaxing the rule. The accepted host triangle and the device shader add v_mbcnt_hi_u32_b32 v6, exec, 0 (0xd7660006, 0x000100c1) before s_endpgm. v0 is still the low-half lane id the exports use. Both docs now describe this check, including the saveexec and wrexec forms.

    Host cases, each built from the accepted triangle with one change, and each comparing mesh57_read_layout(...).reason: s_and_saveexec_b32 through s_orn1_saveexec_b32, s_andn1_wrexec_b32, s_andn2_wrexec_b32, s_not_b32, s_movk_i32, s_cselect_b32, s_add_u32, s_lshl_b32, and s_mov_b32 / s_and_b32 of exec_lo are derived mesh is wave32. The triangle with the v_mbcnt_hi pair removed is derived mesh wave size is not proven. s_mov_b64 exec and s_and_saveexec_b64 on that same program are accepted. s_cmpk_eq_i32 of exec_lo does not count as a write and stays accepted.

  2. SHOULD. The nine negatives that only checked that derive_immediate_mesh_layout returned nothing are rebuilt from the accepted triangle with one change, and each now compares the reason: no allocation, gap, twice, high, zero, wide, and exchange are derived mesh needs one immediate allocation; wave32 exec move is derived mesh is wave32; from_register is the allocation reason. empty uses the same reason compare. alloc alone, no triangle export, and wave32 exec alu still compare the reason. Order is allocation, then wave32, then thread count, then topology, then wave64.

  3. SHOULD. A remembered base reason is not returned for a slot 55 child when the call has a blend override and the reason is a blend-decoder reason, derived mesh blend was refused, or derived mesh desktop pipeline was refused. Any other base reason is still inherited and is not copied onto the child. New device mode mesh-derived-slot55-base draws the base first, then a tag 2 child. On both WARP and hardware the base stayed 0/8 with CONSTANT_ALPHA factor without alpha blend factor support at path=57, and the child then painted 1/8 at (2,0) 0xffffffff with reason=forwarded path=55 base=57. mesh-derived-slot55-isolate is unchanged: 0/8, then 1/8. A slot 55 failure is still not written onto the base.

  4. SHOULD. mesh57_rasterizer_reason now returns no reason when the rasterizer is absent, matching the runtime. A present rasterizer that is not the bound default (solid, cull none, depth clip, clockwise) is still derived mesh rasterizer does not match the bound state. The host check covers absent, matched, culled, wireframe, no depth clip, and front ccw. There is still no device mode that sets a captured rasterizer (has_stream_rasterizer is not set anywhere in the device test), so the culling case is still not a device test. I did not add one that does not actually set it.

The paint list is unchanged: mesh-derived, mesh-derived-dxc, mesh-derived-root, mesh-derived-root-heap, and mesh-derived-slot55 expect 1/8. mesh-derived-root-five stays off it. Slot 55 tags other than 2 are not treated as blend.

Windows test PC (MSVC, --preset dev, -j 1), at 0f69e4edf78cbdd1ea9ff560db1636ee39af6dd7. Built x2w_build_rev is 0f69e4ed. cmake --build --preset dev exit 0.

ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure

39/39 passed, ctest exit 0, none skipped. WARP and hardware. That is the previous 37 plus startup_indirect_mesh_derived-slot55-base_warp and startup_indirect_mesh_derived-slot55-base_hardware.

The device shader is 8 bytes longer than at 46be8435 (ms_len 72 to 80 on the default program, 80 to 88 on the one-constant root). Paints and reasons on WARP match that earlier run aside from ms_len and the new mode. Hardware matched WARP on every derived-mesh mode.

Painted 1/8 at (2,0) 0xffffffff, reason=forwarded, on both backends: mesh-derived, mesh-derived-dxc, mesh-derived-root, mesh-derived-root-heap, mesh-derived-slot55. mesh-derived-slot55-isolate and mesh-derived-slot55-base are 0/8 then 1/8, as above. mesh-derived-slot55-mask is still forwarded and 0/8. mesh-derived-root-zero is still forwarded and 0/8.

Stayed 0/8 0xff000000 on both backends: mesh-derived-off (ExecuteIndirect refused, no derive sample), mesh-derived-bad (derived mesh needs one immediate allocation), mesh-derived-depth (derived mesh keeps depth and stencil disabled), mesh-derived-reviewed and mesh-derived-dxc-reviewed (a reviewed mesh profile is present), mesh-derived-untranslated (slot 57 descriptor has no mesh stage length), mesh-derived-root-unset (derived mesh root constants are incomplete), mesh-derived-root-sgpr (native compute +0x24: unbound numeric SGPR s12), mesh-derived-root-table (derived mesh guest root has descriptors), mesh-derived-root-five (derived mesh guest root is heap indexed, real=0).

ctest --preset pr --no-tests=error -j 1 -E 'startup_audio_(output|pacing|provider)' --output-on-failure

95 passed, 7 skipped, none failed, ctest exit 0. Skipped: spirv_minlod_warp, spirv_minlod_exact_warp, spirv_minlod_levels_warp, spirv_minlod_fractional_warp, xmem_placeholder_split_control, xmem_placeholder_split_deployed, xmem_placeholder_split_partial. Same seven as at 46be8435. The extra pass is the new WARP slot55-base mode. Hardware derived-mesh tests are not in that preset; they are in the 39 above.

Still a draft. No game run on this head.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7259509669 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#issuecomment-7259509669). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-29T17:12:35Z. --- On the review of `46be8435`. Head is now `0f69e4edf78cbdd1ea9ff560db1636ee39af6dd7`, one commit on top of that review, not a rewrite of it. Windows run of this head is below. 1. MUST. `mesh57_read_layout` no longer returns wave size 64 from a missing 32-bit `exec` flag. A 32-bit `exec` write is still `derived mesh is wave32`, and that check still wins when a wave64 signal is also present. The 32-bit writers are by name, from the decoder forms: every `*_saveexec_b32` and `*_wrexec_b32` (destination field is the saved register), and SOP1, SOP2, and SOPK whose data destination is SGPR 126 and whose result is 32 bits, including `s_mov_b32`, `s_not_b32`, `s_movk_i32`, `s_cselect_b32`, `s_add_u32`, and `s_lshl_b32`. Compares, `s_setreg*`, `s_waitcnt*`, `s_subvector*`, and the PC transfers are not treated as data writes of that field. Wave size 64 now requires a positive signal: `v_mbcnt_hi_u32_b32`, or a 64-bit `exec` write (`s_mov_b64` of `exec`, the other 64-bit scalar forms with that destination, `*_saveexec_b64`, `*_wrexec_b64`). `v_mbcnt_lo_u32_b32` is still only the thread-count proof. A program that has that and the allocation and the triangle export, but no wave64 signal, is `derived mesh wave size is not proven` and returns no layout. The words that were accepted at `46be8435` are that case. They were not kept green by relaxing the rule. The accepted host triangle and the device shader add `v_mbcnt_hi_u32_b32 v6, exec, 0` (`0xd7660006`, `0x000100c1`) before `s_endpgm`. v0 is still the low-half lane id the exports use. Both docs now describe this check, including the saveexec and wrexec forms. Host cases, each built from the accepted triangle with one change, and each comparing `mesh57_read_layout(...).reason`: `s_and_saveexec_b32` through `s_orn1_saveexec_b32`, `s_andn1_wrexec_b32`, `s_andn2_wrexec_b32`, `s_not_b32`, `s_movk_i32`, `s_cselect_b32`, `s_add_u32`, `s_lshl_b32`, and `s_mov_b32` / `s_and_b32` of `exec_lo` are `derived mesh is wave32`. The triangle with the `v_mbcnt_hi` pair removed is `derived mesh wave size is not proven`. `s_mov_b64 exec` and `s_and_saveexec_b64` on that same program are accepted. `s_cmpk_eq_i32` of `exec_lo` does not count as a write and stays accepted. 2. SHOULD. The nine negatives that only checked that `derive_immediate_mesh_layout` returned nothing are rebuilt from the accepted triangle with one change, and each now compares the reason: `no allocation`, `gap`, `twice`, `high`, `zero`, `wide`, and `exchange` are `derived mesh needs one immediate allocation`; `wave32 exec move` is `derived mesh is wave32`; `from_register` is the allocation reason. `empty` uses the same reason compare. `alloc alone`, `no triangle export`, and `wave32 exec alu` still compare the reason. Order is allocation, then wave32, then thread count, then topology, then wave64. 3. SHOULD. A remembered base reason is not returned for a slot 55 child when the call has a blend override and the reason is a blend-decoder reason, `derived mesh blend was refused`, or `derived mesh desktop pipeline was refused`. Any other base reason is still inherited and is not copied onto the child. New device mode `mesh-derived-slot55-base` draws the base first, then a tag 2 child. On both WARP and hardware the base stayed 0/8 with `CONSTANT_ALPHA factor without alpha blend factor support` at `path=57`, and the child then painted 1/8 at `(2,0)` `0xffffffff` with `reason=forwarded path=55 base=57`. `mesh-derived-slot55-isolate` is unchanged: 0/8, then 1/8. A slot 55 failure is still not written onto the base. 4. SHOULD. `mesh57_rasterizer_reason` now returns no reason when the rasterizer is absent, matching the runtime. A present rasterizer that is not the bound default (solid, cull none, depth clip, clockwise) is still `derived mesh rasterizer does not match the bound state`. The host check covers absent, matched, culled, wireframe, no depth clip, and front ccw. There is still no device mode that sets a captured rasterizer (`has_stream_rasterizer` is not set anywhere in the device test), so the culling case is still not a device test. I did not add one that does not actually set it. The paint list is unchanged: `mesh-derived`, `mesh-derived-dxc`, `mesh-derived-root`, `mesh-derived-root-heap`, and `mesh-derived-slot55` expect 1/8. `mesh-derived-root-five` stays off it. Slot 55 tags other than 2 are not treated as blend. Windows test PC (MSVC, `--preset dev`, `-j 1`), at `0f69e4edf78cbdd1ea9ff560db1636ee39af6dd7`. Built `x2w_build_rev` is `0f69e4ed`. `cmake --build --preset dev` exit 0. ``` ctest --preset dev --no-tests=error -j 1 -R '^(mesh57_derive_alloc|startup_indirect_mesh_derived)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure ``` 39/39 passed, ctest exit 0, none skipped. WARP and hardware. That is the previous 37 plus `startup_indirect_mesh_derived-slot55-base_warp` and `startup_indirect_mesh_derived-slot55-base_hardware`. The device shader is 8 bytes longer than at `46be8435` (`ms_len` 72 to 80 on the default program, 80 to 88 on the one-constant root). Paints and reasons on WARP match that earlier run aside from `ms_len` and the new mode. Hardware matched WARP on every derived-mesh mode. Painted 1/8 at `(2,0)` `0xffffffff`, `reason=forwarded`, on both backends: `mesh-derived`, `mesh-derived-dxc`, `mesh-derived-root`, `mesh-derived-root-heap`, `mesh-derived-slot55`. `mesh-derived-slot55-isolate` and `mesh-derived-slot55-base` are 0/8 then 1/8, as above. `mesh-derived-slot55-mask` is still forwarded and 0/8. `mesh-derived-root-zero` is still forwarded and 0/8. Stayed 0/8 `0xff000000` on both backends: `mesh-derived-off` (ExecuteIndirect refused, no derive sample), `mesh-derived-bad` (`derived mesh needs one immediate allocation`), `mesh-derived-depth` (`derived mesh keeps depth and stencil disabled`), `mesh-derived-reviewed` and `mesh-derived-dxc-reviewed` (`a reviewed mesh profile is present`), `mesh-derived-untranslated` (`slot 57 descriptor has no mesh stage length`), `mesh-derived-root-unset` (`derived mesh root constants are incomplete`), `mesh-derived-root-sgpr` (`native compute +0x24: unbound numeric SGPR s12`), `mesh-derived-root-table` (`derived mesh guest root has descriptors`), `mesh-derived-root-five` (`derived mesh guest root is heap indexed`, `real=0`). ``` ctest --preset pr --no-tests=error -j 1 -E 'startup_audio_(output|pacing|provider)' --output-on-failure ``` 95 passed, 7 skipped, none failed, ctest exit 0. Skipped: `spirv_minlod_warp`, `spirv_minlod_exact_warp`, `spirv_minlod_levels_warp`, `spirv_minlod_fractional_warp`, `xmem_placeholder_split_control`, `xmem_placeholder_split_deployed`, `xmem_placeholder_split_partial`. Same seven as at `46be8435`. The extra pass is the new WARP `slot55-base` mode. Hardware derived-mesh tests are not in that preset; they are in the 39 above. Still a draft. No game run on this head. AI-Assisted
Leyukaka commented 2026-11-29 18:15:39 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Re-review of 0f69e4ed against our 13:30Z review (diff only, nothing built or run here).

  • Point 1 (wave64), fixed: mesh57_alloc.h:111-127 marks *saveexec_b32 / *wrexec_b32 and any SOP1/SOP2/SOPK 32-bit write with SDST 126 as wave32, and :179-182 refuses with derived mesh wave size is not proven when there is neither v_mbcnt_hi_u32_b32 nor a 64-bit exec write.
  • Point 3 (slot 55 child inheriting the base blend refusal), fixed: native_mesh57.inl:726-728 skips a base reason listed in mesh57_blend_override_replaces (mesh57_alloc.h:228) when the call has a blend override; device mode mesh-derived-slot55-base (tests/startup_indirect_draw_indexed.cpp:2653) covers it.
  • Point 2 (negatives), fixed: the refusal cases in tests/mesh57_derive_alloc_check.cpp:154-197 are now built from the accepted triangle, so each one differs from an accepted program by the named change only.
  • Point 4 (rasterizer helper), partly: mesh57_rasterizer_reason (mesh57_alloc.h:216-222) now returns no reason for an absent rasterizer, which agrees with the runtime, but only the test calls it (tests/mesh57_derive_alloc_check.cpp:142-151). The runtime check stays separate at native_mesh57.inl:881-883, so the host case does not pin it.
  • NIT: from_register (tests/mesh57_derive_alloc_check.cpp:195-197) replaces word 0 only and keeps the literal 0x1003, which decodes as a 4-byte VOP2 between the m0 write and GS_ALLOC_REQ. The case would still be refused by the gap rule if the register-source rule were removed; dropping word 1 isolates it.
  • NIT: docs/experiments/native-fixed-mesh57.md:129 says "Any 32-bit instruction that writes exec is refused". The reader checks SOP1/SOP2/SOPK destinations and the implicit saveexec/wrexec forms; a VOP writer with SGPR destination 126 (v_readfirstlane_b32, v_readlane_b32) or an SMEM load into s126 is not covered. Narrow the sentence or extend the reader.
  • NIT: the PR body still cites 46be8435 as the verified head.

Nothing here blocks. We approve once the PR is out of draft.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6104148287 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6104148287). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T18:15:39Z. **Review:** COMMENTED --- Re-review of 0f69e4ed against our 13:30Z review (diff only, nothing built or run here). - Point 1 (wave64), fixed: `mesh57_alloc.h:111-127` marks `*saveexec_b32` / `*wrexec_b32` and any SOP1/SOP2/SOPK 32-bit write with SDST 126 as wave32, and `:179-182` refuses with `derived mesh wave size is not proven` when there is neither `v_mbcnt_hi_u32_b32` nor a 64-bit `exec` write. - Point 3 (slot 55 child inheriting the base blend refusal), fixed: `native_mesh57.inl:726-728` skips a base reason listed in `mesh57_blend_override_replaces` (`mesh57_alloc.h:228`) when the call has a blend override; device mode `mesh-derived-slot55-base` (`tests/startup_indirect_draw_indexed.cpp:2653`) covers it. - Point 2 (negatives), fixed: the refusal cases in `tests/mesh57_derive_alloc_check.cpp:154-197` are now built from the accepted triangle, so each one differs from an accepted program by the named change only. - Point 4 (rasterizer helper), partly: `mesh57_rasterizer_reason` (`mesh57_alloc.h:216-222`) now returns no reason for an absent rasterizer, which agrees with the runtime, but only the test calls it (`tests/mesh57_derive_alloc_check.cpp:142-151`). The runtime check stays separate at `native_mesh57.inl:881-883`, so the host case does not pin it. - NIT: `from_register` (`tests/mesh57_derive_alloc_check.cpp:195-197`) replaces word 0 only and keeps the literal `0x1003`, which decodes as a 4-byte VOP2 between the `m0` write and `GS_ALLOC_REQ`. The case would still be refused by the gap rule if the register-source rule were removed; dropping word 1 isolates it. - NIT: `docs/experiments/native-fixed-mesh57.md:129` says "Any 32-bit instruction that writes `exec` is refused". The reader checks SOP1/SOP2/SOPK destinations and the implicit saveexec/wrexec forms; a VOP writer with SGPR destination 126 (`v_readfirstlane_b32`, `v_readlane_b32`) or an SMEM load into s126 is not covered. Narrow the sentence or extend the reader. - NIT: the PR body still cites 46be8435 as the verified head. Nothing here blocks. We approve once the PR is out of draft.
R0Y00 commented 2026-12-02 22:03:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T22:03:45Z.

Review: CHANGES_REQUESTED


mesh57_read_layout can select wave64 for a wave32 program. At this head, v_mbcnt_hi_u32_b32 alone supplies the wave64 signal. AMD's RDNA 2 ISA, §12.12, explicitly defines that opcode in wave32: it copies S1 to D because the upper lane mask is zero. I assembled s_mov_b64 exec, -1, s_and_saveexec_b64 s[4:5], -1, and the v_mbcnt_lo/v_mbcnt_hi pair with LLVM 15 llvm-mc -triple=amdgcn -mcpu=gfx1013 -show-encoding. Explicit wave32 and wave64 feature settings emitted the same bytes for every instruction. The current fixture's accepted variants exercise these same opcode heuristics, so they cannot distinguish the modes. A wave32 draw can therefore be translated with layout.wave_size = 64, changing lane IDs and masks. Please source wave mode and thread-group size from trusted stage metadata, or refuse the derived path when either is unavailable. A source-built wave32 control with the same instruction bytes should stay on the fallback path.

AMD RDNA 2 ISA, §12.12 (opcode 870).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6159831615 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6159831615). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T22:03:45Z. **Review:** CHANGES_REQUESTED --- `mesh57_read_layout` can select wave64 for a wave32 program. At this head, `v_mbcnt_hi_u32_b32` alone supplies the wave64 signal. AMD's RDNA 2 ISA, §12.12, explicitly defines that opcode in wave32: it copies S1 to D because the upper lane mask is zero. I assembled `s_mov_b64 exec, -1`, `s_and_saveexec_b64 s[4:5], -1`, and the `v_mbcnt_lo`/`v_mbcnt_hi` pair with LLVM 15 `llvm-mc -triple=amdgcn -mcpu=gfx1013 -show-encoding`. Explicit wave32 and wave64 feature settings emitted the same bytes for every instruction. The current fixture's accepted variants exercise these same opcode heuristics, so they cannot distinguish the modes. A wave32 draw can therefore be translated with `layout.wave_size = 64`, changing lane IDs and masks. Please source wave mode and thread-group size from trusted stage metadata, or refuse the derived path when either is unavailable. A source-built wave32 control with the same instruction bytes should stay on the fallback path. [AMD RDNA 2 ISA, §12.12 (opcode 870)](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf#page=192).
SimSalabimse commented 2026-12-03 11:50:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-12-03T11:50:52Z.


Reply to https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6159831615:

You're right that no opcode in these bytes proves wave64. I removed the opcode heuristics: v_mbcnt_hi_u32_b32 and the 64-bit exec writes no longer set the wave size. mesh57_read_layout now takes the wave size and thread count from a declared group (X2W_MESH57_DERIVE_WAVE_SIZE and X2W_MESH57_DERIVE_THREADS), not from captured stage metadata. If either is missing, the derived path is refused ("derived mesh wave size and thread count are not declared"). A declared wave32 is refused as derived mesh is wave32, and any group other than one wave64 of 64 threads is refused too. A 32-bit exec write in the bytes is still refused.

Tests: mesh57_derive_alloc now covers the same bytes with no declaration, half a declaration, wave32 declared, and other group sizes, and checks that a program without v_mbcnt_hi is accepted when wave64 is declared. The device modes mesh-derived-undeclared and mesh-derived-wave32 use the same bytes as mesh-derived and must leave the clear colour.

This branch is merged with current main (d2e6a4ed and later, one CMakePresets.json conflict resolved by keeping startup_upload_reserve and this PR's two entries). Windows test PC, MSVC Debug build of 41462e43, ctest -j 1 -R 'mesh57|native_direct_mesh|startup_indirect|standin': 218/218 passed, none skipped, including the undeclared and wave32 modes on both WARP and hardware.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7377257264 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#issuecomment-7377257264). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-12-03T11:50:52Z. --- Reply to https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6159831615: You're right that no opcode in these bytes proves wave64. I removed the opcode heuristics: `v_mbcnt_hi_u32_b32` and the 64-bit `exec` writes no longer set the wave size. `mesh57_read_layout` now takes the wave size and thread count from a declared group (`X2W_MESH57_DERIVE_WAVE_SIZE` and `X2W_MESH57_DERIVE_THREADS`), not from captured stage metadata. If either is missing, the derived path is refused ("derived mesh wave size and thread count are not declared"). A declared wave32 is refused as `derived mesh is wave32`, and any group other than one wave64 of 64 threads is refused too. A 32-bit `exec` write in the bytes is still refused. Tests: `mesh57_derive_alloc` now covers the same bytes with no declaration, half a declaration, wave32 declared, and other group sizes, and checks that a program without `v_mbcnt_hi` is accepted when wave64 is declared. The device modes `mesh-derived-undeclared` and `mesh-derived-wave32` use the same bytes as `mesh-derived` and must leave the clear colour. This branch is merged with current `main` (d2e6a4ed and later, one `CMakePresets.json` conflict resolved by keeping `startup_upload_reserve` and this PR's two entries). Windows test PC, MSVC Debug build of 41462e43, `ctest -j 1 -R 'mesh57|native_direct_mesh|startup_indirect|standin'`: 218/218 passed, none skipped, including the undeclared and wave32 modes on both WARP and hardware. AI-Assisted
R0Y00 commented 2026-12-03 12:04:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T12:04:44Z.

Review: APPROVED


Re-reviewed 41462e43. The derived path now uses an explicit wave and thread count declaration and fails closed when either is missing or when wave32 is declared. It no longer infers wave64 from the instruction bytes. Independent MSVC Debug and SDK DXC on Windows build 26300: ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '(mesh.*derived|mesh57_derive_alloc)' passed 43/43. Identical source-built instruction bytes draw with explicit wave64/64 threads and leave the target clear when undeclared or declared wave32 on inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, debug layer enabled, no skips. This resolves my prior changes request. The declaration is a per-process opt-in as documented.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6169412824 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3413#pullrequestreview-6169412824). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T12:04:44Z. **Review:** APPROVED --- Re-reviewed 41462e43. The derived path now uses an explicit wave and thread count declaration and fails closed when either is missing or when wave32 is declared. It no longer infers wave64 from the instruction bytes. Independent MSVC Debug and SDK DXC on Windows build 26300: ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '(mesh.*derived|mesh57_derive_alloc)' passed 43/43. Identical source-built instruction bytes draw with explicit wave64/64 threads and leave the target clear when undeclared or declared wave32 on inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, debug layer enabled, no skips. This resolves my prior changes request. The declaration is a per-process opt-in as documented.
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!3413
No description provided.