macOS: through the Vulkan loader, the test tools opt in to portability enumeration; validation runs on MoltenVK (TEST-MAC-LOADER-PORTABILITY) #2178
Closed
leonida/mandy
Tauwni wants to merge 0 commits from
fix/mac-loader-portability-enumeration into main
pull from: fix/mac-loader-portability-enumeration
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2178
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mac-loader-portability-enumeration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
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=1isLEONIDA_VULKAN_LOADER, the standard loader. But behind the loader, MoltenVK is a portability driver:VK_KHR_portability_enumerationandVK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;VK_KHR_portability_subset.None of the tools asked for either, so through the loader they found no device:
tools/vk_subgroup_info.pyreturnedvkCreateInstance failed (-9)instead, sorun_gpu_tests.pylost the probes it reads (per_vertex_inputs, among others). In practice, validation couldn't run on MoltenVK.runtime/test/vulkan_loader.h: whenLEONIDA_VULKAN_LOADERis set on macOS,load_vulkan()returns avkGetInstanceProcAddrwrapper. It wrapsvkCreateInstance, adding the extension and its flag where the loader offers them, andvkCreateDevice, addingVK_KHR_portability_subsetwhere the device offers it. Everything else goes to the loader unchanged. Every tool gets this fromload_vulkan(), so no tool changes.tools/vk_subgroup_info.py: the same instance opt-in, plus 2 unit tests.docs/testing.md: how to run with validation on a Mac.Tested
Apple M3, macOS 26.5.1,
mainad41fd517+ this commit, Vulkan loader 1.4.363 and validation layers from Homebrew:run_gpu_tests.py193/268. That's the same failures as direct MoltenVK onmain(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.main).tests/test_vk_subgroup_info.py(57 tests),test_make_game_translator_flags.py,test_make_game_wave64.pyand the docs tests: OK.What validation reports on MoltenVK, now that it can run (the runtime is unchanged;
docs/testing.mdnow lists these and the filter, see the update below):VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296. That is the documentedDenormPreserve 16trade-off (design.md, "Float controls (f16 denormals)"): MoltenVK reportsshaderDenormPreserveFloat16false.vk_bindless_grow,vk_null_descriptor,vk_bindless_test:VUID-vkCreateDescriptorSetLayout-support-09582. The bindless set layout has 11777 descriptors, against MoltenVK'smaxPerSetDescriptorsof 1212, andvkGetDescriptorSetLayoutSupportanswers false for it.size_bindingskeeps 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, thenmainmerged):docs/testing.mdlists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus theVK_LAYER_MESSAGE_ID_FILTERthat hides them:06296andVUID-VkShaderModuleCreateInfo-pCode-08740: theDenormPreserve 16trade-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_testandvk_null_descriptor_testpass under validation. So does the wholerun_gpu_tests.pysuite atmaina73a57e13(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
mainand merges cleanly.🤖 Generated with Claude Code
Red checks: from
main, not this changeThe failing jobs (
check,macos-python,stdlib-tests-linux,linux-gpu-tools,macos,windows) fail the same way onmaind48a957bb(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:maintest_docs_cli_flagstest_make_game_preflight,test_progress_dashboard(repository URL)test_docs_repo_pathsmain, a merge is onTauwni:fix/2552-merge-main, correction)test_tool_stdout_encodingTauwni:fix/stdout-replace-two-new-scripts(no PR, open PR limit)test_windows_boot_journal_seedtest_docs_python_depstest_build_runtime_fallbackvk_bindless_dimensions(macOS)test_docs_env_varstest_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)Tauwni/leonida, no PR (finding)cs_imgatomic_ext(macOS, linux-gpu-tools)vk_xdxr_postbuild_readback(Windows)main: mergemainNot checked by a second agent or human yet.
Update at
de37175f5, docs only:docs/testing.mdnow lists the three validation messages MoltenVK 1.4.2 reports that are not test failures, plus theVK_LAYER_MESSAGE_ID_FILTERthat hides them.VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296andVUID-VkShaderModuleCreateInfo-pCode-08740: the documentedDenormPreserve 16trade-off.VUID-vkCreateDescriptorSetLayout-support-09582: in MoltenVK 1.4.2's source,vkGetDescriptorSetLayoutSupportjust compares the set's descriptor count withmaxPerSetDescriptors. MoltenVK computes that limit ingetMaxPerSetDescriptorCount()asmax(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=1through the loader:vk_bindless_test(ps_tex): 15 draws read back, 0 bad pixels, 0 validation errors.vk_bindless_grow_testandvk_null_descriptor_test:ok, 0 validation errors.AI-assisted (Claude Code).
I ran the whole GPU suite under validation, using this branch merged onto
maina73a57e13(Apple M3, macOS 26.5.1, MoltenVK 1.4.2 through the loader). Settings:LEONIDA_VK_VALIDATION=1with theVK_LAYER_MESSAGE_ID_FILTERfromdocs/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) andps_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 thanks for the thorough review and the negative controls. Both nits are in
2663850d3:create_instanceandcreate_devicenow copyppEnabledExtensionNamesonly whenenabledExtensionCountis 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.pygives 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_testunderLEONIDA_VK_VALIDATION=1with 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).
Verified on Apple M5 Max (MoltenVK 1.4.2, Homebrew vulkan-loader and vulkan-validationlayers 1.4.363, macOS 27.2.1)
f0028ad1dwith currentmaindd87aa405merged in (clean merge).docs/testing.mdtext: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!, thenFound no drivers!) and exits 77, sovk_bindless_grow_testandvk_bindless_dimensions_testsilently skip;tools/vk_subgroup_info.pyanswers{"error": "RuntimeError: vkCreateInstance failed (-9)"}.ctestwith the three IDs from the doc inVK_LAYER_MESSAGE_ID_FILTER: 132/132, validation active.VUID-vkCreateDescriptorSetLayout-support-09582(3 times), fromvk_bindless_growandvk_null_descriptor, as documented. The twoDenormPreserveIDs do not come up inctest(they belong to the GPU suite's shaders).tools/vk_subgroup_info.pythrough the loader reports the device (Apple M5 Max,driver_id14);tests/test_vk_subgroup_info.pyOK.ctestis 132/132 as onmain.One note that may be worth a line in the doc:
DYLD_FALLBACK_LIBRARY_PATHis dropped when the tool is started through a SIP-protected binary (/usr/bin/env,/usr/bin/timeout, ...). The layer's manifest names a barelibVkLayer_khronos_validation.dylib, so the loader then cannot open it andvkCreateInstancefails with-6(Requested layer "VK_LAYER_KHRONOS_validation" failed to load!). Exporting the variables in the shell and running the tool orctestdirectly works.AI-assisted: yes.
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.)
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.