fix(agc): finish an idle store's write-back before returning #16011
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16011"
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 JJenkx on 2026-11-05T09:50:18Z.
What
The idle store (
VulkanDevice::StoreIdleResults→StorageTexture::FlushAllPendingUntil("idle")) records each pending storage image's write-back into the open recorder batch.FlushPendingsynced the recorder after an idle flush only when it published unit shadows (db3af40970). A plain write-back into the host import publishes none, so its copies stayed in the open batch until the store's final submit, and nothing waited for them. The same held for depth and stencil planes, whichFlushDepthPlanesstores inside the idleFlushPendingunder the reason "depth plane store".Nothing ties the idle store to a point the title can observe. A CPU store made after the idle flush returned and before the GPU ran the copy was overwritten with the image's contents.
FlushPendingnow syncs after an idle flush that stored any image or any depth or stencil plane, also when nothing is published. Other flush reasons are unchanged; the access that triggers them orders them.One window remains, recorded in the queue-idle debt entry: a CPU store made while a piece's copies are running is still not ordered against them.
#13863 and #13920 re-indent the same block in
FlushPending. That is a textual conflict only; neither changes this condition.#6926 is related but separate. It orders host writes (
GuestArena::HostWrite: file and APR reads,recv) after the GPU writes pending over their destination. This PR makes the idle store itself complete before it returns, which also covers the title's own CPU stores. Those do not go through a host-write scope.Tested
Current integration and regression qualification — 2026-11-09. Head
71aae52449a184e854753088f04a77cbe16d1c93includes main7259cce11195f360698772da8c0b3af756bf7c8fand preserves the production idle-store fix. The storage fixture now compiles a real image-store shader and drives a retainedVulkanDeviceon the flushing thread. After the idle flush returns it asserts that the active recorder has no pending write for the stored range. It drains pending work before reporting a failure, so the old-source control has safe cleanup.Linux 7.2.14-arch1-1, GCC 16.2.1 Release, AMD Radeon RX 6650 XT / RADV NAVI23, Mesa 26.2.6. With required Vulkan, no shader cache and the confirmed Khronos layer, the strengthened fixture passes 3/3, fails against exact main's
Texture.cppat the outstanding-write assertion, then passes 3/3 after exact restoration. Zero skips or VUIDs; all ten recorded source, module and executable hashes match after restoration. This addresses the later review that the earlier fixtures could pass without the fix; their old observations below retain their original pins and are not reliable negative controls on this refreshed tree. An initial attempt without the validation layer is explicitly excluded from this qualification.Current main automatically registers execution fixtures. The recorded CTest JSON confirms
agc_driver_storage_idle_store_completesis registered; the shared registration suppliesSKIP_RETURN_CODE 77and the Windows runtime PATH setup. No duplicateadd_testwas added. The existing depth-plane case is preserved, but no new negative-control claim is made for that case.Build logs, frozen fixture, main/source control, exact restoration and validation receipts, SHA-256
e3db99d95de12d09ea6dbd5d1345dacd3b0cc58054b68cd5256ca6a65135ff9a(download and all 36 manifest files verified). No new Windows, title, FPS, full-SDK or hosted-CI pass is claimed; current full CI needs a maintainer dispatch.Earlier qualifications retain their stated source/platform scope.
Linux 7.2.11, AMD RX 6650 XT (RADV Mesa 26.2.6), Release. The tests ran on
main1e24993fa3with this commit. The branch is the same commit cherry-picked cleanly onto7ad9749ed0; thereTexture.cppdiffers only by #12813's log gating.Historical tests at the original pins
agc_driver_storage_idle_store_completes: a CPU store made after the idle flush returns must survive the image's write-back.mainit fails 5 of 5 runs: 983,040 of 1,048,576 bytes are overwritten over 8 rounds.agc_driver_depth_plane_cpu_store_after_idle_flush(a new case inDepthPlanePartialStore): the same check for a depth plane.mainit fails: unit 0 holds 0 of its 16,384 CPU-written texels.agc_driver_depth_plane*tests.Full suites with this change
agc_driver*,video_out*,vulkan*): 996 of 996 passed. Rerun on head4ff434e1a4(the follow-up that takes the GPU mutex in the idle wait only for an idle flush): 996 of 996, including both new tests.Windows, RDNA3 (report by @DonRyuzaki): head
4ff434e1a4onmaind23df92b38, Windows 11, RX 7800 XT, WinLibs GCC 15.2, Release, validation layer on.agc_driver_storage_idle_store_completespassed 5 runs andagc_driver_depth_plane_cpu_store_after_idle_flushpassed 3. Their layer reported onlyVUID-VkDeviceCreateInfo-pNext-pNextat device creation, also on amaincontrol. They did not repeat themain-side failure.Cost check on a slow title: Thymesia (PPSA05213) runs at about 6 FPS here. Its frame gaps exceed the 50 ms idle threshold, so idle stores start between frames, which is where this change adds waits. Eight 185 s runs with the same input, alternating in two orders,
main1e24993fa3against the same base with this change, no compiler running. Median FPS after 90 s:main6.47, 5.76, 5.60, 6.38 (mean 6.05); this change 6.29, 5.70, 6.38, 5.62 (mean 6.00). That is -0.9%, inside the spread of either arm, so I measured no cost. All eight runs exit 0. No performance claim either way.Not claimed: no title result or performance change. I found the race while investigating an intermittent ASTRONEER (PPSA27623) load crash (#8746). This change does not stop that crash: 3 of 12 runs crashed with it, against about 4 of 11 on
main.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)