vk_harness: a vertex shader with subgroup operations is unsupported where the vertex stage has none (TEST-W64G-VS-SUBGROUP-STAGE) #900

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

@⁠hugo0024 on GitHub · 2026-11-24 15:06 UTC · original
hugo0024:w64g-vs-subgroup-stage → main · +51 −1 · 4 files · 1 commits · open

Claimed in the coordination issue as: TEST-W64G-VS-SUBGROUP-STAGE (claim)

What and why

runtime/test/shaders/w64_graphics.py fails all seven vs_w64_* fixtures on a Mac. They read SubgroupLocalInvocationId, and MoltenVK cannot build the pipeline:

vs_w64_c_lane_id  C  64: exit 1: ... [mvk-error] SPIR-V to MSL conversion error: Subgroup builtins are not available in this type of function. | FAILED vkCreateGraphicsPipelines

The device says so itself: its subgroup supportedStages are compute, fragment and tessellation control ("supported_subgroup_stages": 50 from tools/vk_subgroup_info.py). A Metal vertex function has no SIMD-group built-ins. Using subgroup operations in a stage outside supportedStages is not valid Vulkan, so this is a device that cannot run the fixture, not a failure of it.

  • vk_harness.cpp reads VkPhysicalDeviceSubgroupProperties and exits 77 with unsupported: no subgroup operations in the vertex stage when the vertex module declares a GroupNonUniform capability and the vertex stage is not in supportedStages. Only for a plain draw: under VKH_MESH and VKH_MESH_COMPUTE the first module is a mesh shader.
  • spirv_capability.h gets uses_subgroup_operations() (any of the eight GroupNonUniform capabilities), with cases in spirv_capability_test.cpp.
  • w64_graphics.py is unchanged: it already turns a 77 into a SKIP, as it does for the geometry fixtures.
  • docs/testing.md: a paragraph in the w64_graphics.py section on what a Mac gives.

Of the 18 vertex fixtures build.py makes, only the seven vs_w64_* declare a GroupNonUniform capability, so nothing that runs today is skipped by this.

Tested

Apple M5, MoltenVK 1.4.2. w64_graphics.py on all 29 fixtures, before at main 3d3770c16 and after on this branch (vk_harness.cpp and w64_graphics.py did not change in between):

Skipped Failed Exit
Before 22 7 (the vs_w64_*) 1
After 29 0 0
  • The seven now print SKIP (unsupported: unsupported: no subgroup operations in the vertex stage); the doubled word is how the runner prints every 77, the geometry ones too.
  • spirv_capability_test: all checks pass. ctest: 72/72.
  • run_gpu_tests.py: 185/249 passed, 61 skipped, 3 failed in one run and 184 with 4 failed in another. The failures are cs_fma_fused, cs_imgload_tfe, cs_imgload_d16_tfe and the intermittent ps_imgatomic (#543), as on main; every plain vertex shader still draws.
  • tests/test_w64_graphics_*.py, tests/test_docs_*.py and tests/test_i18n_index.py pass.

Not tested: a device that has the vertex stage in supportedStages, where the new check is a no-op by construction, and the geometry stage, which this does not touch (a Mac has none).

GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131)

AI-assisted: yes

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.

🤖 Generated with Claude Code

**@⁠hugo0024** on GitHub · 2026-11-24 15:06 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/900) `hugo0024:w64g-vs-subgroup-stage` → `main` · +51 −1 · 4 files · 1 commits · open Claimed in the coordination issue as: TEST-W64G-VS-SUBGROUP-STAGE ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why `runtime/test/shaders/w64_graphics.py` fails all seven `vs_w64_*` fixtures on a Mac. They read `SubgroupLocalInvocationId`, and MoltenVK cannot build the pipeline: ```text vs_w64_c_lane_id C 64: exit 1: ... [mvk-error] SPIR-V to MSL conversion error: Subgroup builtins are not available in this type of function. | FAILED vkCreateGraphicsPipelines ``` The device says so itself: its subgroup `supportedStages` are compute, fragment and tessellation control (`"supported_subgroup_stages": 50` from `tools/vk_subgroup_info.py`). A Metal vertex function has no SIMD-group built-ins. Using subgroup operations in a stage outside `supportedStages` is not valid Vulkan, so this is a device that cannot run the fixture, not a failure of it. - `vk_harness.cpp` reads `VkPhysicalDeviceSubgroupProperties` and exits 77 with `unsupported: no subgroup operations in the vertex stage` when the vertex module declares a GroupNonUniform capability and the vertex stage is not in `supportedStages`. Only for a plain draw: under `VKH_MESH` and `VKH_MESH_COMPUTE` the first module is a mesh shader. - `spirv_capability.h` gets `uses_subgroup_operations()` (any of the eight GroupNonUniform capabilities), with cases in `spirv_capability_test.cpp`. - `w64_graphics.py` is unchanged: it already turns a 77 into a `SKIP`, as it does for the geometry fixtures. - `docs/testing.md`: a paragraph in the `w64_graphics.py` section on what a Mac gives. Of the 18 vertex fixtures `build.py` makes, only the seven `vs_w64_*` declare a GroupNonUniform capability, so nothing that runs today is skipped by this. ### Tested Apple M5, MoltenVK 1.4.2. `w64_graphics.py` on all 29 fixtures, before at `main` `3d3770c16` and after on this branch (`vk_harness.cpp` and `w64_graphics.py` did not change in between): | | Skipped | Failed | Exit | |---|---|---|---| | Before | 22 | 7 (the `vs_w64_*`) | 1 | | After | 29 | 0 | 0 | - The seven now print `SKIP (unsupported: unsupported: no subgroup operations in the vertex stage)`; the doubled word is how the runner prints every 77, the geometry ones too. - `spirv_capability_test`: all checks pass. `ctest`: 72/72. - `run_gpu_tests.py`: 185/249 passed, 61 skipped, 3 failed in one run and 184 with 4 failed in another. The failures are `cs_fma_fused`, `cs_imgload_tfe`, `cs_imgload_d16_tfe` and the intermittent `ps_imgatomic` (#543), as on `main`; every plain vertex shader still draws. - `tests/test_w64_graphics_*.py`, `tests/test_docs_*.py` and `tests/test_i18n_index.py` pass. Not tested: a device that has the vertex stage in `supportedStages`, where the new check is a no-op by construction, and the geometry stage, which this does not touch (a Mac has none). GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131) AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MoltenVK's subgroup supportedStages are compute, fragment and
tessellation control: a Metal vertex function has no SIMD-group
built-ins. The wave64 vertex fixtures (vs_w64_*) read
SubgroupLocalInvocationId, so w64_graphics.py failed all seven on a Mac
at pipeline creation: "Subgroup builtins are not available in this type
of function".

vk_harness now reads VkPhysicalDeviceSubgroupProperties and exits 77
when the vertex module declares a GroupNonUniform capability and the
vertex stage is not in supportedStages. w64_graphics.py already turns a
77 into a SKIP, as it does for the geometry fixtures. On an Apple M5 the
runner goes from 22 skipped and 7 failed (exit 1) to 29 skipped (exit 0).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:27:08 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 21:09 UTC · original

Reviewed d063e61a: vk_harness now reports 77 for a vertex module declaring GroupNonUniform(61..68) where subgroupSupportedStages has no vertex stage; w64_graphics.py turns 77 into a SKIP. I could not build or run the C++ side here (no GPU and no C++ toolchain), so spirv_capability_test and vk_harness were only read, not executed. What I did run on both trees: the related CPU tests (test_gpu_unsupported_stage, test_w64_graphics_probe, test_wave64_graphics_scan - pass) and a probe that translates all seven vs_w64_* fixtures with the repo's own translator: each declares capability 61 (and SubgroupLocalInvocationId) while vs_ids declares none, so the exit path covers exactly the seven fixtures that failed on MoltenVK. Two non-blocking questions: the commit's "22 skipped and 7 failed -> 29 skipped" does not add up to the 30 entries in FIXTURES - what did the extra fixture do?; and is capability declaration (not builtin use) the intended marker? No findings; CI building spirv_capability_test is the remaining check. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 21:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/900#issuecomment-7174694696) Reviewed d063e61a: `vk_harness` now reports 77 for a vertex module declaring GroupNonUniform(61..68) where `subgroupSupportedStages` has no vertex stage; `w64_graphics.py` turns 77 into a SKIP. I could not build or run the C++ side here (no GPU and no C++ toolchain), so `spirv_capability_test` and `vk_harness` were only read, not executed. What I did run on both trees: the related CPU tests (`test_gpu_unsupported_stage`, `test_w64_graphics_probe`, `test_wave64_graphics_scan` - pass) and a probe that translates all seven vs_w64_* fixtures with the repo's own translator: each declares capability 61 (and SubgroupLocalInvocationId) while vs_ids declares none, so the exit path covers exactly the seven fixtures that failed on MoltenVK. Two non-blocking questions: the commit's "22 skipped and 7 failed -> 29 skipped" does not add up to the 30 entries in FIXTURES - what did the extra fixture do?; and is capability declaration (not builtin use) the intended marker? No findings; CI building spirv_capability_test is the remaining check. AI-assisted review. **Recommendation:** Merge
Author
Owner

@⁠hugo0024 on GitHub · 2026-11-26 07:37 UTC · original

@⁠PierreEbele thanks for the review. Both answers:

  1. The numbers in the commit message were measured on main 3d3770c16, where FIXTURES had 29 entries. ps_w64_a_wqm_uniform_vote came in after that, with f03418595 (SHADER-W64-WQM-UVOTE). On the branch as it is now, rebased onto 6fe83805a, the M5 run is 30 skipped of 30, exit 0; the commit message and the description still carry the first measurement.
  2. Yes, the declaration is the intended marker. A module cannot use a subgroup built-in or a subgroup instruction without declaring a GroupNonUniform capability, so the declaration covers both and sits in the module header, where declares_capability already reads. What it costs is a module that declared one without using it, which would be skipped for nothing: of the 18 vertex fixtures build.py makes, only the seven vs_w64_* declare one.

AI-assisted.

**@⁠hugo0024** on GitHub · 2026-11-26 07:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/900#issuecomment-7185655013) @⁠PierreEbele thanks for the review. Both answers: 1. The numbers in the commit message were measured on `main` `3d3770c16`, where `FIXTURES` had 29 entries. `ps_w64_a_wqm_uniform_vote` came in after that, with `f03418595` (SHADER-W64-WQM-UVOTE). On the branch as it is now, rebased onto `6fe83805a`, the M5 run is 30 skipped of 30, exit 0; the commit message and the description still carry the first measurement. 2. Yes, the declaration is the intended marker. A module cannot use a subgroup built-in or a subgroup instruction without declaring a GroupNonUniform capability, so the declaration covers both and sits in the module header, where `declares_capability` already reads. What it costs is a module that declared one without using it, which would be skipped for nothing: of the 18 vertex fixtures `build.py` makes, only the seven `vs_w64_*` declare one. AI-assisted.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-26 07:50 UTC · original

Tested the vertex-supported case on an RTX 4090, driver 616.64, Windows build 26300. I built vk_harness and spirv_capability_test separately from PR head d063e61ab and its parent 6fe83805a. The device reports supported_subgroup_stages=0x3fff (vertex included) and a subgroup size range of 32–32.

  • GPU: All seven vs_w64_* shaders drew on both revisions. An extra default-size draw of 960 vertices per fixture gave identical four-word records for all 6,720 vertices across the two builds. The fixture checks for defined values, including the atomic counter and slot membership, passed on both.
  • Stock runner: All 30 w64_graphics.py results matched the parent. Each build had 18 passes, 12 tier-C comparisons skipped because they need a 64-lane reference, and zero failures. The geometry ring and all four tier-A/B vertex cases passed. No draw hit the new vertex-stage skip on this GPU.
  • CPU/tooling: spirv_capability_test passed on both revisions. I translated and validated the 30 synthetic fixtures and two helper shaders once, then used those same SPIR-V binaries with both harnesses.
**@⁠ecox982745** on GitHub · 2026-11-26 07:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/900#issuecomment-7185886373) Tested the vertex-supported case on an RTX 4090, driver 616.64, Windows build 26300. I built `vk_harness` and `spirv_capability_test` separately from PR head `d063e61ab` and its parent `6fe83805a`. The device reports `supported_subgroup_stages=0x3fff` (vertex included) and a subgroup size range of 32–32. - **GPU:** All seven `vs_w64_*` shaders drew on both revisions. An extra default-size draw of 960 vertices per fixture gave identical four-word records for all **6,720 vertices** across the two builds. The fixture checks for defined values, including the atomic counter and slot membership, passed on both. - **Stock runner:** All 30 `w64_graphics.py` results matched the parent. Each build had 18 passes, 12 tier-C comparisons skipped because they need a 64-lane reference, and zero failures. The geometry ring and all four tier-A/B vertex cases passed. No draw hit the new vertex-stage skip on this GPU. - **CPU/tooling:** `spirv_capability_test` passed on both revisions. I translated and validated the 30 synthetic fixtures and two helper shaders once, then used those same SPIR-V binaries with both harnesses.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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