One game's opening cutscene sometimes stops the GPU on macOS, and the device is lost. The screen stays
black with the loading flower, and Metal reports VK_TIMEOUT ... Caused GPU Hang Error, or
VK_ERROR_OUT_OF_DEVICE_MEMORY. The gpuEvent report that macOS writes for the process gives the mechanism:
restart_reason_desc is firmware-detected lockup, and guilty_dm is 2 or 3. It is not a page fault, and it is not
a shader that fails to compile.
The route from a fresh save repeats it: L+R at the title, A at Select a User, A for one player, A on the character,
then A to start. The game reads OpeningDemo_* and Env_Grassland.bwav, uploads about 80 MB of texture, and the
first frame of the cutscene follows. The fault depends on timing, so a rate needs many runs:
| build (M5, macOS 27.2, MoltenVK 1.4.1, headless, 45 s, same route) | runs that lost the device |
|---|---|
main | 6 of 12 |
| a set of 16 textures a stage | 1 of 8 |
| that, and compute's set too | 2 of 8 |
| a descriptor set for each shader, graphics and compute | 1 of 2 |
the same, with MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=0 | 7 of 8 |
| KosmicKrisp (Mesa 26.2.6) | 0 of 4 |
The frames render correctly in every build above: no draw was skipped, and the screenshot shows the cutscene. The smaller sets only change the timing.
What these measurements rule out:
compute=0 still lost the device (4 of 8).vk_record=0 still lost it (#820).The evidence points at the order between draws, but no barrier test has removed the fault yet. #820 gives the likely
place: the renderer's barriers name the Surf a descriptor came from, and a later draw can read or write the same
image through a crop, another view or a guest alias, which is a different Metal resource than the one the barrier
named. Metal then runs the two together. The missing order is not yet found.
vulkan_driver=auto runs the same route on Mesa's KosmicKrisp where the Mac has it, and vulkan_driver=kosmickrisp
asks for it: its Vulkan side has none of these limits, so it is the driver to compare against while this is open.
A device loss from the recording thread also used to hang the process: submit_run called fatal(), and the window
release waits for the recording thread in vk_rec_sync, so the thread waited for itself and the process spun at full
speed instead of showing the error. vk_rec_sync now returns on the recording thread
(src/nx/gpu/vk/record.c).
Made from docs/hosts/apple.md at 69237645142c. GPL-3.0-or-later.