agc: the driver's idle flush stores another device's pending storage images on its own command buffer (commonparent, lost device) #10791
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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-25T00:54:05Z.
What happens
agc_driver_depth_clear_hlefails at random when ctest runs tests in parallel, withVUID-*-commonparentvalidation errors followed by a lost device:The test runs two devices in one process: its own test device and the driver's. When the driver's device goes idle,
VulkanDevice::StoreIdleResultscallsStorageTexture::FlushAllPending("idle"). That walks the process-wide pending list, which has no device filter, so it also stores the test device's images.StorageTexture::writeBackWindowsthen records each write-back intoRecorder::Active(), the driver's recorder, without checking that the recorder belongs to the image's device. (RecorderForinDepthSurface.cppdoes check this.) The driver's command buffer then copies the test device's buffers and images, and the submission loses the device.Title, test or build step
ctest
agc_driver_depth_clear_hle. In one batch of parallel runs it failed "only with the PR" on 4 unrelated PRs (#6959, #10515, #9551, #9049), and onmainbeside a fifth (#10632). Each time it passed 3 of 3 serial reruns on bothmainand the PR.AnyPS5 commit
mainc8d34aa8f4.System
NVIDIA A800 80GB PCIe, NVIDIA 610.57.04, RHEL 10.2 host, Ubuntu 26.04 container, GCC 15.2, Release. Run with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 APS5_NO_PIPELINE_JOURNAL=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.Steps to reproduce
Run 12 copies of
build/tests/agc_driver_depth_clear_hle_testsat once, a few times over. Serial runs don't show it.Log
commonparentWith the validation layer's break action (
VK_KHRONOS_VALIDATION_DEBUG_ACTION=VK_DBG_LAYER_ACTION_LOG_MSG,VK_DBG_LAYER_ACTION_BREAK) under gdb, the firstcommonparenterror stops on the driver's thread:Another trapped run reached the same flush and, through
writeBackLayers→HostImportFor→ProbeImportWriteProtection, submitted on the test device's queue from the driver's thread while the test thread was using it (UNASSIGNED-Threading-MultipleThreads-WriteonvkQueueSubmit).What was checked
Driver::AttachWindowreplaces the headless device,PrepareForReplacementfirst stores the old device's images (FlushCachedTextures(device), filtered by device). So as far as I can see only processes with two live devices hit this: tests that open their own device next to the driver's. Under parallel ctest those tests fail at random.A fix is on
TechLevelZero/AnyPS5branchfix/storage-idle-flush-own-device:FlushPendingleaves the images of a device whose recorder is not active pending. Their own device stores them when it flushes. One device behaves as before.agc_driver_two_device_pending_store, shows the bug deterministically. Device A leaves an image store pending; device B opens and flushes, and A's results must stay pending and must not reach memory. Then A flushes and the value must arrive.The before/after runs, with the validation layer, are in progress; I'll add the results here. I'll open the branch as a pull request once my first one is merged (open-PR limit).
AI-assisted: yes (Claude Code)