cmake: the d3d12_subgroup_test shader rule names the spirv tools folder (BUILD-SUBGROUP-SPIRV-TOOLS) #1129

Merged
MalexAson merged 1 commit from upstream-pr/1129 into main 2026-11-29 08:11:26 +00:00
MalexAson commented 2026-11-24 18:58:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MalexAson on 2026-11-24T18:58:24Z.


Claimed in the coordination issue as: BUILD-SUBGROUP-SPIRV-TOOLS

What and why

The rule that translates the four shader sets of d3d12_subgroup_test ran test/shaders/build.py with only LLVM_MC in its environment, and the block was enabled by LEONIDA_LLVM_MC AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE. The seven other rules that run build.py pass "LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}" and are gated on LEONIDA_SPIRV_AS and LEONIDA_SPIRV_VAL.

So when CMake finds spirv-as through VULKAN_SDK or -DLEONIDA_SPIRV_AS but the tools are not on PATH, the configure enables the test and the build stops at its four rules:

ERROR: spirv-as not found; install SPIRV-Tools (spirv-as, spirv-val) and put it on PATH

The block now looks for the two tools as well, requires them, passes their folder to build.py, and names them in its "is not built" message.

Tested

  • Windows 11, MSVC 19.50 + Ninja, with llvm-mc 23.1.6, SPIRV-Tools 2026.4 and glslang 16.6.0 from a conda environment that is not on PATH (named with -D only). On main the build stops at the four "Translating ... for the subgroup size test" rules. With the change the four generated/subgroup_shaders/*/spirv/index.json outputs build: 1 shader each, translated and spirv-val clean.
  • New tests/test_cmake_spirv_tools_env.py (2 tests, reads runtime/CMakeLists.txt, no compiler): both fail on main, both pass with the change.
  • python -I on tests/test_cmake_translator_deps.py, tests/test_cmake_vulkan_missing.py and tests/test_ctest_registration.py: OK. scripts/check_no_game_data.py on the two changed files: clean.
  • The full d3d12_subgroup_test executable was not rebuilt with this change. Built from 3aa975421 with the tools appended to PATH, ctest -R d3d12_subgroup passed on the GPU below.

GPUs tested: Intel Iris Xe (8086:a7a0), Intel 32.0.101.7092, Windows 11 (for the d3d12_subgroup run above; the change itself needs no GPU)

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. (no translator rule)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5478431466 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1129). Originally posted by [MalexAson](https://github.com/MalexAson) on 2026-11-24T18:58:24Z. --- Claimed in the coordination issue as: BUILD-SUBGROUP-SPIRV-TOOLS ### What and why The rule that translates the four shader sets of `d3d12_subgroup_test` ran `test/shaders/build.py` with only `LLVM_MC` in its environment, and the block was enabled by `LEONIDA_LLVM_MC AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE`. The seven other rules that run `build.py` pass `"LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}"` and are gated on `LEONIDA_SPIRV_AS` and `LEONIDA_SPIRV_VAL`. So when CMake finds `spirv-as` through `VULKAN_SDK` or `-DLEONIDA_SPIRV_AS` but the tools are not on `PATH`, the configure enables the test and the build stops at its four rules: ERROR: spirv-as not found; install SPIRV-Tools (spirv-as, spirv-val) and put it on PATH The block now looks for the two tools as well, requires them, passes their folder to `build.py`, and names them in its "is not built" message. ### Tested - Windows 11, MSVC 19.50 + Ninja, with llvm-mc 23.1.6, SPIRV-Tools 2026.4 and glslang 16.6.0 from a conda environment that is not on `PATH` (named with `-D` only). On `main` the build stops at the four "Translating ... for the subgroup size test" rules. With the change the four `generated/subgroup_shaders/*/spirv/index.json` outputs build: 1 shader each, translated and spirv-val clean. - New `tests/test_cmake_spirv_tools_env.py` (2 tests, reads `runtime/CMakeLists.txt`, no compiler): both fail on `main`, both pass with the change. - `python -I` on `tests/test_cmake_translator_deps.py`, `tests/test_cmake_vulkan_missing.py` and `tests/test_ctest_registration.py`: OK. `scripts/check_no_game_data.py` on the two changed files: clean. - The full `d3d12_subgroup_test` executable was not rebuilt with this change. Built from `3aa975421` with the tools appended to `PATH`, `ctest -R d3d12_subgroup` passed on the GPU below. GPUs tested: Intel Iris Xe (8086:a7a0), Intel 32.0.101.7092, Windows 11 (for the d3d12_subgroup run above; the change itself needs no GPU) 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. (no translator rule) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
abnalstlll-byte commented 2026-11-24 19:16:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:16:01Z.

Review: APPROVED


Reviewed and verified. Fixes build failure for d3d12_subgroup_test when SPIRV tools are located via CMake -D or VULKAN_SDK but not in system PATH, by passing LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE} to build.py consistently with the other shader build rules. Tested with tests/test_cmake_spirv_tools_env.py. 100% clean-room.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045736135 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1129#pullrequestreview-6045736135). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T19:16:01Z. **Review:** APPROVED --- Reviewed and verified. Fixes build failure for `d3d12_subgroup_test` when SPIRV tools are located via CMake `-D` or `VULKAN_SDK` but not in system `PATH`, by passing `LEONIDA_SPIRV_TOOLS=${LEONIDA_SPIRV_TOOLS_NATIVE}` to `build.py` consistently with the other shader build rules. Tested with `tests/test_cmake_spirv_tools_env.py`. 100% clean-room.
Deedlyy commented 2026-11-24 20:15:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:15:12Z.


Recommendation: [MERGE]

Reasoning: The d3d12_subgroup_test shader rule now passes LEONIDA_SPIRV_TOOLS and is gated on spirv-as/spirv-val like the other seven build.py rules, fixing builds where the tools are found via VULKAN_SDK but not on PATH. Small CMake fix with a regression test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143254919 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1129#issuecomment-7143254919). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:15:12Z. --- **Recommendation:** [MERGE] **Reasoning:** The `d3d12_subgroup_test` shader rule now passes `LEONIDA_SPIRV_TOOLS` and is gated on `spirv-as`/`spirv-val` like the other seven `build.py` rules, fixing builds where the tools are found via `VULKAN_SDK` but not on PATH. Small CMake fix with a regression test. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
zmasi commented 2026-11-28 22:44:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:44:04Z.


Windows 11 + MSVC 19.44 + NVIDIA GeForce RTX 3090 Verification (c6b493c519)

Verified c6b493c519135871bcfe4c49463df1923ee7b1ee merged cleanly onto main (adfb3821a) on native Windows 11 (10.0.26200, VS 2022 17.14.40, MSVC 19.44.35228, CPython 3.12.10) and NVIDIA GeForce RTX 3090 (subgroup 32..32, Vulkan 1.4, VK_LAYER_KHRONOS_validation 1.4.363.1), with zero game data.

  • Red (main with VULKAN_SDK set, spirv-as / spirv-val removed from PATH, LEONIDA_SPIRV_TOOLS unset):
    • cmake --build <build> --config Release --target d3d12_subgroup_test failed at Translating cs_w64x_readlane for the subgroup size test (w64_native) with:
      CUSTOMBUILD : error : spirv-as not found; install SPIRV-Tools and put it on PATH (MSB8066, custom rule exit code 2).
  • Green (main + #1129, same PATH-stripped environment):
    • python -I tests/test_cmake_spirv_tools_env.py -v: 2/2 OK (0.002s).
    • cmake --build <build> --config Release --target d3d12_subgroup_test: rc=0 — CMake resolves LEONIDA_SPIRV_AS and LEONIDA_SPIRV_VAL via VULKAN_SDK, passes LEONIDA_SPIRV_TOOLS to all four test/shaders/build.py rules (w64_native, w64_emulated, w32_native, w32_emulated), translates and spirv-val-validates every module, and links d3d12_subgroup_test.exe.
    • Live RTX 3090 execution (LEONIDA_VK_VALIDATION=1): d3d12_subgroup_test.exe rc=0 (0 Khronos validation errors; w64 emulated (cs_w64x_readlane, --wave64-emulate): result exact (121 121 16 97 16 100 100 121), w32 native (cs_wqm_w32): result exact (12 1 4 0 8 15728880 4 32), and all compute/pixel subgroup probes green).
  • Hygiene: check_no_game_data.py, test_ci_registration.py, test_docs_encoding.py, and test_text_write_line_endings.py all OK.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246942936 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1129#issuecomment-7246942936). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:44:04Z. --- ### Windows 11 + MSVC `19.44` + NVIDIA GeForce RTX 3090 Verification (`c6b493c519`) Verified `c6b493c519135871bcfe4c49463df1923ee7b1ee` merged cleanly onto `main` (`adfb3821a`) on native Windows 11 (`10.0.26200`, VS 2022 `17.14.40`, MSVC `19.44.35228`, CPython `3.12.10`) and **NVIDIA GeForce RTX 3090** (subgroup `32..32`, Vulkan `1.4`, `VK_LAYER_KHRONOS_validation` `1.4.363.1`), with zero game data. - **Red (`main` with `VULKAN_SDK` set, `spirv-as` / `spirv-val` removed from `PATH`, `LEONIDA_SPIRV_TOOLS` unset)**: - `cmake --build <build> --config Release --target d3d12_subgroup_test` failed at `Translating cs_w64x_readlane for the subgroup size test (w64_native)` with: `CUSTOMBUILD : error : spirv-as not found; install SPIRV-Tools and put it on PATH` (`MSB8066`, custom rule exit code `2`). - **Green (`main + #1129`, same `PATH`-stripped environment)**: - `python -I tests/test_cmake_spirv_tools_env.py -v`: **`2/2 OK`** (`0.002s`). - `cmake --build <build> --config Release --target d3d12_subgroup_test`: **`rc=0`** — CMake resolves `LEONIDA_SPIRV_AS` and `LEONIDA_SPIRV_VAL` via `VULKAN_SDK`, passes `LEONIDA_SPIRV_TOOLS` to all four `test/shaders/build.py` rules (`w64_native`, `w64_emulated`, `w32_native`, `w32_emulated`), translates and `spirv-val`-validates every module, and links `d3d12_subgroup_test.exe`. - Live RTX 3090 execution (`LEONIDA_VK_VALIDATION=1`): `d3d12_subgroup_test.exe` **`rc=0`** (`0` Khronos validation errors; `w64 emulated (cs_w64x_readlane, --wave64-emulate): result exact (121 121 16 97 16 100 100 121)`, `w32 native (cs_wqm_w32): result exact (12 1 4 0 8 15728880 4 32)`, and all compute/pixel subgroup probes green). - **Hygiene**: `check_no_game_data.py`, `test_ci_registration.py`, `test_docs_encoding.py`, and `test_text_write_line_endings.py` all `OK`. AI-assisted.
TheGeogeo commented 2026-11-29 02:17:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T02:17:11Z.


Tested c6b493c51 merged (no commit) with main 53b77df14. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo; Python 3.12.4. check_no_game_data.py is clean.

  • Green: tests/test_cmake_spirv_tools_env.py passes (2 tests).
  • Red: with runtime/CMakeLists.txt back to main, both fail (LEONIDA_SPIRV_AS is not found in the subgroup rule).
  • C++: with this PR the build runs the subgroup-size shader rules (cs_wqm_w32, cs_w64x_readlane, ps_w64x_readlane, ...), each 1 translated, 1 pass spirv-val, and d3d12_subgroup passes (1.16 s).
  • LINK: gta6rt.exe links without ws2_32.lib with nothing new over main.

No blocker from my side.
AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249330068 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1129#issuecomment-7249330068). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T02:17:11Z. --- Tested `c6b493c51` merged (no commit) with `main` `53b77df14`. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 10.0.26300; MSVC 19.52 (Visual Studio 18), Ninja, RelWithDebInfo; Python 3.12.4. `check_no_game_data.py` is clean. - Green: `tests/test_cmake_spirv_tools_env.py` passes (2 tests). - Red: with `runtime/CMakeLists.txt` back to `main`, both fail (`LEONIDA_SPIRV_AS` is not found in the subgroup rule). - C++: with this PR the build runs the subgroup-size shader rules (`cs_wqm_w32`, `cs_w64x_readlane`, `ps_w64x_readlane`, ...), each `1 translated, 1 pass spirv-val`, and `d3d12_subgroup` passes (1.16 s). - LINK: `gta6rt.exe` links without `ws2_32.lib` with nothing new over `main`. No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 08:11:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T08:11:28Z.


Merged after TheGeogeo's red/green check (check: green with this PR merged onto main, red without it; gta6rt.exe still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with main 985dfac77, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7252944168 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1129#issuecomment-7252944168). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T08:11:28Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1129#issuecomment-7249330068): green with this PR merged onto `main`, red without it; `gta6rt.exe` still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with `main` 985dfac77, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on `main` or Vulkan). _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!1129
No description provided.