make_game, vk_subgroup_info: auto-enable --mesh-compute without VK_EXT_mesh_shader (MAKE-GAME-MESH-COMPUTE-NO-EXT) #1885

Open
github-bot wants to merge 1 commit from github-bot/gh-1885 into main AGit
Owner

@⁠robot00f on GitHub · 2026-11-25 14:23 UTC · original
robot00f:feat/make-game-mesh-compute-no-ext → main · +130 −24 · 8 files · 1 commits · open

Claimed in the coordination issue as: MAKE-GAME-MESH-COMPUTE-NO-EXT (#14; continued in #1608)

What and why

make_game.py previously turned on --mesh-compute automatically only on Intel's Windows Vulkan driver (BUILD-2202, runtime_gpu_mesh_draws_crash). Meanwhile, tools/vk_subgroup_info.py only reported mesh_in_supported_stages from VkPhysicalDeviceSubgroupProperties.supportedStages and skipped vkEnumerateDeviceExtensionProperties on Vulkan 1.3 devices (core13). On GPUs without VK_EXT_mesh_shader / VkPhysicalDeviceMeshShaderFeaturesEXT.meshShader (such as NVIDIA Pascal, AMD RDNA1/GCN, older Intel iGPUs, and MoltenVK), make_game.py left --mesh-compute off unless passed manually, translating native MeshEXT modules that the target GPU cannot create or execute.

  • tools/vk_subgroup_info.py: Enumerates device extensions on both Vulkan 1.2 and Vulkan 1.3 candidate devices, chains VkPhysicalDeviceMeshShaderFeaturesEXT (sType = 1000328000, 40 bytes on 64-bit, meshShader at byte offset 20 after taskShader) when VK_EXT_mesh_shader is advertised, and adds "mesh_shader" (bool) to the JSON output.
  • make_game.py: Adds runtime_gpu_mesh_shader() and automatically enables --mesh-compute during the shaders stage when mesh_shader is False (unless --native-mesh is passed), before wave64_settings and maxPushConstantsSize (152 B) are evaluated. When the GPU probe cannot answer (None), keep_recorded_fallback("--mesh-compute", work) preserves an existing --mesh-compute translation as it already does for BUILD-2202.
  • Docs & tests: Updates --mesh-compute / --native-mesh CLI help, README.md, docs/design.md, tests/test_vk_subgroup_info.py, and tests/test_make_game_translator_flags.py.

Tested

  • Host GPU probe (3/3 runs with VK_LOADER_LAYERS_DISABLE=~implicit~):
    • Before: tools/vk_subgroup_info.py omitted "mesh_shader" and make_game.py left --mesh-compute off on Pascal unless passed on the command line.
    • After: python -I tools/vk_subgroup_info.py deterministically reports "mesh_shader": false (3/3 runs) on GTX 1050 Ti, causing make_game.py to select --mesh-compute automatically.
  • Unit, CLI, and repository checks:
    • python -m compileall -q make_game.py tools tests — PASS
    • python -I make_game.py --help and python -I tools/vk_subgroup_info.py --help — PASS
    • python -I tests/test_vk_subgroup_info.py — 55/55 PASS (including Vulkan 1.2/1.3 VK_EXT_mesh_shader presence and taskShader=1, meshShader=0 offset verification)
    • python -I tests/test_make_game_translator_flags.py — 36/36 PASS (including mesh_shader=False, 144 B -> --pc-tail-ubo interaction, --native-mesh override, and keep_recorded_fallback)
    • All tests/test_make_game_*.py suites, tests/test_wave64_pipeline_audit.py, tests/test_docs_links.py, tests/test_docs_table_rows.py, tests/test_text_write_line_endings.py — 535/535 PASS
    • python -I scripts/check_no_game_data.py on all touched files — PASS
  • Not tested: Full retail shader corpus build (no game files used) and hardware WITH VK_EXT_mesh_shader (covered via FakeVulkan unit tests for both meshShader=1 and taskShader=1, meshShader=0).

GPUs tested: NVIDIA GeForce GTX 1050 Ti (Pascal, 4 GB), driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045

AI-assisted: yes (Antigravity)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed (updated the --mesh-compute row in docs/design.md).
**@⁠robot00f** on GitHub · 2026-11-25 14:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1885) `robot00f:feat/make-game-mesh-compute-no-ext` → `main` · +130 −24 · 8 files · 1 commits · open Claimed in the coordination issue as: `MAKE-GAME-MESH-COMPUTE-NO-EXT` (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14; continued in #1608) ### What and why `make_game.py` previously turned on `--mesh-compute` automatically only on Intel's Windows Vulkan driver (`BUILD-2202`, `runtime_gpu_mesh_draws_crash`). Meanwhile, `tools/vk_subgroup_info.py` only reported `mesh_in_supported_stages` from `VkPhysicalDeviceSubgroupProperties.supportedStages` and skipped `vkEnumerateDeviceExtensionProperties` on Vulkan 1.3 devices (`core13`). On GPUs without `VK_EXT_mesh_shader` / `VkPhysicalDeviceMeshShaderFeaturesEXT.meshShader` (such as NVIDIA Pascal, AMD RDNA1/GCN, older Intel iGPUs, and MoltenVK), `make_game.py` left `--mesh-compute` off unless passed manually, translating native `MeshEXT` modules that the target GPU cannot create or execute. - **`tools/vk_subgroup_info.py`:** Enumerates device extensions on both Vulkan 1.2 and Vulkan 1.3 candidate devices, chains `VkPhysicalDeviceMeshShaderFeaturesEXT` (`sType = 1000328000`, 40 bytes on 64-bit, `meshShader` at byte offset 20 after `taskShader`) when `VK_EXT_mesh_shader` is advertised, and adds `"mesh_shader"` (`bool`) to the JSON output. - **`make_game.py`:** Adds `runtime_gpu_mesh_shader()` and automatically enables `--mesh-compute` during the `shaders` stage when `mesh_shader` is `False` (unless `--native-mesh` is passed), before `wave64_settings` and `maxPushConstantsSize` (152 B) are evaluated. When the GPU probe cannot answer (`None`), `keep_recorded_fallback("--mesh-compute", work)` preserves an existing `--mesh-compute` translation as it already does for `BUILD-2202`. - **Docs & tests:** Updates `--mesh-compute` / `--native-mesh` CLI help, `README.md`, `docs/design.md`, `tests/test_vk_subgroup_info.py`, and `tests/test_make_game_translator_flags.py`. ### Tested - **Host GPU probe (3/3 runs with `VK_LOADER_LAYERS_DISABLE=~implicit~`):** - Before: `tools/vk_subgroup_info.py` omitted `"mesh_shader"` and `make_game.py` left `--mesh-compute` off on Pascal unless passed on the command line. - After: `python -I tools/vk_subgroup_info.py` deterministically reports `"mesh_shader": false` (3/3 runs) on GTX 1050 Ti, causing `make_game.py` to select `--mesh-compute` automatically. - **Unit, CLI, and repository checks:** - `python -m compileall -q make_game.py tools tests` — PASS - `python -I make_game.py --help` and `python -I tools/vk_subgroup_info.py --help` — PASS - `python -I tests/test_vk_subgroup_info.py` — 55/55 PASS (including Vulkan 1.2/1.3 `VK_EXT_mesh_shader` presence and `taskShader=1, meshShader=0` offset verification) - `python -I tests/test_make_game_translator_flags.py` — 36/36 PASS (including `mesh_shader=False`, `144 B -> --pc-tail-ubo` interaction, `--native-mesh` override, and `keep_recorded_fallback`) - All `tests/test_make_game_*.py` suites, `tests/test_wave64_pipeline_audit.py`, `tests/test_docs_links.py`, `tests/test_docs_table_rows.py`, `tests/test_text_write_line_endings.py` — 535/535 PASS - `python -I scripts/check_no_game_data.py` on all touched files — PASS - **Not tested:** Full retail shader corpus build (no game files used) and hardware WITH `VK_EXT_mesh_shader` (covered via `FakeVulkan` unit tests for both `meshShader=1` and `taskShader=1, meshShader=0`). GPUs tested: NVIDIA GeForce GTX 1050 Ti (Pascal, 4 GB), driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045 AI-assisted: yes (Antigravity) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed (updated the `--mesh-compute` row in `docs/design.md`).
make_game.py previously turned on --mesh-compute automatically only on
Intel's Windows Vulkan driver (BUILD-2202, runtime_gpu_mesh_draws_crash).
On GPUs without VK_EXT_mesh_shader / meshShader (such as NVIDIA Pascal,
AMD RDNA1/GCN, older Intel iGPUs, and MoltenVK), make_game.py left
--mesh-compute off unless passed on the command line, translating native
MeshEXT modules that the target GPU cannot create or execute.

- Query VK_EXT_mesh_shader and VkPhysicalDeviceMeshShaderFeaturesEXT.meshShader
  (offset 20, after taskShader) in tools/vk_subgroup_info.py across both
  Vulkan 1.2 and Vulkan 1.3 devices (reusing the cached Vulkan 1.2 extension
  set and deferring Vulkan 1.3 extension enumeration to the winning device),
  exposing "mesh_shader" in the JSON output.
- Add runtime_gpu_mesh_shader() in make_game.py and auto-enable
  --mesh-compute during the shaders stage when mesh_shader is False
  (unless --native-mesh is passed), preserving a recorded --mesh-compute
  setting via keep_recorded_fallback when the probe cannot answer.
- Update CLI help, README.md, docs/design.md, and unit tests in
  tests/test_vk_subgroup_info.py and tests/test_make_game_translator_flags.py.

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7152196533
AI-assisted: yes (Antigravity, Gemini 4 Carbon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:09:55 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-25 14:50 UTC · original

Tested 146ba4cb4 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 446574e76 (Python build tooling; no GPU run):

  • pytest 9.2.0 on test_make_game_argparse, test_make_game_translator_flags, test_make_game_wave64, test_vk_subgroup_info: 166 passed, 1 skipped, 162 subtests passed at this head.
  • The same four on main: 139 failed, 131 passed, 1 skipped, 50 subtests — the auto --mesh-compute logic and the new probe fields are absent there.
  • tools/vk_subgroup_info.py on this machine (Apple M5 Pro, MoltenVK 1.4.2, driver_id 14) now answers an extra "mesh_shader": false alongside mesh_in_required_stages: false / mesh_in_supported_stages: false / per_vertex_inputs: false (main has no mesh_shader key). The auto path therefore stays off here, as intended.
  • Not run: a real make_game build with mesh compute (needs game data).

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-25 14:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1885#issuecomment-7165908883) Tested `146ba4cb4` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `446574e76` (Python build tooling; no GPU run): - pytest 9.2.0 on `test_make_game_argparse`, `test_make_game_translator_flags`, `test_make_game_wave64`, `test_vk_subgroup_info`: **166 passed, 1 skipped, 162 subtests passed** at this head. - The same four on `main`: **139 failed**, 131 passed, 1 skipped, 50 subtests — the auto `--mesh-compute` logic and the new probe fields are absent there. - `tools/vk_subgroup_info.py` on this machine (Apple M5 Pro, MoltenVK 1.4.2, `driver_id 14`) now answers an extra `"mesh_shader": false` alongside `mesh_in_required_stages: false` / `mesh_in_supported_stages: false` / `per_vertex_inputs: false` (`main` has no `mesh_shader` key). The auto path therefore stays off here, as intended. - Not run: a real `make_game` build with mesh compute (needs game data). AI-assisted; synthetic fixtures only, no game data.
Author
Owner

@⁠Mby159 on GitHub · 2026-11-25 16:22 UTC · original

Tested on an AMD Radeon 780M (RDNA3 iGPU, gfx1103), Windows 11, AMD proprietary driver 26.10.2 (LLPC), Vulkan 1.4.359, native wave64 (subgroup_size 64).

The mesh_shader probe answers true on real hardware here - the case your PR body lists as not tested ("hardware WITH VK_EXT_mesh_shader"):

$ python -I tools/vk_subgroup_info.py
{"device": "AMD Radeon 780M Graphics", "subgroup_size": 64, ..., "mesh_shader": true, ...}

The native mesh path works on this device. The repo's own mesh fixtures, run from the PR tree (146ba4cb4) with scripts/run_gpu_tests.py --build <the local llvm-mingw build dir> --filter ms_, no wave64 emulation:

PASS  ms_clip          2048/4096 pixels covered (expected 2048)
PASS  ms_f16_pack      f16 low/high halves and f32 control within 2e-3
PASS  ms_tri           4096/4096 pixels exact
PASS  ms_v5_workgroup  24/24 workgroup coordinates exact (2 x 3 x 4)
PASS  ms_w64x_ballot   4096/4096 pixels exact
PASS  ms_wave_info_s3  4096/4096 pixels exact
6/6 passed

With emulation off, ms_w64x_ballot is skipped unless the harness reports a subgroup range reaching 64; it reported 32..64 here and passed, and the fixture only produces its expected pixels over both halves of a 64-lane wave, so this ran natively at wave64.

--mesh-compute also passes here, at native wave64. With LEONIDA_MESH_COMPUTE=1 and the same command, the same six fixtures give the same six PASS lines (the runner then builds each <name>.mesh_vs.spv and draws the slots with it). The --mesh-compute row in docs/design.md (read on this PR head) records its GPU check on an NVIDIA GTX 1060 (Pascal, 32-wide) with LEONIDA_W64_EMULATE=1; I did not find an AMD or a native-wave64 entry for the --mesh-compute GPU check itself; the AMD mentions in the mesh section (Ryzen 5 7600 RDNA2 iGPU for the native-mesh ms_clip interface-list fix, Radeon 740M for ms_v5_workgroup) are for the native-mesh path, not --mesh-compute. So this is the same flag your PR auto-enables on devices without VK_EXT_mesh_shader; here I forced it with LEONIDA_MESH_COMPUTE=1 and measured it on an AMD device at native wave64. This GPU has mesh shaders, so the PR's auto-enable branch itself is not exercised on this hardware.

On this device the PR head and main make the same translation decisions. runtime_gpu_mesh_shader() is True, so --mesh-compute is not auto-enabled (the GPU can run native mesh); runtime_gpu_mesh_draws_crash() is False; wave64_settings("auto") is (False, True), native wave64 with emulation off. I checked each of these by calling the helpers directly on both trees.

No change in the probe's other output on this device. tools/vk_subgroup_info.py from main (b0f3d3998) on the same machine prints the same fields with the same values; the PR head adds only "mesh_shader": true. So enumerating device extensions on a Vulkan 1.3+ device (this one reports 1.4.359), which main skipped, changed no other field here.

The PR's own Python suites pass locally (PR head 146ba4cb4): tests/test_vk_subgroup_info.py 55 OK, tests/test_make_game_translator_flags.py 36 OK, tests/test_make_game_wave64.py 38 OK.

One small thing: the shaders stage now launches tools/vk_subgroup_info.py one more time. Counting the subprocess launches of the helpers that stage calls, I get 6 on this head and 5 on main - runtime_gpu_info() is not cached and runtime_gpu_mesh_shader() adds a call. Each of those launches has a 60 s timeout (runtime_gpu_info(), make_game.py:1884), so on a machine where the probe cannot answer, that stage can now spend up to 6 minutes on the six probe launches rather than 5.

Scope: the GPU test programs were built locally with llvm-mingw clang++ 23.1.6, not upstream's MSVC toolchain. I ran only the mesh fixtures, not the full suite, and not the retail corpus. The runtime side of the mesh-compute path is not exercised here at all: that needs the D3D12 runtime, which I cannot build (no MSVC or Windows SDK on this machine).

**@⁠Mby159** on GitHub · 2026-11-25 16:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1885#issuecomment-7167865613) Tested on an AMD Radeon 780M (RDNA3 iGPU, gfx1103), Windows 11, AMD proprietary driver 26.10.2 (LLPC), Vulkan 1.4.359, native wave64 (subgroup_size 64). **The `mesh_shader` probe answers `true` on real hardware here** - the case your PR body lists as not tested ("hardware WITH `VK_EXT_mesh_shader`"): ``` $ python -I tools/vk_subgroup_info.py {"device": "AMD Radeon 780M Graphics", "subgroup_size": 64, ..., "mesh_shader": true, ...} ``` **The native mesh path works on this device.** The repo's own mesh fixtures, run from the PR tree (`146ba4cb4`) with `scripts/run_gpu_tests.py --build <the local llvm-mingw build dir> --filter ms_`, no wave64 emulation: ``` PASS ms_clip 2048/4096 pixels covered (expected 2048) PASS ms_f16_pack f16 low/high halves and f32 control within 2e-3 PASS ms_tri 4096/4096 pixels exact PASS ms_v5_workgroup 24/24 workgroup coordinates exact (2 x 3 x 4) PASS ms_w64x_ballot 4096/4096 pixels exact PASS ms_wave_info_s3 4096/4096 pixels exact 6/6 passed ``` With emulation off, `ms_w64x_ballot` is skipped unless the harness reports a subgroup range reaching 64; it reported 32..64 here and passed, and the fixture only produces its expected pixels over both halves of a 64-lane wave, so this ran natively at wave64. **`--mesh-compute` also passes here, at native wave64.** With `LEONIDA_MESH_COMPUTE=1` and the same command, the same six fixtures give the same six PASS lines (the runner then builds each `<name>.mesh_vs.spv` and draws the slots with it). The `--mesh-compute` row in `docs/design.md` (read on this PR head) records its GPU check on an NVIDIA GTX 1060 (Pascal, 32-wide) with `LEONIDA_W64_EMULATE=1`; I did not find an AMD or a native-wave64 entry **for the `--mesh-compute` GPU check itself**; the AMD mentions in the mesh section (Ryzen 5 7600 RDNA2 iGPU for the native-mesh `ms_clip` interface-list fix, Radeon 740M for `ms_v5_workgroup`) are for the native-mesh path, not `--mesh-compute`. So this is the same flag your PR auto-enables on devices **without** `VK_EXT_mesh_shader`; here I forced it with `LEONIDA_MESH_COMPUTE=1` and measured it on an AMD device at native wave64. This GPU has mesh shaders, so the PR's auto-enable branch itself is not exercised on this hardware. **On this device the PR head and `main` make the same translation decisions.** `runtime_gpu_mesh_shader()` is `True`, so `--mesh-compute` is not auto-enabled (the GPU can run native mesh); `runtime_gpu_mesh_draws_crash()` is `False`; `wave64_settings("auto")` is `(False, True)`, native wave64 with emulation off. I checked each of these by calling the helpers directly on both trees. **No change in the probe's other output on this device.** `tools/vk_subgroup_info.py` from `main` (`b0f3d3998`) on the same machine prints the same fields with the same values; the PR head adds only `"mesh_shader": true`. So enumerating device extensions on a Vulkan 1.3+ device (this one reports 1.4.359), which `main` skipped, changed no other field here. The PR's own Python suites pass locally (PR head `146ba4cb4`): `tests/test_vk_subgroup_info.py` 55 OK, `tests/test_make_game_translator_flags.py` 36 OK, `tests/test_make_game_wave64.py` 38 OK. One small thing: the shaders stage now launches `tools/vk_subgroup_info.py` one more time. Counting the subprocess launches of the helpers that stage calls, I get 6 on this head and 5 on `main` - `runtime_gpu_info()` is not cached and `runtime_gpu_mesh_shader()` adds a call. Each of those launches has a 60 s timeout (`runtime_gpu_info()`, `make_game.py:1884`), so on a machine where the probe cannot answer, that stage can now spend up to 6 minutes on the six probe launches rather than 5. Scope: the GPU test programs were built locally with llvm-mingw clang++ 23.1.6, not upstream's MSVC toolchain. I ran only the mesh fixtures, not the full suite, and not the retail corpus. The runtime side of the mesh-compute path is not exercised here at all: that needs the D3D12 runtime, which I cannot build (no MSVC or Windows SDK on this machine).
Author
Owner

@⁠zmasi on GitHub · 2026-11-27 01:54 UTC · original

Verified 5a82e807 against a73a57e1 on gfx906 (Vega 20, RADV Mesa 26.0.8). This device has no VK_EXT_mesh_shader, has native 64-wide compute, and allows 256 push-constant bytes. The new probe reported mesh_shader=false on all three runs.

With a two-fixture synthetic shader workspace and the real GPU probe, translator, assembler and validator (only the retail package check was bypassed for the fixtures), the parent default produced native MeshEXT modules with wave64 emulation. The PR default selected --mesh-compute without forcing the flag, emitted GLCompute with native wave64 and a 152-byte push block, and did not select --pc-tail-ubo. --native-mesh restored the previous representation.

I drew the actual default-output ms_tri and ms_w64x_ballot modules through their generated vertex companions: 4,096/4,096 pixels matched in each. That verifies the automatic translation decision and the standalone draw, not D3D12 DispatchMesh replay.

AI-assisted.

**@⁠zmasi** on GitHub · 2026-11-27 01:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1885#issuecomment-7207669063) Verified `5a82e807` against `a73a57e1` on gfx906 (Vega 20, RADV Mesa 26.0.8). This device has no `VK_EXT_mesh_shader`, has native 64-wide compute, and allows 256 push-constant bytes. The new probe reported `mesh_shader=false` on all three runs. With a two-fixture synthetic shader workspace and the real GPU probe, translator, assembler and validator (only the retail package check was bypassed for the fixtures), the parent default produced native `MeshEXT` modules with wave64 emulation. The PR default selected `--mesh-compute` **without forcing the flag**, emitted `GLCompute` with native wave64 and a 152-byte push block, and did not select `--pc-tail-ubo`. `--native-mesh` restored the previous representation. I drew the actual default-output `ms_tri` and `ms_w64x_ballot` modules through their generated vertex companions: **4,096/4,096 pixels matched in each**. That verifies the automatic translation decision and the standalone draw, not D3D12 `DispatchMesh` replay. AI-assisted.
This pull request has changes conflicting with the target branch.
  • docs/design.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1885/head:github-bot/gh-1885'
git switch 'github-bot/gh-1885'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1885'
git switch 'github-bot/gh-1885'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1885'
git switch 'github-bot/gh-1885'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1885'
git switch 'main'
git merge --squash 'github-bot/gh-1885'
git switch 'main'
git merge --ff-only 'github-bot/gh-1885'
git switch 'main'
git merge 'github-bot/gh-1885'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.