test(agc): spawn the lazy resolved ABI reference child without a shell #10650
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10650"
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?
Imported from boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-24T15:14:12Z.
What
core/libs/prx/libSceAgcDriver/tests/execution/LazyResolvedAbi.cppstarts its--eager-referencechild withstd::system, which runs the command through/bin/sh -c. On macOS/bin/shis a SIP-protected platform binary, so dyld removes everyDYLD_*variable when it starts it. The child then losesDYLD_FALLBACK_LIBRARY_PATH, which is how the tests find the LunarG SDK'slibvulkan.1.dylib(theDYLD_LIBRARY_PATHsetup from #1 is stripped the same way). It fails withVulkan loader: Failed loading libvulkan.1.dylib. WithoutANYPS5_REQUIRE_VULKANthe child skips with "no usable Vulkan device" (exit 77,VulkanTestDevice.hpp:25-26,LazyResolvedAbi.cpp:681); with it,OpenVulkanTestDevicerethrows (VulkanTestDevice.hpp:24) and the child'smainreturns 1 (LazyResolvedAbi.cpp:723). Either way the parent stops withlazy resolved ABI: the eager reference process failed. This makesagc_driver_lazy_resolved_abiandagc_driver_lazy_resolved_abi_switch_setfail on every macOS setup that points dyld at the Vulkan loader through aDYLD_*variable; a loader installed on dyld's default search path (for example/usr/local/lib) is unaffected.On hosts other than Windows, the child now starts with
posix_spawnp(argv[0], {argv[0], "--eager-reference"}, environ)andwaitpid. That passes the parent's environment on unchanged without going through a shell, the same waycore/relinker/relinker/tests/RelinkerProcess.hppalready usesposix_spawn(..., environ). The test still requires exit status 0. Following oneandonlydean's review, the wait (WaitExit) retrieswaitpidwhile it fails withEINTR, so the test never fails, and its cleanup never deletes the reference and cache paths, while the child is still running. A nonzero exit, a signalled exit and a failed spawn still count as failures. A self-check (CheckWaitExit), run before the eager child starts, covers exit 0, exit 3, a child killed bySIGKILL, a failed spawn, and one interrupted wait. In that last case the forked child blocks on a pipe until aSIGALRMhandler, installed withoutSA_RESTARTand aimed at the waiting thread withpthread_kill, writes to it, so the child cannot exit before the signal arrives. Windows keepsstd::system. The change is limited to this test. The other self-spawning tests that usestd::system(ShaderDiskCache.cpp,AsyncLog.cpp) are left alone because their children pass without loading Vulkan.Prior art: commit
5546b23a3ein #8658 by @iamthehimansh (2026-10-23, closed) found the same cause in this test. It fixes it differently: it keepsstd::systemand, on macOS only, addsDYLD_LIBRARY_PATH="..."to the front of the shell command, so it passes on only that one variable (notDYLD_FALLBACK_LIBRARY_PATH). The fix was never split out of #8658, and neither #10362 nor #10419 carries it. #7201 and #7332 do not change this test.Tested
Apple M1 Pro, macOS 27.0.1, x86_64 build under Rosetta 2, Vulkan through MoltenVK from the LunarG Vulkan SDK 1.4.363.
mainalone does not build on macOS, so I built in a tree made of mugurc's macOS series (ci/macos-series-2,27e968974) merged withmainat522e32e3b6, plus these local changes, all identical in both runs: the macOS build parts of #10419, #10540, #10562, #10641, #10642, and two of my unopened fixes (the image table reuse chain-pool check, and anOpMemoryBarrierbefore 32-bit image atomics inSpirvImageEmitter.cpp). Only this PR's change was toggled. Both runs usedANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R '^agc_driver_lazy_resolved_abi' -E 'audio_in|voice' -V.DYLD_FALLBACK_LIBRARY_PATHexported,sh -c 'echo $DYLD_FALLBACK_LIBRARY_PATH'prints an empty line. A small C probe shows thatposix_spawnpasses the variable to the child andsystem()drops it. A wrapper that exports the variable again inside the child makes the unchanged test pass.libvulkan.1.dylib, and the parent stops withthe eager reference process failed.6 shaders drew, 5 of them ABI-resolved; ... the lazy run wrote none of the 43 shader cache files eager wrote again.was not found but was requested by env var VK_INSTANCE_LAYERS. The run without the change has 0Validation Errorlines. The run with it has 4, allVUID-VkImageViewCreateInfo-imageViewFormatReinterpretation-04466(vkCreateImageView, portability subset,imageViewFormatReinterpretationisVK_FALSEon MoltenVK). Each test logs one in the eager child's draw phase and one in the parent's lazy draw phase. Without the change, neither phase runs: the child fails while loading Vulkan, and the parent stops at the check of the child's exit status. So these errors come from image view code that this test never reached before, and this change touches no device or image code.EINTRfollow-up (1e4cc24bb5), on mugurc's macOS series (ci/macos-series-2,27e968974) merged withmainat2742004ed2, same command, 3 runs each with the previous head569e4d36daand with this head: both tests pass 2/2 in all six runs, including the new self-check. Every run has the same 4VUID-VkImageViewCreateInfo-imageViewFormatReinterpretation-04466errors and no layer-not-found line. Not checked: whether the 50 ms signal can land before the main thread reacheswaitpid. The check then still passes, but without exercising the retry.Not tested on Linux or Windows. Windows keeps the same code path, and on Linux
posix_spawnpwithenvirongives the child the same environmentstd::systemdid.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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T15:20:37Z.
Review: APPROVED
Reviewed exact head
569e4d36da693f0ce8b949cb2c3e6df4e640f868. On POSIX, the test now launches itself directly withposix_spawnpand passes the currentenviron, avoiding the shell that stripsDYLD_*variables under SIP; it waits for the child and requires a normal zero exit. Windows retains its priorstd::systempath. Exact-head diff-check, conventions, and merge-tree checks pass; hosted eligibility, conventions, intake, labels, and report pass, while product builds are skipped. I did not run the macOS GPU test locally; the validation results are the author’s controlled two-run report. No blocking issue found.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T16:21:51Z.
Review: APPROVED
Reviewed the complete diff at
569e4d36da. On non-Windows, posix_spawnp launches the same executable directly with the existing environment and waitpid propagates the child exit code; Windows retains its existing path. This matches the repository’s existing POSIX spawn helper. The macOS cause and red/green results in the PR body are detailed and consistent with the change. Local verification: git diff --check, check_conventions.py, and the current-main merge tree pass. I could not run the macOS Vulkan test locally; hosted eligibility, conventions, intake, labels, and report checks pass, while product builds are skipped by policy. The author reports four MoltenVK image-view VUIDs in the newly reached draw phases; those lines concern untouched image-view code and should be tracked separately if no existing issue covers them. The limitation is disclosed in the PR body.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T06:33:10Z.
Review: COMMENTED
Apple run on a
main-based tree, with both MoltenVK builds. The other runs here are Windows.Machine: Apple M2 Max, macOS 27.2, x86_64 Release build under Rosetta 2.
Tree:
mainb986c11a34+ the open macOS PRs needed to build and open a device (#10366, #7631, #10659, #10660, #11249, #11358, #10669, #10552, #7804, #10676, #11447, #11437, #11554, #11705) + this PR at1e4cc24bb5(clean merge). Control: the same tree without this PR. The loader is found throughDYLD_LIBRARY_PATH.ANYPS5_NO_SHADER_CACHE=1,-j1 --timeout 30.Drivers: MoltenVK 1.4.2 (LunarG SDK 1.4.363.0) and MoltenVK
main+ SPIRV-Cross #2704.agc_driver_lazy_resolved_abiandagc_driver_lazy_resolved_abi_switch_setfail on both drivers with "the eager reference process failed". The child's own output is "skipped, no usable Vulkan device: Vulkan loader: Failed loading libvulkan.1.dylib", and its dlopen search list has noDYLD_LIBRARY_PATHentry, which matches the cause in the description.^agcsuite, 1037 tests, MoltenVK 1.4.2: 41 failures without, 39 with. Those two are the only difference, so nothing new fails.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1, SDK 1.4.363.0): both pass, the loader output shows the layer inserted in the parent and in the spawned child, and there is noVUID-line. Without this PR the child never gets that far.GPUs tested: Apple M2 Max (MoltenVK 1.4.2 and MoltenVK main + #2704)
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T23:01:41Z.
Review: COMMENTED
Tested on macOS 27.2 / Apple M4 with MoltenVK 1.4.2 (LunarG Vulkan SDK 1.4.363.1, validation layer 1.4.363), x86-64 build under Rosetta. This is the only GPU I tested.
Head
1e4cc24bb5merged alone onto main3b17977ba6, compared with3b17977ba6itself. I ran the 29 AGC tests that fail on main on this Mac, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer, throughctest --test-dir build -R <those 29> -V, three runs per side. Every Vulkan test loggedInsert instance layer "VK_LAYER_KHRONOS_validation"and none loggedwas not found but was requested by env var VK_INSTANCE_LAYERS.agc_driver_lazy_resolved_abiagc_driver_lazy_resolved_abi_switch_setThe other 26 tests gave the same result on both sides.
agc_driver_label_after_import_copyis flaky on main as well: main Failed, Passed, Passed, this PR Passed, Failed, Passed. Every failure on either side is the same timing check ("round N: a CPU read after the label that followed the copy found K of 262144 destination bytes not yet copied"), and it varied the same way across the other PRs I tested in the same session, so I don't attribute it to this change.VUID-lines: identical per test on both sides (30 on main, 30 with this PR, over the three runs). TheVUID-lines on both sides are main's existingVUID-VkDeviceCreateInfo-sType-unique(a duplicatedVkPhysicalDevicePortabilitySubsetFeaturesKHRin the device pNext chain) andVUID-VkSamplerCreateInfo-samplerMipLodBias-04467; this PR adds none.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:29:57Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the findings below are optional.
What I ran
Reviewed head
1e4cc24bb5312df27b423369b14ccaed8a832852. Read the prepared description, commits, manifest and diff, then the complete changed source file and targeted search results throughrepo_read.py. No commands or tests were run by me; reported macOS runs are author-supplied.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Linux and Windows behavior, build compatibility, and physical-console behavior were not verified.
review/files.jsonwas not provided as a readable review document; the manifest and file listing show one changed file, and that full source was read. macOS test results and the signal timing limitation are from the author’s description, not independently verified.To get this to a good state
Nothing is required.
Pull request closed