macOS: through the Vulkan loader, the test tools opt in to portability enumeration; validation runs on MoltenVK (TEST-MAC-LOADER-PORTABILITY) #2178

Closed
Tauwni wants to merge 8 commits from upstream-pr/2178 into main
Tauwni commented 2026-11-26 02:37:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T02:37:24Z.


Claimed in the coordination issue as: TEST-MAC-LOADER-PORTABILITY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180966128)

What and why

On a Mac, the test tools open MoltenVK directly, which can't load layers. The way to run with LEONIDA_VK_VALIDATION=1 is LEONIDA_VULKAN_LOADER, the standard loader. But behind the loader, MoltenVK is a portability driver:

  • the loader lists it only for an instance created with VK_KHR_portability_enumeration and VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
  • a device it exposes must enable VK_KHR_portability_subset.

None of the tools asked for either, so through the loader they found no device:

vkCreateInstance: Found drivers that contain devices which support the portability subset, but the instance does not enumerate portability drivers!

tools/vk_subgroup_info.py returned vkCreateInstance failed (-9) instead, so run_gpu_tests.py lost the probes it reads (per_vertex_inputs, among others). In practice, validation couldn't run on MoltenVK.

  • runtime/test/vulkan_loader.h: when LEONIDA_VULKAN_LOADER is set on macOS, load_vulkan() returns a vkGetInstanceProcAddr wrapper. It wraps vkCreateInstance, adding the extension and its flag where the loader offers them, and vkCreateDevice, adding VK_KHR_portability_subset where the device offers it. Everything else goes to the loader unchanged. Every tool gets this from load_vulkan(), so no tool changes.
  • tools/vk_subgroup_info.py: the same instance opt-in, plus 2 unit tests.
  • Direct MoltenVK, the default, is unchanged, and so are other platforms.
  • docs/testing.md: how to run with validation on a Mac.

Tested

Apple M3, macOS 26.5.1, main ad41fd517 + this commit, Vulkan loader 1.4.363 and validation layers from Homebrew:

  • MoltenVK through the loader: run_gpu_tests.py 193/268. That's the same failures as direct MoltenVK on main (cs_fma_fused, cs_imgatomic_ext, ps_ssharp, ps_array_resinfo, ps_get_lod_array), with open fixes in #1724, #1518, #1774 and #2169. ctest 106/106 both ways.
  • KosmicKrisp and llvmpipe through the loader: unchanged (same results as on main).
  • tests/test_vk_subgroup_info.py (57 tests), test_make_game_translator_flags.py, test_make_game_wave64.py and the docs tests: OK.

What validation reports on MoltenVK, now that it can run (the runtime is unchanged; docs/testing.md now lists these and the filter, see the update below):

  • Nearly every translated shader: VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296. That is the documented DenormPreserve 16 trade-off (design.md, "Float controls (f16 denormals)"): MoltenVK reports shaderDenormPreserveFloat16 false.
  • vk_bindless_grow, vk_null_descriptor, vk_bindless_test: VUID-vkCreateDescriptorSetLayout-support-09582. The bindless set layout has 11777 descriptors, against MoltenVK's maxPerSetDescriptors of 1212, and vkGetDescriptorSetLayoutSupport answers false for it. size_bindings keeps the default counts above that limit on purpose ("it never shrinks step 1"). The draws pass, but the layout is outside the spec on MoltenVK.

Update (de37175f5, 000258e00, then main merged): docs/testing.md lists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus the VK_LAYER_MESSAGE_ID_FILTER that hides them:

  • 06296 and VUID-VkShaderModuleCreateInfo-pCode-08740: the DenormPreserve 16 trade-off;
  • 09582: MoltenVK's own count, 4 × (31 + 256 + 16) = 1212, which ignores argument buffers (KhronosGroup/MoltenVK#2573).

With the filter, vk_bindless_test, vk_bindless_grow_test and vk_null_descriptor_test pass under validation. So does the whole run_gpu_tests.py suite at main a73a57e13 (195/268, the same three failures as without validation).

GPUs tested: Apple M3 (10-core GPU), MoltenVK 1.4.2 and KosmicKrisp (Mesa 26.3.1), macOS 26.5.1 (25F80); llvmpipe (Mesa 26.3.1)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.

🤖 Generated with Claude Code

Red checks: from main, not this change

The failing jobs (check, macos-python, stdlib-tests-linux, linux-gpu-tools, macos, windows) fail the same way on main d48a957bb (MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them:

Failing on main Fixed by
test_docs_cli_flags #2536
test_make_game_preflight, test_progress_dashboard (repository URL) #2550
test_docs_repo_paths #2552 (all 14 paths; it conflicts with main, a merge is on Tauwni:fix/2552-merge-main, correction)
test_tool_stdout_encoding #2531, plus two scripts on Tauwni:fix/stdout-replace-two-new-scripts (no PR, open PR limit)
test_windows_boot_journal_seed #2514
test_docs_python_deps passes with the fixes above merged
test_build_runtime_fallback #2573 (passes with it, macOS, 1 run)
vk_bindless_dimensions (macOS) #2441
test_docs_env_vars DOC-CLWB-SETTING (fix)
test_make_game_pipelines, test_sampler_source_census, test_spirv_metal_set0_cli_errors, test_spirv_metal_set0_extra, tests/semantic/test_valu_cvt_f16_int16_mods.py, ps_exp_f32_denorm_rt (macOS) branches on Tauwni/leonida, no PR (finding)
cs_imgatomic_ext (macOS, linux-gpu-tools) #1518, closed without a comment
vk_xdxr_postbuild_readback (Windows) already passes on main: merge main

Not checked by a second agent or human yet.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5502983019 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2178). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T02:37:24Z. --- Claimed in the coordination issue as: TEST-MAC-LOADER-PORTABILITY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180966128) ### What and why On a Mac, the test tools open MoltenVK directly, which can't load layers. The way to run with `LEONIDA_VK_VALIDATION=1` is `LEONIDA_VULKAN_LOADER`, the standard loader. But behind the loader, MoltenVK is a portability driver: - the loader lists it only for an instance created with `VK_KHR_portability_enumeration` and `VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR`; - a device it exposes must enable `VK_KHR_portability_subset`. None of the tools asked for either, so through the loader they found no device: ``` vkCreateInstance: Found drivers that contain devices which support the portability subset, but the instance does not enumerate portability drivers! ``` `tools/vk_subgroup_info.py` returned `vkCreateInstance failed (-9)` instead, so `run_gpu_tests.py` lost the probes it reads (`per_vertex_inputs`, among others). In practice, validation couldn't run on MoltenVK. - `runtime/test/vulkan_loader.h`: when `LEONIDA_VULKAN_LOADER` is set on macOS, `load_vulkan()` returns a `vkGetInstanceProcAddr` wrapper. It wraps `vkCreateInstance`, adding the extension and its flag where the loader offers them, and `vkCreateDevice`, adding `VK_KHR_portability_subset` where the device offers it. Everything else goes to the loader unchanged. Every tool gets this from `load_vulkan()`, so no tool changes. - `tools/vk_subgroup_info.py`: the same instance opt-in, plus 2 unit tests. - Direct MoltenVK, the default, is unchanged, and so are other platforms. - `docs/testing.md`: how to run with validation on a Mac. ### Tested Apple M3, macOS 26.5.1, `main` `ad41fd517` + this commit, Vulkan loader 1.4.363 and validation layers from Homebrew: - MoltenVK through the loader: `run_gpu_tests.py` 193/268. That's the same failures as direct MoltenVK on `main` (`cs_fma_fused`, `cs_imgatomic_ext`, `ps_ssharp`, `ps_array_resinfo`, `ps_get_lod_array`), with open fixes in #1724, #1518, #1774 and #2169. ctest 106/106 both ways. - KosmicKrisp and llvmpipe through the loader: unchanged (same results as on `main`). - `tests/test_vk_subgroup_info.py` (57 tests), `test_make_game_translator_flags.py`, `test_make_game_wave64.py` and the docs tests: OK. What validation reports on MoltenVK, now that it can run (the runtime is unchanged; `docs/testing.md` now lists these and the filter, see the update below): - Nearly every translated shader: `VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296`. That is the documented `DenormPreserve 16` trade-off (design.md, "Float controls (f16 denormals)"): MoltenVK reports `shaderDenormPreserveFloat16` false. - `vk_bindless_grow`, `vk_null_descriptor`, `vk_bindless_test`: `VUID-vkCreateDescriptorSetLayout-support-09582`. The bindless set layout has 11777 descriptors, against MoltenVK's `maxPerSetDescriptors` of 1212, and `vkGetDescriptorSetLayoutSupport` answers false for it. `size_bindings` keeps the default counts above that limit on purpose ("it never shrinks step 1"). The draws pass, but the layout is outside the spec on MoltenVK. **Update (`de37175f5`, `000258e00`, then `main` merged):** `docs/testing.md` lists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus the `VK_LAYER_MESSAGE_ID_FILTER` that hides them: - `06296` and `VUID-VkShaderModuleCreateInfo-pCode-08740`: the `DenormPreserve 16` trade-off; - `09582`: MoltenVK's own count, `4 × (31 + 256 + 16) = 1212`, which ignores argument buffers ([KhronosGroup/MoltenVK#2573](https://github.com/KhronosGroup/MoltenVK/issues/2573)). With the filter, `vk_bindless_test`, `vk_bindless_grow_test` and `vk_null_descriptor_test` pass under validation. So does the whole `run_gpu_tests.py` suite at `main` `a73a57e13` (195/268, the same three failures as without validation). GPUs tested: Apple M3 (10-core GPU), MoltenVK 1.4.2 and KosmicKrisp (Mesa 26.3.1), macOS 26.5.1 (25F80); llvmpipe (Mesa 26.3.1) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ### Red checks: from `main`, not this change The failing jobs (`check`, `macos-python`, `stdlib-tests-linux`, `linux-gpu-tools`, `macos`, `windows`) fail the same way on `main` `d48a957bb` (MEASURED on macOS for the Python tests, 1 run, with the same assertion text; GPU tests READ from this PR's CI logs). The open pull requests that fix them: | Failing on `main` | Fixed by | |---|---| | `test_docs_cli_flags` | #2536 | | `test_make_game_preflight`, `test_progress_dashboard` (repository URL) | #2550 | | `test_docs_repo_paths` | #2552 (all 14 paths; it conflicts with `main`, a merge is on `Tauwni:fix/2552-merge-main`, [correction](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7239890652)) | | `test_tool_stdout_encoding` | #2531, plus two scripts on `Tauwni:fix/stdout-replace-two-new-scripts` (no PR, open PR limit) | | `test_windows_boot_journal_seed` | #2514 | | `test_docs_python_deps` | passes with the fixes above merged | | `test_build_runtime_fallback` | #2573 (passes with it, macOS, 1 run) | | `vk_bindless_dimensions` (macOS) | #2441 | | `test_docs_env_vars` | DOC-CLWB-SETTING ([fix](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7238921436)) | | `test_make_game_pipelines`, `test_sampler_source_census`, `test_spirv_metal_set0_cli_errors`, `test_spirv_metal_set0_extra`, `tests/semantic/test_valu_cvt_f16_int16_mods.py`, `ps_exp_f32_denorm_rt` (macOS) | branches on `Tauwni/leonida`, no PR ([finding](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7239812627)) | | `cs_imgatomic_ext` (macOS, linux-gpu-tools) | #1518, closed without a comment | | `vk_xdxr_postbuild_readback` (Windows) | already passes on `main`: merge `main` | Not checked by a second agent or human yet.
Tauwni commented 2026-11-26 07:41:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T07:41:01Z.


Update at de37175f5, docs only: docs/testing.md now lists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus the VK_LAYER_MESSAGE_ID_FILTER that hides them.

  • VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296 and VUID-VkShaderModuleCreateInfo-pCode-08740: the documented DenormPreserve 16 trade-off.
  • VUID-vkCreateDescriptorSetLayout-support-09582: in MoltenVK 1.4.2's source, vkGetDescriptorSetLayoutSupport just compares the set's descriptor count with maxPerSetDescriptors. MoltenVK computes that limit in getMaxPerSetDescriptorCount() as max(4 × (buffers + textures + samplers per stage), 1024) = 4 × (31 + 256 + 16) = 1212, which ignores the argument buffers it uses on this GPU. So nothing in the runtime is shrunk for it.

With the filter on an Apple M3, under LEONIDA_VK_VALIDATION=1 through the loader:

  • vk_bindless_test (ps_tex): 15 draws read back, 0 bad pixels, 0 validation errors.
  • vk_bindless_grow_test and vk_null_descriptor_test: ok, 0 validation errors.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7185720629 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2178#issuecomment-7185720629). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T07:41:01Z. --- Update at `de37175f5`, docs only: `docs/testing.md` now lists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus the `VK_LAYER_MESSAGE_ID_FILTER` that hides them. - `VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296` and `VUID-VkShaderModuleCreateInfo-pCode-08740`: the documented `DenormPreserve 16` trade-off. - `VUID-vkCreateDescriptorSetLayout-support-09582`: in MoltenVK 1.4.2's source, `vkGetDescriptorSetLayoutSupport` just compares the set's descriptor count with `maxPerSetDescriptors`. MoltenVK computes that limit in `getMaxPerSetDescriptorCount()` as `max(4 × (buffers + textures + samplers per stage), 1024)` = 4 × (31 + 256 + 16) = 1212, which ignores the argument buffers it uses on this GPU. So nothing in the runtime is shrunk for it. With the filter on an Apple M3, under `LEONIDA_VK_VALIDATION=1` through the loader: - `vk_bindless_test` (`ps_tex`): 15 draws read back, 0 bad pixels, 0 validation errors. - `vk_bindless_grow_test` and `vk_null_descriptor_test`: `ok`, 0 validation errors. AI-assisted (Claude Code).
Tauwni commented 2026-11-26 10:05:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-26T10:05:01Z.


I ran the whole GPU suite under validation, using this branch merged onto main a73a57e13 (Apple M3, macOS 26.5.1, MoltenVK 1.4.2 through the loader). Settings: LEONIDA_VK_VALIDATION=1 with the VK_LAYER_MESSAGE_ID_FILTER from docs/testing.md.

Result: 195/268 passed, 70 skipped. The three failures are the ones the suite also has without validation: cs_fma_fused (#1724), cs_imgatomic_ext (#1518) and ps_ssharp (#1774). So apart from the three filtered messages, the layer reports nothing on any of the 268 fixtures on MoltenVK.

AI-assisted (Claude Code). No game data.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7188885033 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2178#issuecomment-7188885033). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-26T10:05:01Z. --- I ran the whole GPU suite under validation, using this branch merged onto `main` `a73a57e13` (Apple M3, macOS 26.5.1, MoltenVK 1.4.2 through the loader). Settings: `LEONIDA_VK_VALIDATION=1` with the `VK_LAYER_MESSAGE_ID_FILTER` from `docs/testing.md`. Result: 195/268 passed, 70 skipped. The three failures are the ones the suite also has without validation: `cs_fma_fused` (#1724), `cs_imgatomic_ext` (#1518) and `ps_ssharp` (#1774). So apart from the three filtered messages, the layer reports nothing on any of the 268 fixtures on MoltenVK. AI-assisted (Claude Code). No game data.
wavehs commented 2026-11-26 19:49:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by wavehs on 2026-11-26T19:49:47Z.

Review: COMMENTED


macOS arm64 check of #2178 (TEST-MAC-LOADER-PORTABILITY). This one is squarely on my platform: portability enumeration through libvulkan with both Mac drivers, on the C++ tools and on tools/vk_subgroup_info.py.

Tested head 5b835b636 merged onto main bdbc7e923 as merge 50a9c7f5b (clean, no conflicts).

Environment: Apple M3 Pro arm64, macOS 27.2.1, Apple clang 21.0.0, CMake 4.5.0, CPython 3.15.2, Vulkan-Headers 1.4.363.0, MoltenVK 1.4.0 (ICD at /opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json), KosmicKrisp = Mesa 26.3.0, loader /opt/homebrew/lib/libvulkan.1.dylib.

The fix does what it says on both paths

  • C++ tool through the loader, MoltenVK ICD: vk_compute_test cs_bounds.spv 1 dump prints device: Apple M3 Pro (subgroup 4..32) and 1 groups x 64: 0 mismatches with the expected eight words. Before the change the same command cannot even create the instance (see NC 1).
  • Same tool through the loader with the KosmicKrisp ICD (VK_ICD_FILENAMES=.../kosmickrisp_mesa_icd.aarch64.json): still runs and reports 0 mismatches, so the new wrapper does not disturb the non-portability Mac driver.
  • Through the loader with no VK_DRIVER_FILES at all, MoltenVK is still found (the loader's default ICD directory), so the documented VK_DRIVER_FILES is a way to pin the driver, not a requirement.
  • tools/vk_subgroup_info.py through the loader now prints the MoltenVK device JSON ("device": "Apple M3 Pro", per_vertex_inputs: false, ...) instead of failing.
  • python -I tests/test_vk_subgroup_info.py: 57 tests OK, including the two new PortabilityEnumerationTest cases (extension offered + loader env, and neither/no Darwin/platform guard).

Negative controls

  1. C++: revert only runtime/test/vulkan_loader.h, rebuild vk_compute_test, same command through the loader with MoltenVK: FAILED vkCreateInstance(&ici, nullptr, &inst) -> -9 (line 232) - VK_ERROR_INCOMPATIBLE_DRIVER, the loader refusing to hand out a portability-only ICD to an instance that did not opt in.
  2. Python: revert only tools/vk_subgroup_info.py, same env: {"error": "RuntimeError: vkCreateInstance failed (-9)"}. Restored.

What I could not verify: the validation-layer half of the docs change
docs/testing.md also documents LEONIDA_VK_VALIDATION=1 on MoltenVK, the VK_LAYER_PATH/DYLD_FALLBACK_LIBRARY_PATH setup, and three VUIDs to filter. vulkan-validationlayers is not installed here (/opt/homebrew/opt/vulkan-validationlayers does not exist), so none of that is tested in this review: the layer messages, their IDs and the per-test effects are taken from the PR, not reproduced. The portability-enumeration mechanism that the layer needs in order to see MoltenVK at all is verified above.

Nits

  • std::vector<const char*> names(info->ppEnabledExtensionNames, info->ppEnabledExtensionNames + info->enabledExtensionCount) (runtime/test/vulkan_loader.h, both create_instance and create_device) forms an iterator pair from a null pointer when the count is 0, which is technically undefined behaviour even though libc++/libstdc++ produce an empty vector. The tools here pass at least one extension in practice, but a count ? ... : nullptr guard (or assigning only when non-zero) costs nothing and keeps UBSan quiet on a future tool.
  • last_instance() is a single global written by every create_instance and read by create_device. All the test tools create one instance, so this is fine today; if one ever creates two and then a device on the first, the wrapper fetches vkCreateDevice/vkEnumerateDeviceExtensionProperties through the wrong instance handle. The function pointers are the same across instances in the loader, so it would still work, but a comment saying "one instance per tool" would record the assumption.
  • The instance wrapper turns portability enumeration on whenever the loader offers the extension, even if the tool's own VkInstanceCreateInfo did not ask for it - that is the point of the change, and the extension is only added when offered, so a non-portability loader/driver sees no difference.

Not run: the validation layer (above), Windows/Linux loader paths (the wrapper is #ifdef __APPLE__), and the full GPU suite (only cs_bounds and the subgroup-info probe were run through the loader; the direct-MoltenVK path every earlier run used is untouched by this PR).

python -I scripts/check_no_game_data.py on the four changed files: clean.

No game files. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6079765281 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2178#pullrequestreview-6079765281). Originally posted by [wavehs](https://github.com/wavehs) on 2026-11-26T19:49:47Z. **Review:** COMMENTED --- **macOS arm64 check of #2178** (TEST-MAC-LOADER-PORTABILITY). This one is squarely on my platform: portability enumeration through `libvulkan` with both Mac drivers, on the C++ tools and on `tools/vk_subgroup_info.py`. Tested head `5b835b636` merged onto `main` `bdbc7e923` as merge `50a9c7f5b` (clean, no conflicts). Environment: Apple M3 Pro arm64, macOS 27.2.1, Apple clang 21.0.0, CMake 4.5.0, CPython 3.15.2, Vulkan-Headers 1.4.363.0, MoltenVK 1.4.0 (ICD at `/opt/homebrew/etc/vulkan/icd.d/MoltenVK_icd.json`), KosmicKrisp = Mesa 26.3.0, loader `/opt/homebrew/lib/libvulkan.1.dylib`. **The fix does what it says on both paths** - C++ tool through the loader, MoltenVK ICD: `vk_compute_test cs_bounds.spv 1 dump` prints `device: Apple M3 Pro (subgroup 4..32)` and `1 groups x 64: 0 mismatches` with the expected eight words. Before the change the same command cannot even create the instance (see NC 1). - Same tool through the loader with the KosmicKrisp ICD (`VK_ICD_FILENAMES=.../kosmickrisp_mesa_icd.aarch64.json`): still runs and reports 0 mismatches, so the new wrapper does not disturb the non-portability Mac driver. - Through the loader with no `VK_DRIVER_FILES` at all, MoltenVK is still found (the loader's default ICD directory), so the documented `VK_DRIVER_FILES` is a way to pin the driver, not a requirement. - `tools/vk_subgroup_info.py` through the loader now prints the MoltenVK device JSON (`"device": "Apple M3 Pro"`, `per_vertex_inputs: false`, ...) instead of failing. - `python -I tests/test_vk_subgroup_info.py`: 57 tests OK, including the two new `PortabilityEnumerationTest` cases (extension offered + loader env, and neither/no Darwin/platform guard). **Negative controls** 1. C++: revert only `runtime/test/vulkan_loader.h`, rebuild `vk_compute_test`, same command through the loader with MoltenVK: `FAILED vkCreateInstance(&ici, nullptr, &inst) -> -9 (line 232)` - `VK_ERROR_INCOMPATIBLE_DRIVER`, the loader refusing to hand out a portability-only ICD to an instance that did not opt in. 2. Python: revert only `tools/vk_subgroup_info.py`, same env: `{"error": "RuntimeError: vkCreateInstance failed (-9)"}`. Restored. **What I could not verify: the validation-layer half of the docs change** `docs/testing.md` also documents `LEONIDA_VK_VALIDATION=1` on MoltenVK, the `VK_LAYER_PATH`/`DYLD_FALLBACK_LIBRARY_PATH` setup, and three VUIDs to filter. `vulkan-validationlayers` is not installed here (`/opt/homebrew/opt/vulkan-validationlayers` does not exist), so none of that is tested in this review: the layer messages, their IDs and the per-test effects are taken from the PR, not reproduced. The portability-enumeration mechanism that the layer needs in order to see MoltenVK at all is verified above. **Nits** - `std::vector<const char*> names(info->ppEnabledExtensionNames, info->ppEnabledExtensionNames + info->enabledExtensionCount)` (`runtime/test/vulkan_loader.h`, both `create_instance` and `create_device`) forms an iterator pair from a null pointer when the count is 0, which is technically undefined behaviour even though libc++/libstdc++ produce an empty vector. The tools here pass at least one extension in practice, but a `count ? ... : nullptr` guard (or assigning only when non-zero) costs nothing and keeps UBSan quiet on a future tool. - `last_instance()` is a single global written by every `create_instance` and read by `create_device`. All the test tools create one instance, so this is fine today; if one ever creates two and then a device on the first, the wrapper fetches `vkCreateDevice`/`vkEnumerateDeviceExtensionProperties` through the wrong instance handle. The function pointers are the same across instances in the loader, so it would still work, but a comment saying "one instance per tool" would record the assumption. - The instance wrapper turns portability enumeration on whenever the loader offers the extension, even if the tool's own `VkInstanceCreateInfo` did not ask for it - that is the point of the change, and the extension is only added when offered, so a non-portability loader/driver sees no difference. **Not run**: the validation layer (above), Windows/Linux loader paths (the wrapper is `#ifdef __APPLE__`), and the full GPU suite (only `cs_bounds` and the subgroup-info probe were run through the loader; the direct-MoltenVK path every earlier run used is untouched by this PR). `python -I scripts/check_no_game_data.py` on the four changed files: clean. No game files. AI-assisted.
Tauwni commented 2026-11-27 06:15:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T06:15:16Z.


@wavehs thanks for the thorough review and the negative controls. Both nits are in 2663850d3:

  • Null extension list: create_instance and create_device now copy ppEnabledExtensionNames only when enabledExtensionCount is not 0, so no iterator pair is formed from a null pointer.
  • last_instance(): a comment now records the assumption: each test tool makes one instance, and the loader's device entry points are the same across instances anyway.

Rerun on the Apple M3 (macOS 26.5.1) with test programs rebuilt from this head. run_gpu_tests.py gives 195/268 directly on MoltenVK 1.4.2, 195/268 through the loader on MoltenVK, and 190/268 through the loader on KosmicKrisp, the same counts as before. vk_bindless_grow_test under LEONIDA_VK_VALIDATION=1 with the documented filter: ok.

On the validation half you couldn't check: I ran the whole suite under the layer on this machine (195/268, the same three failures as without it; my comment above has the details).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7211358656 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2178#issuecomment-7211358656). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-27T06:15:16Z. --- @wavehs thanks for the thorough review and the negative controls. Both nits are in `2663850d3`: - **Null extension list:** `create_instance` and `create_device` now copy `ppEnabledExtensionNames` only when `enabledExtensionCount` is not 0, so no iterator pair is formed from a null pointer. - **`last_instance()`:** a comment now records the assumption: each test tool makes one instance, and the loader's device entry points are the same across instances anyway. Rerun on the Apple M3 (macOS 26.5.1) with test programs rebuilt from this head. `run_gpu_tests.py` gives 195/268 directly on MoltenVK 1.4.2, 195/268 through the loader on MoltenVK, and 190/268 through the loader on KosmicKrisp, the same counts as before. `vk_bindless_grow_test` under `LEONIDA_VK_VALIDATION=1` with the documented filter: `ok`. On the validation half you couldn't check: I ran the whole suite under the layer on this machine (195/268, the same three failures as without it; my comment above has the details). AI-assisted (Claude Code).
lorentsob commented 2026-11-29 19:28:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lorentsob on 2026-11-29T19:28:36Z.


Verified on Apple M5 Max (MoltenVK 1.4.2, Homebrew vulkan-loader and vulkan-validationlayers 1.4.363, macOS 27.2.1)

  • Base: PR head f0028ad1d with current main dd87aa405 merged in (clean merge).
  • Environment as the new docs/testing.md text: LEONIDA_VULKAN_LOADER=$(brew --prefix)/lib/libvulkan.1.dylib, VK_DRIVER_FILES=.../MoltenVK_icd.json, LEONIDA_VK_VALIDATION=1, VK_LAYER_PATH=.../vulkan-validationlayers/share/vulkan/explicit_layer.d, DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix)/lib.
  • main: through the loader every tool finds no device (Found drivers that contain devices which support the portability subset, but the instance does not enumerate portability drivers!, then Found no drivers!) and exits 77, so vk_bindless_grow_test and vk_bindless_dimensions_test silently skip; tools/vk_subgroup_info.py answers {"error": "RuntimeError: vkCreateInstance failed (-9)"}.
  • PR, same environment:
    • full ctest with the three IDs from the doc in VK_LAYER_MESSAGE_ID_FILTER: 132/132, validation active.
    • without the filter: 130/132; the only message is VUID-vkCreateDescriptorSetLayout-support-09582 (3 times), from vk_bindless_grow and vk_null_descriptor, as documented. The two DenormPreserve IDs do not come up in ctest (they belong to the GPU suite's shaders).
    • tools/vk_subgroup_info.py through the loader reports the device (Apple M5 Max, driver_id 14); tests/test_vk_subgroup_info.py OK.
  • Without the loader (plain MoltenVK, default) ctest is 132/132 as on main.

One note that may be worth a line in the doc: DYLD_FALLBACK_LIBRARY_PATH is dropped when the tool is started through a SIP-protected binary (/usr/bin/env, /usr/bin/timeout, ...). The layer's manifest names a bare libVkLayer_khronos_validation.dylib, so the loader then cannot open it and vkCreateInstance fails with -6 (Requested layer "VK_LAYER_KHRONOS_validation" failed to load!). Exporting the variables in the shell and running the tool or ctest directly works.

AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261309345 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2178#issuecomment-7261309345). Originally posted by [lorentsob](https://github.com/lorentsob) on 2026-11-29T19:28:36Z. --- **Verified on Apple M5 Max (MoltenVK 1.4.2, Homebrew vulkan-loader and vulkan-validationlayers 1.4.363, macOS 27.2.1)** - Base: PR head `f0028ad1d` with current `main` `dd87aa405` merged in (clean merge). - Environment as the new `docs/testing.md` text: `LEONIDA_VULKAN_LOADER=$(brew --prefix)/lib/libvulkan.1.dylib`, `VK_DRIVER_FILES=.../MoltenVK_icd.json`, `LEONIDA_VK_VALIDATION=1`, `VK_LAYER_PATH=.../vulkan-validationlayers/share/vulkan/explicit_layer.d`, `DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix)/lib`. - `main`: through the loader every tool finds no device (`Found drivers that contain devices which support the portability subset, but the instance does not enumerate portability drivers!`, then `Found no drivers!`) and exits 77, so `vk_bindless_grow_test` and `vk_bindless_dimensions_test` silently skip; `tools/vk_subgroup_info.py` answers `{"error": "RuntimeError: vkCreateInstance failed (-9)"}`. - PR, same environment: - full `ctest` with the three IDs from the doc in `VK_LAYER_MESSAGE_ID_FILTER`: **132/132**, validation active. - without the filter: 130/132; the only message is `VUID-vkCreateDescriptorSetLayout-support-09582` (3 times), from `vk_bindless_grow` and `vk_null_descriptor`, as documented. The two `DenormPreserve` IDs do not come up in `ctest` (they belong to the GPU suite's shaders). - `tools/vk_subgroup_info.py` through the loader reports the device (`Apple M5 Max`, `driver_id` 14); `tests/test_vk_subgroup_info.py` OK. - Without the loader (plain MoltenVK, default) `ctest` is 132/132 as on `main`. One note that may be worth a line in the doc: `DYLD_FALLBACK_LIBRARY_PATH` is dropped when the tool is started through a SIP-protected binary (`/usr/bin/env`, `/usr/bin/timeout`, ...). The layer's manifest names a bare `libVkLayer_khronos_validation.dylib`, so the loader then cannot open it and `vkCreateInstance` fails with `-6` (`Requested layer "VK_LAYER_KHRONOS_validation" failed to load!`). Exporting the variables in the shell and running the tool or `ctest` directly works. AI-assisted: yes.
aslan2142 commented 2026-12-01 12:24:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:24:03Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311077145 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2178#issuecomment-7311077145). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:24:03Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 17:25:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:25:18Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319271521 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2178#issuecomment-7319271521). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:25:18Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!2178
No description provided.