Repository navigation
test(agc): load the Vulkan loader with portability enumeration on macOS - #7886
Conversation
Nine AGC test fixtures create their own Vulkan instance. On macOS they asked for libvulkan.so.1 and created the instance without VK_KHR_portability_enumeration, so the loader was not found (and with it, MoltenVK would not be listed). Each test then printed "skipped, no usable Vulkan device" and ctest counted it as passed. They now load libvulkan.1.dylib on macOS and create the instance with VK_KHR_portability_enumeration and VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR. Other hosts are unchanged.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Jotitadev identified nine fixtures that silently skipped MoltenVK because they loaded the Linux Vulkan soname or omitted portability enumeration. Preserve the authored change in this branch so the tests exercise Apple GPUs and expose actual host limitations.
agc_driver_pooled_buffer_range used to skip on macOS for want of a device; since the fixture enumerates MoltenVK through the portability loader (boykopovar#7886) it runs, and it fails its robust read past the end of a pooled buffer: MoltenVK bounds the read by the Metal buffer that holds the pooled block, not by the VkBuffer range, so it returns what an earlier user of the block left there. The behaviour and the unmeasured cost of clearing a reused block's slack are recorded until a fix is weighed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Apple M4 data point for head Setup: Apple M4 (10-core GPU), macOS 27.0.1, Apple clang 21, x86-64 under Rosetta 2. MoltenVK 1.4.2 and the loader from the Vulkan SDK 1.4.363.0, through Without this commit (same tree, full With it,
Validation: no Not tested: Linux or Windows; an exact-head build on current AI-assisted: yes |
|
Thanks. I tried enabling Written with AI assistance (Claude Code). I ran the builds and tests above on my machine. |
Tested at
|
| passed | |
|---|---|
| Without this PR | 5 of 16: the 11 tests whose own instance this PR changes fail with cannot load Vulkan |
| With this PR | 13 of 16 |
The three that still fail with this PR run into other gaps:
agc_performance_overlayandagc_performance_overlay_statistics:the process's private memory cannot be read, which fix(agc): read the process's private memory from task_info on macOS #9971 addresses.agc_driver_pooled_buffer_range:a robust read of word 28 of a 100-byte pooled buffer returned 0xabababab, the bytes a 256-byte earlier user left in its memory, a MoltenVK robust-access difference.
Validation: the layer loaded (no was not found but was requested line). The run logs 10 VUID-VkDeviceCreateInfo-pProperties-04451 (devices created without VK_KHR_portability_subset) and 1 VUID-VkImageViewCreateInfo-imageViewFormatSwizzle-04465 from agc_driver_native_multisample_depth, which only runs with this PR.
Two more test files on current main load only libvulkan.so.1 and so fail on macOS with cannot load Vulkan: tests/GuestMemoryLifetimeSupport.hpp (the six agc_driver_guest_memory_lifetime* tests) and tests/execution/IndirectArgumentsPendingProducer.cpp. They use the driver's device, so they need only the loader name, not the instance flag. With that added here, those seven tests pass.
AI-assisted: yes (Claude Code applied the PR, ran the tests both ways and wrote this report).
|
Checked that the nine fixture changes are identical and confined to |
ReadProcessPrivateBytes reads RssAnon and VmSwap from /proc/self/status on every host other than Windows. macOS has no /proc, so the overlay's RAM line stays empty and agc_performance_overlay_statistics fails with "the process's private memory cannot be read". On macOS it now returns the task's phys_footprint from task_info(TASK_VM_INFO): its resident and compressed private memory, which is what Activity Monitor shows. jotitadev measured that this makes the test pass on macOS (#7886). The same change is part of the macOS port in #8658. Co-Authored-By: iamthehimansh <67262056+iamthehimansh@users.noreply.github.com> Co-Authored-By: jotitadev <139649225+jotitadev@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r more fixtures on macOS BdaDevice, Recorder, OversizedDescriptorSets and SampledCacheBudget open their own Vulkan instance but load only libvulkan.so.1 outside Windows and create it without portability enumeration, so on macOS they cannot load Vulkan and skip, or fail under ANYPS5_REQUIRE_VULKAN=1. They now load libvulkan.1.dylib and enumerate portability drivers on macOS, as the nine fixtures boykopovar#7886 changed already do. Co-authored-by: mugurc <20699965+mugurc@users.noreply.github.com> Co-authored-by: jermainee <34961982+jermainee@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r more fixtures on macOS BdaDevice, Recorder, OversizedDescriptorSets and SampledCacheBudget open their own Vulkan instance but load only libvulkan.so.1 outside Windows and create it without portability enumeration, so on macOS they cannot load Vulkan and skip, or fail under ANYPS5_REQUIRE_VULKAN=1. They now load libvulkan.1.dylib and enumerate portability drivers on macOS, as the nine fixtures boykopovar#7886 changed already do. Co-authored-by: mugurc <20699965+mugurc@users.noreply.github.com> Co-authored-by: jermainee <34961982+jermainee@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Nine AGC test fixtures create their own Vulkan instance instead of going through
VulkanDevice:PresentationPass.cpp,PerformanceOverlay.cppand, undertests/execution/,DepthPlaneGuestLayers.cpp,DepthStorage.cpp,DepthSurfaceLastWriter.cpp,NativeMultisampleDepth.cpp,PartiallyResidentSnapshot.cpp,PooledBufferRange.cppandSparseBufferHoles.cpp. On macOS they loadlibvulkan.so.1, which doesn't exist there, so they printskipped, no usable Vulkan device: AGC graphics: cannot load Vulkanand ctest counts them as skipped. Alibvulkan.so.1symlink isn't enough: withoutVK_KHR_portability_enumerationthe loader doesn't list MoltenVK andvkCreateInstancereturns -9 (VK_ERROR_INCOMPATIBLE_DRIVER).On
__APPLE__they now loadlibvulkan.1.dyliband create the instance withVK_KHR_portability_enumerationandVK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR. This is the same change mugurc's macOS series makes toBdaDevice.cpp,Recorder.cpp,OversizedDescriptorSets.cppandSampledCacheBudget.cpp(#1, branchci/macos-series-2, commit 20ee39d). These nine fixtures aren't covered there, and the current head of #7332 doesn't cover them either. Windows and Linux are unchanged.I noticed this while validating #6557: its new test case in
NativeMultisampleDepth.cppnever ran on macOS.Tested
Apple M2 Max, macOS 27.2, x86-64 build under Rosetta 2, Xcode 27.
maindoesn't build on macOS yet, so the tree ismaina373e85 + mugurc'sci/macos-series-291e4ecc + #6667, #6668, #7524 and #6969, + two files of #7332 (DirectMemory/Jit.cpp,tests/GuestMemoryLifetimeSupport.hpp), with this commit's diff applied cleanly on top. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), and MoltenVK main + SPIRV-Cross #2704. Run with-j1 --timeout 30.11 ctest entries use these fixtures. Before this change all 11 were skipped. With it:
agc_driver_presentation_passagc_performance_overlay_device_selectionagc_driver_depth_plane_guest_layersagc_driver_depth_storageagc_driver_depth_surface_last_writeragc_driver_native_multisample_depthagc_driver_partially_resident_snapshotagc_driver_partially_resident_pending_storesagc_driver_sparse_buffer_holesagc_performance_overlaythe process's private memory cannot be readagc_driver_pooled_buffer_rangea robust read of word 28 of a 100-byte pooled buffer returned 0xabababab, the bytes a 256-byte earlier user left in its memoryResults are the same on both drivers, and 3 of 3 with
--repeat until-fail:3on MoltenVK 1.4.2.The two failures were already there; the tests just weren't running:
agc_performance_overlayfails the same wayagc_performance_overlay_statisticsalready fails on macOS.ReadProcessPrivateBytesreads/proc/self/statuson every host that isn't Windows. Locally, readingtask_info(TASK_VM_INFO).phys_footprinton macOS made it pass. feat: macOS on Apple Silicon host support (Rosetta 2 and MoltenVK) #7332 already has that fix, so it is left out of this PR.agc_driver_pooled_buffer_range: MoltenVK reportsrobustBufferAccess, but the read past the end of a 100-byte buffer still returns bytes from the pooled memory behind it. So the test catches the stale data on Apple. This is MoltenVK behaviour and isn't changed here.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code