fix(agc): keep a device's idle stores and storage write-backs on its own recorder #10940
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10940"
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 TechLevelZero on 2026-10-25T11:09:15Z.
What
With two live devices in a process, the driver's idle store recorded the other device's storage images on its own command buffer, as #10791 describes. The validation layer reports this as
commonparentandUNASSIGNED-Threadingerrors, and the submission loses the device.agc_driver_depth_clear_hlefails this way at random under parallel ctest. Two things combine:VulkanDevice::StoreIdleResults(and the label and flip stores) calledStorageTexture::FlushAllPending, which takes every device's pending images.Recorder::Active(), which is one per process.Recorder::Activateswitches it without the GPU mutex, so it can be either device's at any moment.What changes:
FlushPendingandFlushAllPendingtake an optional device.VulkanDevice's idle, label and flip stores pass their own, so they take only their own images. Without a device, as in the memory-access flushes, every image is still taken.writeBackWindows,writeBackLayersandcommitStoredSaveuse the active recorder only when it is the image's device's (recorderFor). Otherwise they take their existing no-recorder path, which submits on the image's own device.awaitStoredSavethen uses the image's own recorder, which is the one that committed.PrepareForReplacement,FlushCachedTextures).Recorder::Active()still don't check the device.Fixes #10791.
Overlap:
tools/pr_overlap.pylists #9685, #9879 and #10656, which change the label store's line inVulkanDevice.cpp(FlushAllPending("label")). It also lists #9521 for theFlushAllPendingdefinition inTexture.cpp, and #6926 for the debt file line this entry goes next to. Whichever merges second needs a one-line rebase. #9521 also adds twoFlushAllPending("idle")calls, which should pass their device too if both are merged.Tested
Measured on
mainc8d34aa8f4with GCC 15 in Ubuntu 26.04 containers. The branch is now rebased ontomainb91a6a60c5without conflicts; the same comparisons are running again on the three GPUs below, and I will add the results here.agc_driver_two_device_pending_store(new):StoreIdleResults. A's results must stay pending and must not reach memory.On unmodified
mainthe test loses the device in step 2 (vkWaitForFences recorder: Vulkan result -4). With this change it passes on the three GPUs below.agc_driver_depth_clear_hleon the A800: 240 runs, 12 at a time, alternatingmainand this branch, validation layer on.mainfailed 39 of 120 (35 withcommonparentandUNASSIGNED-Threadingerrors); this branch failed 0 of 120. The first two versions of this change, which filtered by the active recorder in one place, still failed (18 of 120, then 16 of 120). gdb backtraces from those runs found the remaining lookups.On each GPU, the 1,305 tests
tools/select_tests.pyselects for this change ran onmainand on the branch withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandctest -V. The validation layer loaded on every run. No test fails only on the branch, and the onlyVUID-message on either side isVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, whichmainalready logs (#6782).pr_overlap_encodingfails on both sides.agc_submit_progress_no_timelinefailed once onmain.pr_overlap_encoding,conventions_git_errorsandtest_script_registrationneedgit, which that container lacks.agc_driver_guest_memory_lifetime_directneeds/dev/udmabuf, which that container has no access to.python3 tools/check_conventions.py --base origin/main: all checks pass.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-25T11:23:55Z.
Review: APPROVED
Reviewed exact head
01f2e70. Pending flushes are filtered by the owning VkDevice for device idle/label/flip stores, and write-back recording falls back to the texture's own device when the global active recorder belongs elsewhere. The regression uses two devices to verify that the second device's idle store neither consumes nor publishes the first device's pending image, then checks that a later memory-access flush publishes it. Local conventions and diff checks passed; the author reports multi-GPU validation and full selected test comparisons. I did not rerun Vulkan hardware tests locally.