fix(agc): hold the settle and sparse queues across vkDeviceWaitIdle #18828
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18828"
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 DealPotato on 2026-11-12T11:49:08Z.
What
vkDeviceWaitIdlerequires host access to every queue of the device to be externally synchronized.VulkanDevice::WaitIdleheld only the present queue's mutex. Guest threads that import mapped memory submit their settle copy to the settle queue undersettleQueueMutex, without the GPU mutex (settleImport), and sparse binds run undersparseQueueMutex; either could run during the device-wide wait.WaitIdlenow holds those two mutexes as well, after the present queue's.On WWE 2K26 (PPSA34299) the device was lost during boot and loading with an NVIDIA DMA page fault: Nsight Aftermath reports
Error_DMA_PageFaultwith "an internal command processing error", all GPU units idle, andVK_EXT_device_faultreports "write invalid at 0x0"; the log shows a settle submit failing withVK_ERROR_DEVICE_LOSTat that moment. All crashes had the same Aftermath fingerprint. Runs that drain the device on every CPU buffer fill (aWaitIdleper fill) lost it in three runs out of three; with this change neither of two runs did, one of them draining on every fill. That is few runs for an intermittent fault, so the test below is the actual evidence for the rule.Tested
Windows 11 Pro (build 26300), NVIDIA GeForce RTX 4070, driver 610.88. Focused tests run with
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -Vonmain(3b7f31fa70) and on this change, from one build directory; the loader inserted the validation layer in both runs.Passed on
mainand on the change:agc_driver_host_import_at_map,agc_driver_host_import_proofs,agc_driver_guest_memory_lifetime,agc_driver_fill_completion_labels. Neither log has aVUID-message.The new
agc_driver_wait_idle_queue_locksholds the settle queue's mutex (and the sparse queue's, when the device has one) on the test thread and checks thatWaitIdleon another thread does not return until it is released. It fails onmainwith "vkDeviceWaitIdle ran while another thread held the settle queue" and passes on the change.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-11-14T09:16:54Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation serializes
vkDeviceWaitIdlewith the present, settle, and sparse queue mutexes, and the reported focused tests cover the new behavior.What I ran
Reviewed head
42b8a29cfd72c15e46cfdbc3b185751a8ae188cbusingrepo_read.pyfor the prepared diff and pinned repository source. No tests were run in this review; test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full source of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas read only aroundWaitIdle; its other contents were excluded as too large. The new test source was supplied in full and read. No local tests or hardware checks were run. The runtime results and validation-layer logs in the description were not independently confirmed.To get this to a good state
Nothing is required.