fix(agc): wake a dormant queue 0 when queued commits finish so the idle store sees their results #20132
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20132"
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 moong15 on 2026-11-14T17:27:50Z.
What
With
APS5_PIPELINE_DISPATCH=1andAPS5_PIPELINE_DISPATCH_MISSES=1, queue 0 can go dormant while dispatch items are still queued on the draw committer. When the committer then records them, their storage results become pending, but nothing wakes queue 0. The idle store never runs for those results, so they never reach guest memory.The committer now wakes queue 0 when its queue empties. If queue 0 is dormant, it bumps
idleEpochand notifies, and queue 0 re-checks for idle results (Driver::WakeDormantQueue0, called fromDrawPipeline::runoutside the pipeline mutex). The dormant check runs under the driver mutex. Queue 0 holds that mutex from its last pending-results check until it waits, so a commit that empties the queue between the two cannot be missed. Queue 0 never blocks on the committer.agc_driver_store_idle_results_pipelined_dispatchandagc_driver_idle_store_over_unmap_pipelined_dispatchrun the two existing idle-store tests with both switches on.Related, separate path: #20015 ends the idle store's quiet period early for a completion the draw pipeline adds. This PR wakes a queue 0 that is already dormant when queued commits finish.
Tested
Windows 11 (10.0.26300), AMD Radeon RX 9070 XT, driver 32.0.32015.7029, Vulkan 1.4.359. Base
main2bc1db7ca8(main's later commits do not touchlibSceAgcDriver; rebased ontofbd7f5557e). Every run usedANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layerwith Khronos validation layer 1.4.335 andctest -j1. Each log showsInsert instance layer "VK_LAYER_KHRONOS_validation", none showswas not found but was requested by env var VK_INSTANCE_LAYERS, and none containsVUID-.Reproduction, 3 runs each:
agc_driver_store_idle_resultsagc_driver_idle_store_over_unmapAPS5_PIPELINE_DISPATCH=1 APS5_PIPELINE_DISPATCH_MISSES=1_pipelined_dispatchvariantsFocused set, 3 runs each,
ctest --test-dir build -R <pattern> -V:store_idle_results,_wake,_disabled,_pipelined_dispatch,idle_store_over_unmap,_pipelined_dispatch,idle_store_yields,storage_read_during_idle_store,two_device_pending_store,pipelined_dispatch_item,pipelined_dispatch_misses. This PR passed 11 of 11; main passed the 9 that exist there. NoVUID-on either.Full
agcset on this PR: 1746 of 1757 passed. The 11 failures (f16_conversion_float_mode,float16_misc,float16_modifiers,float16_rounding,fp16_overflow,ldexp_f16_inline_constants,pixel_helper_waterfall,sdwa_ldexp_f16,vop2_modifier_forms,sample_order_grid_reference, andupload_cache_read_only_flush, which does not compile on MinGW because ofsetenv) fail the same way on main on this machine. NoVUID-in either log.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
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T04:34:19Z.
Review: APPROVED
Reviewed — looks good
Nothing in the reviewed change blocks merging, and the inspected synchronization flow and added test registrations support the stated fix.
What I ran
Reviewed head
92a7f9574a60f5e2071bf457bc03da63235ce6d3usingrepo_read.pyto read the prepared review bundle and targeted source context. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The commit-pinned diff adds a queue 0 wake after its pipeline becomes empty, with the wake outside the pipeline mutex. The dormant wait and the new wake both synchronize through the driver mutex; changing
idleEpochcauses queue 0 to recheck idle results. The tests register both idle-store scenarios with pipeline dispatch switches enabled.Not verified
No build, test, or negative control was run for this review. The Windows/Vulkan test results in the PR description are author-reported. Read:
Driver.hpp,DrawPipeline.cpp,QueueWorker.cpp, both changed CMake test files, and the prepareddescription.md,commits.md,manifest.json, anddiff.patch. Excluded: none of the changed files;files.jsonwas unavailable in the prepared review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T06:41:48Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the implementation and focused test registrations support the stated queue wake behavior.
What I ran
9ccd796f5d2a54f7e4d039135b2f0a5552c56058, including the queue worker’s idle wait logic.repo_read.pysearch and range reads to inspect the dormant flag, idle epoch, and test registrations. No tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
ctestresults in the description were not independently verified.manifest.json:Driver.hpp,DrawPipeline.cpp,QueueWorker.cpp, and both changed CMake test files.files.jsonexclusions were not inspected.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:07:42Z.
Review: APPROVED
I read the diff at
9ccd796f5d. Windows 11, GCC 15.2, merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_store_idle_results(with_wake,_disabledand_pipelined_dispatch) and the otheragc_driver_idle_storetests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.agc_driver_store_idle_results_pipelined_dispatchfails: "the queue-idle store did not bring the result to guest memory without a direct flush or further submission".agc_driver_idle_store_over_unmapand its_pipelined_dispatchform skip themselves on both GPUs.Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:24:01Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. The final queue-0 commit now notifies the dormant worker after releasing the pipeline mutex, avoiding a direct mutex-order inversion with the new wake call. The pipelined-dispatch CTests should exercise the case where a final commit makes idle storage eligible without another submission. Please preserve those cases when integrating the pending-image work. Paired lavapipe validation is pending.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.