Skip to content

vk_pipeline_check: check --mesh-compute entries as compute pipelines - #1514

Open
robot00f wants to merge 1 commit into
ProjectLeonida:mainfrom
robot00f:feat/vk-pipeline-check-mesh-compute
Open

robot00f wants to merge 1 commit into
ProjectLeonida:mainfrom
robot00f:feat/vk-pipeline-check-mesh-compute

Conversation

@robot00f

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: VK-PIPELINE-CHECK-MESH-COMPUTE (#14 (comment))

What and why

When tools/rdna2spirv.py --mesh-compute translates a mesh shader, the emitted SPIR-V module is a GLCompute compute shader (VK_SHADER_STAGE_COMPUTE_BIT), while its index.json entry preserves "stage": "ms" and records "mesh_compute": {...}.

Previously, runtime/test/vk_pipeline_check.cpp treated every "stage": "ms" entry as a native VK_EXT_mesh_shader graphics stage:

  • On GPUs without VK_EXT_mesh_shader (such as NVIDIA Pascal, AMD RDNA1/Vega/Polaris, Intel Gen9, and MoltenVK), all --mesh-compute entries were skipped with SKIPPED <name> (no VK_EXT_mesh_shader), their lds_bytes check read mesh_props.maxMeshSharedMemorySize (0) instead of props.limits.maxComputeSharedMemorySize, their required subgroup size was checked against VK_SHADER_STAGE_MESH_BIT_EXT instead of VK_SHADER_STAGE_COMPUTE_BIT, and --stage cs (--compute-only) left them out.
  • On GPUs with VK_EXT_mesh_shader where --mesh-compute is enabled (for example Intel's Windows Vulkan driver, where make_game.py turns --mesh-compute on automatically), vk_pipeline_check passed the GLCompute module as VK_SHADER_STAGE_MESH_BIT_EXT to vkCreateGraphicsPipelines.

Changes

  • runtime/test/vk_pipeline_check.cpp:
    • Parse "mesh_compute" on ShaderMeta (accepting {...} or null, and failing malformed index parsing before Vulkan loads if "mesh_compute" is neither an object nor null or appears on a stage other than "ms").
    • Route --mesh-compute entries through vkCreateComputePipelines (VK_SHADER_STAGE_COMPUTE_BIT), maxComputeSharedMemorySize, VK_SHADER_STAGE_COMPUTE_BIT subgroup-size checks, and --stage cs (--compute-only), while keeping their summary and --isolate counts under "ms" and leaving native "ms" entries on the VK_EXT_mesh_shader graphics path.
  • runtime/test/check_vk_pipeline_cli.cmake: add CPU-only malformed-index checks for non-object "mesh_compute" values and "mesh_compute" on non-"ms" stages.
  • runtime/test/check_vk_pipeline_mesh_compute.py & runtime/CMakeLists.txt: add end-to-end vk_pipeline_check coverage (registered in CTest as vk_pipeline_check_mesh_compute with SKIP_RETURN_CODE 77) for 152-byte (PhysicalStorageBufferAddresses 2x32-bit pointer without shaderInt64) and --pc-tail-ubo (128-byte + set-1 UBO) --mesh-compute modules, --compute-only / --graphics-only filtering, native "ms" control entries, maxComputeSharedMemorySize rejection, --isolate aggregation, and spirv-val validation.
  • docs/pipeline_check.md: document --mesh-compute handling in vk_pipeline_check.

Tested

  • Pre-fix reproduction (3/3 runs on ms_tri translated with LEONIDA_MESH_COMPUTE=1): vk_pipeline_check skipped ms_tri with SKIPPED ms_tri (no VK_EXT_mesh_shader) (ms pipelines: 0 ok, 0 failed, 1 skipped) under --stage all and checked 0 shaders under --compute-only.
  • Post-fix verification (3/3 runs on ms_tri with LEONIDA_MESH_COMPUTE=1): ms: 1 modules ok, 0 failed and ms pipelines: 1 ok, 0 failed, 0 skipped under both --stage all and --compute-only.
  • CTest (3/3 runs): ctest --test-dir runtime/build -R "^(vk_pipeline_check_cli|vk_pipeline_check_mesh_compute)$" — 2/2 passed across all 3 runs (spirv-val --target-env vulkan1.2 included).
  • Neighbor suites: vk_pipeline_check_stack, pipeline_cache_seed, runtime/test/check_vk_pipeline_mesh_compute.py, tests/test_vk_pipeline_check_index.py, tests/test_vk_pipeline_check_isolate.py, tests/test_ctest_registration.py, tests/test_docs_links.py, tests/test_docs_table_rows.py — all passed.
  • Policy check: python -I scripts/check_no_game_data.py -> exit 0.

GPUs tested: NVIDIA GeForce GTX 1050 Ti (Pascal, 4 GB), driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045 (VK_LOADER_LAYERS_DISABLE=~implicit~; VK_LAYER_KHRONOS_validation is not installed on this host; GPU without VK_EXT_mesh_shader, native mesh-shader GPU path exercised via stage-filter control).

AI-assisted: yes (Antigravity)

Checklist

  • Based on current main and merges cleanly.
  • 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. (Not applicable: no translator rule changed; docs/pipeline_check.md updated.)

When `rdna2spirv.py --mesh-compute` translates a mesh shader, its SPIR-V module
uses the `GLCompute` execution model (`VK_SHADER_STAGE_COMPUTE_BIT`) while its
`index.json` entry keeps `"stage": "ms"` and records a `"mesh_compute"` layout
object. `vk_pipeline_check` previously treated every `"stage": "ms"` entry as a
native `VK_EXT_mesh_shader` graphics shader:
- On GPUs without `VK_EXT_mesh_shader` (such as NVIDIA Pascal), every
  `--mesh-compute` entry was skipped with `no VK_EXT_mesh_shader`, its
  `lds_bytes` check read an unpopulated `maxMeshSharedMemorySize` instead of
  `maxComputeSharedMemorySize`, and `--compute-only` (`--stage cs`) ignored it.
- On GPUs with `VK_EXT_mesh_shader` (such as Intel Windows, where `make_game.py`
  enables `--mesh-compute` automatically), `vk_pipeline_check` passed the
  `GLCompute` module as `VK_SHADER_STAGE_MESH_BIT_EXT` to
  `vkCreateGraphicsPipelines`.

Parse `"mesh_compute"` in `vk_pipeline_check` (rejecting non-object/non-null
values and non-`"ms"` stages during index parsing) and route `--mesh-compute`
entries through `vkCreateComputePipelines`, `maxComputeSharedMemorySize`,
`VK_SHADER_STAGE_COMPUTE_BIT` subgroup-size checks, and the `--stage cs` filter,
while continuing to report their counts under the `"ms"` corpus stage.

Claim: ubiquitarianism#14 (comment)
AI-assisted: yes (Antigravity)
@ytsodacan

ytsodacan commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

[KEEP]

  • Addresses a real gap: --mesh-compute entries (GLCompute SPIR-V, "stage": "ms") were checked as native mesh stages in runtime/test/vk_pipeline_check.cpp. Routing them through vkCreateComputePipelines with compute limits is the right direction.
  • CI is not finished: linux-gpu-tools, macos, windows, change-scope and no-game-data are all still pending. This is a 453-line C++/CMake change that needs those builds to pass.
  • It adds CLI/CMake tests (check_vk_pipeline_cli.cmake, check_vk_pipeline_mesh_compute.py) and docs, so I would rather see them run than merge on the description alone.
  • No duplicate found; runtime: a pipeline cache from the runtime's own device (RT-RUNTIME-PIPELINE-CACHE) #1308 touches pipeline caching in the runtime, not this tool.
  • Re-triage once CI is green.

@GeorgiyDemo

Copy link
Copy Markdown
Contributor

Tested abb81b0ae on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 5129be10d:

  • Rebuilt vk_pipeline_check from this head (C++ changed).
  • runtime/test/check_vk_pipeline_mesh_compute.py with this head's binary: 3/3 OK on both MoltenVK 1.4.2 and KosmicKrisp (Mesa 26.3.1).
  • Baseline: with the last full build at 66d4f5aa3 (whose runtime/test/vk_pipeline_check.cpp predates the change), 2/3 fail with exactly the pre-fix behaviour — both --mesh-compute modules are reported SKIPPED … (no VK_EXT_mesh_shader) and are counted under ms, instead of compiling through vkCreateComputePipelines as compute. The third test (spirv-val on the synthetic modules) passes either way.
  • Caveat: the baseline binary is the old build, not a fresh main build; the failures are the mesh-compute assertions themselves, not unrelated CLI drift.

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

@zmasi

zmasi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

On gfx906 (Vega 20, RADV Mesa 26.0.8, fixed subgroup 64, no VK_EXT_mesh_shader), I rebuilt the checker from both b07b9ecb and abb81b0a. With the same six hand-written mesh shaders translated as compute, the parent skipped all six. This head created 6/6 compute pipelines, 0 failed, in both the default scan and --compute-only; --graphics-only selected none of the six. A native mesh control was still skipped.

Both the 152-byte push-constant form and the 128-byte + set-1 UBO form compiled. The checker accepted 65,536 bytes of compute workgroup memory and rejected 65,537. The targeted vk_pipeline_check_cli and vk_pipeline_check_mesh_compute CTests both passed. These are driver pipeline-creation checks, not draws or D3D12 replay.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants