rdna2spirv: --mesh-serial-waves under --mesh-compute too (SHADER-W64-MESH-SERIAL-COMPUTE) #2506

Merged
qhukz13 merged 7 commits from upstream-pr/2506 into main 2026-11-29 03:36:15 +00:00
qhukz13 commented 2026-11-27 21:21:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-27T21:21:40Z.


Claimed in the coordination issue as SHADER-W64-MESH-SERIAL-COMPUTE: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7227405179

Depends on: #2435 (this branch is its head ad1789d7e plus one commit).

What and why

#2435's --mesh-serial-waves runs an emulated mesh program's waves one after the other, one single-wave pass each, instead of side by side under mini-schedulers. It was off under --mesh-compute, the path for GPUs without VK_EXT_mesh_shader (NVIDIA Pascal and older). Those are also 32-wide GPUs, where every mesh program is wave64-emulated, so they are the ones that pay most for the side-by-side form.

With this change the compute program takes the same passes. Its slot writes (mesh_compute_epilogue) go through ms_serial_epilogue like the mesh epilogue:

  • one barrier and one read of %ms_counts, after the passes;
  • then, per pass, the vertex and primitive stores from that pass's copies of the export variables, at the built-in index + 64 * pass;
  • the slot header is written by index 0, which only lane 0 of pass 0 has.

mesh_compute_epilogue now returns its lines, and assemble indents them, as it already does for the mesh epilogue. Without the flag the output is unchanged.

The metadata keeps the program's thread count in local_size, as #2435 does for mesh. The runtime reads it only for the whole-subgroup and invocation-limit checks (READ IN CODE: runtime/src/subgroup_size.h:135 and :142), and 64 passes both. The docs/design.md row of #2435 now covers this case, and docs/testing.md says how to run it.

Tested

GPUs tested: NVIDIA GeForce GTX 1050 Ti 4 GB desktop (profile S), driver 582.66, Windows 10 19045. Every number below is MEASURED on that machine (n=1 per run unless given); no game files were used.

GTX 1050 Ti 4 GB, NVIDIA 582.66, Windows 10 19045; llvm-mc 21.1.8, Vulkan SDK 1.4.363:

  • python -m pytest tests/test_mesh_serial_waves.py: 31 passed. The same file against #2435's translator: 6 failed (the new mesh-compute module checks), so the tests check the change.
  • Flag off: every runtime/test/shaders/ms_*.asm, translated with --mesh-compute with and without --wave64-emulate, gives byte-for-byte the same SPIR-V as #2435's head (16 of 16 modules).
  • scripts/run_gpu_tests.py --filter ms_ with LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1: 8/8 pass without LEONIDA_MESH_SERIAL_WAVES and 8/8 with it (6 modules translated with mesh_serial_waves: 2).
  • GPU mutant: every pass writes pass 0's copies of the exports. ms_w64x_wave_loops and ms_w64x_wave_votes fail, the two tests whose waves export different data.
  • test_docs_links.py, the docs line checks, check_no_game_data.py on the changed files, git diff --check: clean.

Not measured: the frame time in game (no game files on this machine yet), and other vendors on this path.

AI-assisted: yes (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5533247917 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-27T21:21:40Z. --- Claimed in the coordination issue as SHADER-W64-MESH-SERIAL-COMPUTE: https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7227405179 Depends on: #2435 (this branch is its head `ad1789d7e` plus one commit). ### What and why #2435's `--mesh-serial-waves` runs an emulated mesh program's waves one after the other, one single-wave pass each, instead of side by side under mini-schedulers. It was off under `--mesh-compute`, the path for GPUs without `VK_EXT_mesh_shader` (NVIDIA Pascal and older). Those are also 32-wide GPUs, where every mesh program is wave64-emulated, so they are the ones that pay most for the side-by-side form. With this change the compute program takes the same passes. Its slot writes (`mesh_compute_epilogue`) go through `ms_serial_epilogue` like the mesh epilogue: - one barrier and one read of `%ms_counts`, after the passes; - then, per pass, the vertex and primitive stores from that pass's copies of the export variables, at the built-in index + 64 * pass; - the slot header is written by index 0, which only lane 0 of pass 0 has. `mesh_compute_epilogue` now returns its lines, and `assemble` indents them, as it already does for the mesh epilogue. Without the flag the output is unchanged. The metadata keeps the program's thread count in `local_size`, as #2435 does for mesh. The runtime reads it only for the whole-subgroup and invocation-limit checks (READ IN CODE: `runtime/src/subgroup_size.h:135` and `:142`), and 64 passes both. The `docs/design.md` row of #2435 now covers this case, and `docs/testing.md` says how to run it. ### Tested GPUs tested: NVIDIA GeForce GTX 1050 Ti 4 GB desktop (profile S), driver 582.66, Windows 10 19045. Every number below is MEASURED on that machine (n=1 per run unless given); no game files were used. GTX 1050 Ti 4 GB, NVIDIA 582.66, Windows 10 19045; llvm-mc 21.1.8, Vulkan SDK 1.4.363: - `python -m pytest tests/test_mesh_serial_waves.py`: 31 passed. The same file against #2435's translator: 6 failed (the new mesh-compute module checks), so the tests check the change. - Flag off: every `runtime/test/shaders/ms_*.asm`, translated with `--mesh-compute` with and without `--wave64-emulate`, gives byte-for-byte the same SPIR-V as #2435's head (16 of 16 modules). - `scripts/run_gpu_tests.py --filter ms_` with `LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1`: 8/8 pass without `LEONIDA_MESH_SERIAL_WAVES` and 8/8 with it (6 modules translated with `mesh_serial_waves: 2`). - GPU mutant: every pass writes pass 0's copies of the exports. `ms_w64x_wave_loops` and `ms_w64x_wave_votes` fail, the two tests whose waves export different data. - `test_docs_links.py`, the docs line checks, `check_no_game_data.py` on the changed files, `git diff --check`: clean. Not measured: the frame time in game (no game files on this machine yet), and other vendors on this path. AI-assisted: yes (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timbot103 commented 2026-11-28 00:53:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T00:53:22Z.


Independently verified head 29361079f on Windows 11 Pro 26200, Vulkan SDK 1.4.363.0, WSL llvm-mc 21.1.8, across both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02), no game files.

Dual-GPU Vulkan-validated verification (scripts/run_gpu_tests.py --filter ms_w64x, LEONIDA_W64_EMULATE=1, LEONIDA_VK_VALIDATION=1):

  • Mesh shader path (ms_w64x_ballot, ms_w64x_wave_loops, ms_w64x_wave_votes): 3/3 spirv-val clean; 3/3 PASS (4096/4096 pixels exact) on RTX 5080 and 3/3 PASS (4096/4096 pixels exact) on AMD Radeon, 0 validation errors.
  • LEONIDA_MESH_COMPUTE=1 path (same 3 fixtures): 3/3 spirv-val clean; 3/3 PASS (4096/4096 pixels exact) on RTX 5080 and 3/3 PASS (4096/4096 pixels exact) on AMD Radeon, 0 validation errors.

Static code review notes (3 edge cases worth double-checking):

  1. MUBUF/global DMA-to-LDS (lds modifier): the eligibility filter excludes ds_ instructions, stores, and atomics, but a MUBUF/global load with the lds modifier writes LDS without starting with ds_ — excluding instructions with an lds modifier keeps the no-LDS invariant exact.
  2. Early shader exits inside the pass loop: if an s_endpgm (or OpReturn/OpKill) occurs on a branch inside a pass, returning directly from the loop would skip remaining passes and the shared epilogue (SetMeshOutputs / mesh-compute header writes). Confirming/ensuring early exits branch to %msw_cont (with a unit fixture) guards against this.
  3. Direct built-in reads: verifying that nothing in the ms_serial path reads LocalInvocationID, SubgroupId, or SubgroupLocalInvocationId directly (bypassing the per-pass + 64 * w %local_index) confirms all wave indexing follows the pass variable.

Overall looks very clean and passed both mesh and mesh-compute paths identically on Blackwell and AMD Radeon. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7231265364 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7231265364). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T00:53:22Z. --- Independently verified head `29361079f` on Windows 11 Pro 26200, Vulkan SDK `1.4.363.0`, WSL `llvm-mc 21.1.8`, across both **NVIDIA GeForce RTX 5080** (`616.64`) and **AMD Radeon(TM) Graphics** (`25.10.30.02`), no game files. **Dual-GPU Vulkan-validated verification (`scripts/run_gpu_tests.py --filter ms_w64x`, `LEONIDA_W64_EMULATE=1`, `LEONIDA_VK_VALIDATION=1`):** - **Mesh shader path (`ms_w64x_ballot`, `ms_w64x_wave_loops`, `ms_w64x_wave_votes`):** 3/3 `spirv-val` clean; **3/3 PASS (4096/4096 pixels exact) on RTX 5080** and **3/3 PASS (4096/4096 pixels exact) on AMD Radeon**, 0 validation errors. - **`LEONIDA_MESH_COMPUTE=1` path (same 3 fixtures):** 3/3 `spirv-val` clean; **3/3 PASS (4096/4096 pixels exact) on RTX 5080** and **3/3 PASS (4096/4096 pixels exact) on AMD Radeon**, 0 validation errors. **Static code review notes (3 edge cases worth double-checking):** 1. **MUBUF/global DMA-to-LDS (`lds` modifier):** the eligibility filter excludes `ds_` instructions, stores, and atomics, but a MUBUF/global load with the `lds` modifier writes LDS without starting with `ds_` — excluding instructions with an `lds` modifier keeps the no-LDS invariant exact. 2. **Early shader exits inside the pass loop:** if an `s_endpgm` (or `OpReturn`/`OpKill`) occurs on a branch inside a pass, returning directly from the loop would skip remaining passes and the shared epilogue (`SetMeshOutputs` / mesh-compute header writes). Confirming/ensuring early exits branch to `%msw_cont` (with a unit fixture) guards against this. 3. **Direct built-in reads:** verifying that nothing in the `ms_serial` path reads `LocalInvocationID`, `SubgroupId`, or `SubgroupLocalInvocationId` directly (bypassing the per-pass `+ 64 * w` `%local_index`) confirms all wave indexing follows the pass variable. Overall looks very clean and passed both mesh and mesh-compute paths identically on Blackwell and AMD Radeon. AI-assisted.
zmasi commented 2026-11-28 02:22:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T02:22:33Z.


Fixed-wave64 hardware check at 29361079: gfx906, RADV Mesa 26.0.8, subgroup size 64 only, no VK_EXT_mesh_shader. All eight synthetic mesh-compute fixtures passed in each of four runs: native wave64, native + serial flag, emulated wave64, and emulated + serial flag. Only the last run serialized anything: six modules used two 64-invocation passes. The two ineligible modules were byte-identical with the flag on and off.

The wave-votes and wave-loops fixtures both exported vertices 0, 1 and 64. Their output slots matched the independent expected bytes and all 4,096 pixels matched in every run. Making either wave produce the wrong value in a private control made the pixel check fail. All compute modules and companion vertex modules passed spirv-val; no Khronos validation or synchronization errors in the four hardware runs. This verifies the compute fallback on fixed wave64, not execution on a wave32 device.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232319943 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7232319943). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T02:22:33Z. --- Fixed-wave64 hardware check at `29361079`: gfx906, RADV Mesa 26.0.8, subgroup size 64 only, no `VK_EXT_mesh_shader`. All eight synthetic mesh-compute fixtures passed in each of four runs: native wave64, native + serial flag, emulated wave64, and emulated + serial flag. Only the last run serialized anything: six modules used two 64-invocation passes. The two ineligible modules were byte-identical with the flag on and off. The wave-votes and wave-loops fixtures both exported vertices 0, 1 and 64. Their output slots matched the independent expected bytes and all 4,096 pixels matched in every run. Making either wave produce the wrong value in a private control made the pixel check fail. All compute modules and companion vertex modules passed `spirv-val`; no Khronos validation or synchronization errors in the four hardware runs. This verifies the compute fallback on fixed wave64, not execution on a wave32 device. AI-assisted.
ecox982745 commented 2026-11-28 05:33:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-28T05:33:01Z.


I tested this PR at 29361079f together with the updated wave-0 LDS branch at 46995668d. On Windows with a GeForce RTX 4090 (driver 616.64, subgroup 32..32), all 16 synthetic draws matched the expected image bit for bit. This covers native mesh and forced mesh-as-compute, each with serial waves off and on. Wave64 emulation was enabled throughout.

Synthetic shader Serial enabled, native mesh and compute
ms_w64x_lds_wave0 Two 64-invocation passes. The second wave read the first wave’s shared-memory values and supplied the expected vertex color.
ms_w64x_wave_votes, ms_w64x_wave_loops Both selected two passes and drew the expected triangle.
ms_wave_info_s3 Stayed at 128 invocations. Within each backend its module was byte-identical with serial waves off and on.

For each configuration I checked the SPIR-V entry point and local size, then compared all 4,096 RGBA32F pixels with the expected gradient. A second draw of each configuration produced the same bytes. No Vulkan validation errors appeared. The compute checks used the generated vertex shader and the harness reported a compute dispatch on the same GPU.

For the local integration I retained the LDS branch’s eligibility check, removed its compute-mode veto, and applied this PR’s compute epilogue changes. The combined tools/rdna2spirv.py Git blob is 4feddb71bbb959c07937e2d658dc30f3f5e08b9a. These checks cover shader output on the synthetic fixtures. Game stability and frame rate were outside this run.

AI-assisted with OpenAI Codex (GPT-6).

The author has since put the LDS branch on hold. In a separate RTX 4080 game test, the author reported device loss in four of seven comparable serial runs and zero of six side-by-side runs. The shader in that report exercises a case beyond these synthetic draws. See the game-run report and corrected run counts.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7234737743 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7234737743). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-28T05:33:01Z. --- I tested this PR at `29361079f` together with the [updated wave-0 LDS branch](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7234627472) at `46995668d`. On Windows with a GeForce RTX 4090 (driver 616.64, subgroup 32..32), **all 16 synthetic draws matched the expected image bit for bit**. This covers native mesh and forced mesh-as-compute, each with serial waves off and on. Wave64 emulation was enabled throughout. | Synthetic shader | Serial enabled, native mesh and compute | | --- | --- | | `ms_w64x_lds_wave0` | Two 64-invocation passes. The second wave read the first wave’s shared-memory values and supplied the expected vertex color. | | `ms_w64x_wave_votes`, `ms_w64x_wave_loops` | Both selected two passes and drew the expected triangle. | | `ms_wave_info_s3` | Stayed at 128 invocations. Within each backend its module was byte-identical with serial waves off and on. | For each configuration I checked the SPIR-V entry point and local size, then compared all 4,096 RGBA32F pixels with the expected gradient. A second draw of each configuration produced the same bytes. No Vulkan validation errors appeared. The compute checks used the generated vertex shader and the harness reported a compute dispatch on the same GPU. For the local integration I retained the LDS branch’s eligibility check, removed its compute-mode veto, and applied this PR’s compute epilogue changes. The combined `tools/rdna2spirv.py` Git blob is `4feddb71bbb959c07937e2d658dc30f3f5e08b9a`. These checks cover shader output on the synthetic fixtures. Game stability and frame rate were outside this run. AI-assisted with OpenAI Codex (GPT-6). The author has since put the LDS branch on hold. In a separate RTX 4080 game test, the author reported device loss in four of seven comparable serial runs and zero of six side-by-side runs. The shader in that report exercises a case beyond these synthetic draws. See the [game-run report](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7235113587) and [corrected run counts](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7235116123).
lixonik commented 2026-11-28 10:36:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T10:36:54Z.

Review: APPROVED


Reviewed 29361079f and tested the new --mesh-compute --mesh-serial-waves path.

Code audit:

  • ms_serial_passes and ms_serial_epilogue cleanly extend serial wave execution to --mesh-compute: LocalSize 64 1 1, per-pass slot writes, header (prim_count / vert_count / flags) written only by pass 0 lane 0, meta["mesh_serial_waves"] == 2, and non-qualifying shaders left unchanged.

Verification:

  • Executed all 31 parametrized cases in tests/test_mesh_serial_waves.py (using a Python harness driving conftest.make_shader since pytest is not installed locally) with llvm-mc (LLVM 21.1.8), spirv-as, and spirv-val (Vulkan SDK 1.4.363.1): 31/31 passed.
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6097266459 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#pullrequestreview-6097266459). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T10:36:54Z. **Review:** APPROVED --- Reviewed `29361079f` and tested the new `--mesh-compute` `--mesh-serial-waves` path. Code audit: - `ms_serial_passes` and `ms_serial_epilogue` cleanly extend serial wave execution to `--mesh-compute`: `LocalSize 64 1 1`, per-pass slot writes, header (`prim_count` / `vert_count` / `flags`) written only by pass 0 lane 0, `meta["mesh_serial_waves"] == 2`, and non-qualifying shaders left unchanged. Verification: - Executed all 31 parametrized cases in `tests/test_mesh_serial_waves.py` (using a Python harness driving `conftest.make_shader` since `pytest` is not installed locally) with `llvm-mc` (LLVM 21.1.8), `spirv-as`, and `spirv-val` (Vulkan SDK 1.4.363.1): 31/31 passed. - `python -I scripts/check_no_game_data.py`: passed. AI-assisted (Antigravity, Gemini).
timbot103 commented 2026-11-29 01:06:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T01:06:55Z.

Review: COMMENTED


Static audit of 29361079f only. I ran no builds or GPU tests.

Please add a Workgroup acquire-release barrier on the serial pass continuation in tools/rdna2spirv.py:16228. On a wave32 GPU, one subgroup can start the next pass and clear %x_buf in tools/rdna2spirv.py:19512 while the other subgroup is still reading the previous pass's ballot mask or final scheduler count. The barriers after the reset and after the loop leave that overlap unordered. This affects the shared serial loop that tools/rdna2spirv.py:17236 now uses for mesh-compute.

The compute tests in tests/test_mesh_serial_waves.py:131 cover generated stores and the draw fixtures cover vertices from both passes. Please add a fixture that also writes a primitive from pass 1. The current primitive cap of 64 keeps that store from executing. Please also update the base CLI help in make_game.py:3338, which still says that --mesh-compute outputs are unaffected.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6100842071 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#pullrequestreview-6100842071). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T01:06:55Z. **Review:** COMMENTED --- Static audit of `29361079f` only. I ran no builds or GPU tests. Please add a Workgroup acquire-release barrier on the serial pass continuation in `tools/rdna2spirv.py:16228`. On a wave32 GPU, one subgroup can start the next pass and clear `%x_buf` in `tools/rdna2spirv.py:19512` while the other subgroup is still reading the previous pass's ballot mask or final scheduler count. The barriers after the reset and after the loop leave that overlap unordered. This affects the shared serial loop that `tools/rdna2spirv.py:17236` now uses for mesh-compute. The compute tests in `tests/test_mesh_serial_waves.py:131` cover generated stores and the draw fixtures cover vertices from both passes. Please add a fixture that also writes a primitive from pass 1. The current primitive cap of 64 keeps that store from executing. Please also update the base CLI help in `make_game.py:3338`, which still says that `--mesh-compute` outputs are unaffected. AI-assisted.
zmasi commented 2026-11-29 02:35:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:35:36Z.


Wave32 GPU Verification & SPIR-V Audit (29361079f6 merged into main c8bf0e7b6)

  • Environment: Windows 11, Python 3.12.10, llvm-mc 21.x (amdgcn target), Vulkan SDK 1.4.363.1 (spirv-as, spirv-val, LEONIDA_VK_VALIDATION=1 + VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1 with VK_LAYER_KHRONOS_validation), NVIDIA GeForce RTX 3090 (Ampere, driver 610.88, fixed wave32 subgroups 32..32). Follows up on the earlier fixed-wave64 gfx906 check (#issuecomment-7232319943) to cover native Windows wave32 execution. No game data used (check_no_game_data.py rc=0).
  • Merge & Unit Red -> Green: Merged 29361079f6 cleanly into origin/main (c8bf0e7b6, 0 conflicts).
    • tests/test_mesh_serial_waves.py: RED against main's tools/rdna2spirv.py (25 passed, 6 failed) -> GREEN (31 passed, 0 failed) on the merged tree; test_docs_design_rows.py, test_docs_table_rows.py, and test_docs_encoding.py all pass (rc=0).

Live Wave32 RTX 3090 GPU Matrix (scripts/run_gpu_tests.py --filter ms_ --require-pass, LEONIDA_W64_EMULATE=1)

Mode Path --mesh-serial-waves Result (LEONIDA_VK_VALIDATION=1, VALIDATE_SYNC=1)
1 MeshEXT (LEONIDA_MESH_COMPUTE=0) Off 8/8 PASS (ms_clip 2048/4096, ms_f16_pack, ms_tri 4096/4096, ms_v5_workgroup 24/24, ms_w64x_ballot 4096/4096, ms_w64x_wave_loops 4096/4096, ms_w64x_wave_votes 4096/4096, ms_wave_info_s3 4096/4096; 0 validation/sync errors)
2 MeshEXT (LEONIDA_MESH_COMPUTE=0) On (1) 8/8 PASS (all pixels & coordinates exact, 0 validation/sync errors)
3 GLCompute + .mesh_vs.spv (LEONIDA_MESH_COMPUTE=1) Off 8/8 PASS (all pixels & coordinates exact, 0 validation/sync errors)
4 GLCompute + .mesh_vs.spv (LEONIDA_MESH_COMPUTE=1) On (1) 8/8 PASS (6 qualifying modules run two LocalSize 64 1 1 passes; ms_wave_info_s3 & ms_v5_workgroup stay unchanged; 0 validation/sync errors)

SPIR-V Audit Note on Wave32 Pass-Boundary %x_buf Ordering

Disassembling the generated SPIR-V for ms_tri (scheduler loop) and ms_w64x_wave_votes (inline_all) under --wave64-emulate --mesh-serial-waves --mesh-compute confirms the cross-subgroup ordering gap in ms_serial_passes (tools/rdna2spirv.py — pre-existing from #2435 and shared by #2506):

  • At %msw_body, each pass resets %x_it = 0 and runs the prologue OpAtomicStore %x_zp0 ... %c0 zeroing %x_buf's slot-0 mask/scheduler words before the prologue OpControlBarrier.
  • At %msw_cont, Pass 0 loops directly back to %msw_head -> %msw_body with no OpControlBarrier.
  • On a 32-wide GPU (LocalSize 64 1 1 = 2 subgroups of 32 lanes), whenever Pass 0's final cross-lane exchange uses slot 0 (last_it % 3 == 0 — e.g. ms_w64x_wave_votes when Wave 0 takes only %blk1 at it = 0, or ms_tri when (rounds - 1) % 3 == 0), Subgroup 0 can finish reading %x_buf after Pass 0's last barrier, advance through %msw_cont into Pass 1, and execute OpAtomicStore %x_zp0 0 before Subgroup 1 completes its post-barrier %x_buf load from Pass 0.
  • Adding OpControlBarrier %c2 %c2 %c948 (Workgroup, Workgroup, AcquireRelease | WorkgroupMemory, matching the exchange barrier) at %msw_cont (or gating it on %msw_more / placing it at the top of %msw_body when %msw_w != 0) closes that cross-pass WAR hazard across both MeshEXT and --mesh-compute.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249524995 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7249524995). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:35:36Z. --- ### Wave32 GPU Verification & SPIR-V Audit (`29361079f6` merged into `main` `c8bf0e7b6`) - **Environment**: Windows 11, Python 3.12.10, `llvm-mc` 21.x (`amdgcn` target), Vulkan SDK `1.4.363.1` (`spirv-as`, `spirv-val`, `LEONIDA_VK_VALIDATION=1` + `VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1` with `VK_LAYER_KHRONOS_validation`), **NVIDIA GeForce RTX 3090** (Ampere, driver `610.88`, fixed wave32 subgroups `32..32`). Follows up on the earlier fixed-wave64 `gfx906` check (`#issuecomment-7232319943`) to cover native Windows wave32 execution. No game data used (`check_no_game_data.py` `rc=0`). - **Merge & Unit Red -> Green**: Merged `29361079f6` cleanly into `origin/main` (`c8bf0e7b6`, `0` conflicts). - `tests/test_mesh_serial_waves.py`: **RED** against `main`'s `tools/rdna2spirv.py` (`25 passed, 6 failed`) -> **GREEN** (`31 passed, 0 failed`) on the merged tree; `test_docs_design_rows.py`, `test_docs_table_rows.py`, and `test_docs_encoding.py` all pass (`rc=0`). #### Live Wave32 RTX 3090 GPU Matrix (`scripts/run_gpu_tests.py --filter ms_ --require-pass`, `LEONIDA_W64_EMULATE=1`) | Mode | Path | `--mesh-serial-waves` | Result (`LEONIDA_VK_VALIDATION=1`, `VALIDATE_SYNC=1`) | |---|---|---|---| | 1 | `MeshEXT` (`LEONIDA_MESH_COMPUTE=0`) | Off | **8/8 PASS** (`ms_clip` `2048/4096`, `ms_f16_pack`, `ms_tri` `4096/4096`, `ms_v5_workgroup` `24/24`, `ms_w64x_ballot` `4096/4096`, `ms_w64x_wave_loops` `4096/4096`, `ms_w64x_wave_votes` `4096/4096`, `ms_wave_info_s3` `4096/4096`; `0` validation/sync errors) | | 2 | `MeshEXT` (`LEONIDA_MESH_COMPUTE=0`) | On (`1`) | **8/8 PASS** (all pixels & coordinates exact, `0` validation/sync errors) | | 3 | `GLCompute` + `.mesh_vs.spv` (`LEONIDA_MESH_COMPUTE=1`) | Off | **8/8 PASS** (all pixels & coordinates exact, `0` validation/sync errors) | | 4 | `GLCompute` + `.mesh_vs.spv` (`LEONIDA_MESH_COMPUTE=1`) | On (`1`) | **8/8 PASS** (6 qualifying modules run two `LocalSize 64 1 1` passes; `ms_wave_info_s3` & `ms_v5_workgroup` stay unchanged; `0` validation/sync errors) | #### SPIR-V Audit Note on Wave32 Pass-Boundary `%x_buf` Ordering Disassembling the generated SPIR-V for `ms_tri` (scheduler loop) and `ms_w64x_wave_votes` (`inline_all`) under `--wave64-emulate --mesh-serial-waves --mesh-compute` confirms the cross-subgroup ordering gap in `ms_serial_passes` (`tools/rdna2spirv.py` — pre-existing from `#2435` and shared by `#2506`): - At `%msw_body`, each pass resets `%x_it = 0` and runs the prologue `OpAtomicStore %x_zp0 ... %c0` zeroing `%x_buf`'s slot-0 mask/scheduler words **before** the prologue `OpControlBarrier`. - At `%msw_cont`, Pass `0` loops directly back to `%msw_head -> %msw_body` with **no** `OpControlBarrier`. - On a 32-wide GPU (`LocalSize 64 1 1` = 2 subgroups of 32 lanes), whenever Pass `0`'s final cross-lane exchange uses slot `0` (`last_it % 3 == 0` — e.g. `ms_w64x_wave_votes` when Wave 0 takes only `%blk1` at `it = 0`, or `ms_tri` when `(rounds - 1) % 3 == 0`), Subgroup 0 can finish reading `%x_buf` after Pass `0`'s last barrier, advance through `%msw_cont` into Pass `1`, and execute `OpAtomicStore %x_zp0 0` before Subgroup 1 completes its post-barrier `%x_buf` load from Pass `0`. - Adding `OpControlBarrier %c2 %c2 %c948` (`Workgroup`, `Workgroup`, `AcquireRelease | WorkgroupMemory`, matching the exchange barrier) at `%msw_cont` (or gating it on `%msw_more` / placing it at the top of `%msw_body` when `%msw_w != 0`) closes that cross-pass WAR hazard across both `MeshEXT` and `--mesh-compute`. AI-assisted.
lixonik commented 2026-11-29 02:41:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T02:41:40Z.


Retested head 29361079f69b9e38449dcc1e8896f5f172e5627a merged with main c8bf0e7b65 on Windows 10, CPython 3.12.1, pytest 9.2.0, llvm-mc 21.1.8 and Vulkan SDK SPIR-V tools 1.4.363.1. Two separate results.

  • The stock suite is now 25 passed, 6 failed on the merge. All six failures are the slot-store counter at line 135. The emitted pointer is now %mp0 = OpBitcast %_ptr_PSB_uint ... rather than OpConvertUToPtr, while OpStore %mp0 ... remains. Counting the actual OpStore %mpN instructions and their pass-suffixed equivalents made the six tests pass.
  • I checked the continuation barrier in both vote and loop fixtures, for both MeshEXT and GLCompute. All four modules validate as written, but none has a Workgroup acquire-release barrier in %msw_cont. Adding one there locally made all four structural checks pass, and the modules still validated. This checks the generated synchronization, not whether a GPU exhibited the race.

With both local changes, 35/35 tests passed. Synthetic fixtures only.

AI-assisted. Codex (GPT-6).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249588205 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7249588205). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T02:41:40Z. --- Retested head `29361079f69b9e38449dcc1e8896f5f172e5627a` merged with `main` `c8bf0e7b65` on Windows 10, CPython 3.12.1, pytest 9.2.0, llvm-mc 21.1.8 and Vulkan SDK SPIR-V tools 1.4.363.1. Two separate results. - The stock suite is now **25 passed, 6 failed** on the merge. All six failures are the slot-store counter at line 135. The emitted pointer is now `%mp0 = OpBitcast %_ptr_PSB_uint ...` rather than `OpConvertUToPtr`, while `OpStore %mp0 ...` remains. Counting the actual `OpStore %mpN` instructions and their pass-suffixed equivalents made the six tests pass. - I checked the continuation barrier in both vote and loop fixtures, for both MeshEXT and GLCompute. All four modules validate as written, but none has a Workgroup acquire-release barrier in `%msw_cont`. Adding one there locally made all four structural checks pass, and the modules still validated. This checks the generated synchronization, not whether a GPU exhibited the race. With both local changes, 35/35 tests passed. Synthetic fixtures only. AI-assisted. Codex (GPT-6).
OreoFR commented 2026-11-29 02:59:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:59:35Z.


Verified by OreoFR

  • Base: main 48bae6cad + PR head 29361079f (tested as a merge; it also merges without conflict on the newer main 5825b02ff)
  • Test: python -m pytest tests/test_mesh_serial_waves.py; python -I scripts/run_semantic_tests.py tests/semantic
  • Red on main: test_mesh_serial_waves fails (OpExecutionMode %main LocalSize 64 1 1 missing from the --mesh-compute output); translator suite on main: 526 files, 6506 tests, 1 file failing (test_valu_cvt_f16_int16_mods, a known main failure)
  • Green with the PR: 31 passed; translator suite 526 files, 6506 tests, same single known failure, no new one
  • gta6rt link: OK (gta6rt.exe builds and links; dumpbin /dependents shows the same DLLs as main, no network DLL)
  • Verdict: READY (the GPU mesh fixtures were not run: the GPU was busy with another job)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249772450 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7249772450). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T02:59:35Z. --- **Verified by OreoFR** - Base: main `48bae6cad` + PR head `29361079f` (tested as a merge; it also merges without conflict on the newer main `5825b02ff`) - Test: `python -m pytest tests/test_mesh_serial_waves.py`; `python -I scripts/run_semantic_tests.py tests/semantic` - Red on main: `test_mesh_serial_waves` fails (`OpExecutionMode %main LocalSize 64 1 1` missing from the `--mesh-compute` output); translator suite on main: 526 files, 6506 tests, 1 file failing (`test_valu_cvt_f16_int16_mods`, a known main failure) - Green with the PR: 31 passed; translator suite 526 files, 6506 tests, same single known failure, no new one - gta6rt link: OK (`gta6rt.exe` builds and links; `dumpbin /dependents` shows the same DLLs as main, no network DLL) - Verdict: READY (the GPU mesh fixtures were not run: the GPU was busy with another job) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
DadaCap commented 2026-11-29 03:36:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T03:36:12Z.


Merging, thank you @qhukz13! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7249772450), and it still merges cleanly.

AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250147637 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7250147637). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-29T03:36:12Z. --- Merging, thank you @qhukz13! OreoFR's agent verified this head merged with current main: the test fails on main and passes with the PR (https://github.com/ProjectLeonida/mandy/pull/2506#issuecomment-7249772450), and it still merges cleanly. AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.
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
ProjectLeonida/mandy!2506
No description provided.