fix(agc): let periodic cache saves drain speculative compute work #28234
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28234"
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 EEkebin on 2026-11-29T10:48:05Z.
What
A periodic native pipeline cache save can miss every snapshot while compute pipeline builders overlap. The retry in #28002 keeps trying to take the snapshot. This change lets the saver get a turn between speculative compute prebuilds and compute journal replay jobs.
After two busy snapshots and one second of completed native compute creation in aggregate, new background jobs wait for a bounded checkpoint. Jobs recheck admission after waiting for compile memory and release their reservation if a checkpoint opened. Foreground creation can still take the cache use lock. An outstanding foreground request that needs the prebuild pool keeps workers admitted until that request is settled or abandoned.
The branch includes the original #28002 commit as a prerequisite on main at
55106ef002. #28121 changes memory handling during the same save, and would require reconciliation in the snapshot and test code if merged first. #28220 changes when speculative dispatch prebuilds are submitted. The checkpoint applies at admission.Tested
Release build on Windows 11 with GCC 15.2. All 15 focused CTest cases passed, including the seven new synthetic overlap cases, existing allocation and read-retry cases, the compute prebuild pool test, and the Vulkan cache-file round trip.
55106ef002The short-create regression checks that 24 reported 40 ms completions stay below the threshold and that the 25th opens a checkpoint. Another case keeps a worker queued for memory beyond the one-second rearm interval. An additional local run used the production prebuild pool with two threads and one compute slot. The pending foreground job ran before the overlapping creator released the cache.
Ran
agc_pipeline_cache_fileon main and the branch with Vulkan required, the shader cache disabled, and Khronos validation enabled. The loader inserted the validation layer in both runs and both logs had zeroVUID-errors. The scheduling fixture uses a synthetic cache driver.tools/check_conventions.pypassed.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T10:56:27Z.
Review: COMMENTED
b9e75b6f-17ea-4f86-9230-25f636f3fa2dReviewing files that changed from the base of the PR and between
55106ef002anda60a0482b3.core/libs/prx/libSceAgcDriver/Execution/include/ComputePrebuildBudget.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/PipelineCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineCache.cppcore/libs/prx/libSceAgcDriver/tests/PipelineCacheFailures.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_pipeline_cache_allocation_tests.cmakeIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T11:07:00Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change based on the inspected code; the author-reported focused tests and build were not run in this review.
What I ran
Reviewed head
a60a0482b35302a99517724becc8e0778e888ea1. No build or tests were run. I read the PR description, commit list, manifest, and complete diff. I read the included changed filesComputePrebuildBudget.hpp,VulkanDevice.hpp,Dispatch.cpp,PipelineCache.hpp,PipelineCache.cpp,PipelineCacheFailures.cpp, andagc_pipeline_cache_allocation_tests.cmake, plus targeted sections ofVulkanDevice.cppandCompileBudget.hpp. I did not read the full text ofVulkanDevice.cpporRecorder.cpp; they were excluded from the review folder for size.Results
Findings
Blocking
None found in the inspected code.
Non-blocking
None.
Not verified
The full
VulkanDevice.cppandRecorder.cppwere not read; only targeted sections ofVulkanDevice.cppwere inspected. The reported Windows build, CTest cases, Vulkan cache round trip, and convention check were not run here. The manifest lists eight changed files; six included changed files were read in full, whileVulkanDevice.cppwas read selectively andRecorder.cppwas not read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:44:31Z.
Review: COMMENTED
Both added demand tests call
SetForegroundPrebuildPendingdirectly. They exercise the cache gate, but cannot catch a missed clear when a queue submission is abandoned or an exception settles a compute prebuild. Can the integration fixture cover two queued keys, clear one through abandonment and the other through completion or failure, and verify that the checkpoint resumes only after the last key is gone? That would cover the newFinishQueuedComputePipelinewiring that prevents the foreground override from staying active.Source review at
a60a0482b3. A trial merge onto484e8e6b77conflicts inVulkanDevice.cpp,PipelineCache.hpp,PipelineCache.cpp, andPipelineCacheFailures.cpp. I could not run the integrated comparison on that base.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T04:02:38Z.
Review: COMMENTED
Actionable comments
f987d040-373c-423b-bdbe-e4aa11d1a469Reviewing files that changed from the base of the PR and between
a60a0482b3andece46222fc.core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/PipelineCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineCache.cppcore/libs/prx/libSceAgcDriver/tests/PipelineCacheFailures.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T04:19:14Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
56018cc5571fecc7a5ffdd72fdac00901993127a; no build or tests were run. I inspected the prepared diff and targeted source ranges withrepo_read.py.Results
Negative control
Not run; this review did not execute tests.
Findings
Blocking
None.
Non-blocking
None.
Sources
The checkpoint accounting and wake behavior are in PipelineCache.cpp at the reviewed commit. Background admission and queued foreground demand are handled in VulkanDevice.cpp at the reviewed commit.
Not verified
No build, test, Windows/GPU execution, or Vulkan validation run was performed here. The author reports a Windows 11 release build, 15 focused CTest cases, and Vulkan validation with zero
VUID-errors. All 11 changed files listed underreviewedinfiles.jsonwere inspected through the diff and included file text or targeted pinned reader ranges.VulkanDevice.cppwas too large for full inclusion; its changed hunks and relevant source ranges were inspected.files.jsonlists no excluded files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T04:22:49Z.
Review: COMMENTED
Actionable comments
core/libs/prx/libSceAgcDriver/tests/execution/AsyncDrawCompile.cpp, lines165–166· 🎯 Functional Correctness · ⚖️ Poor tradeoffstartingWaitis set beforeWaitForBackgroundCheckpoint()runs. If the waiter is descheduled for longer than the 50 ms probe between those two statements, disabling checkpoints clearscheckpointUntilbefore the waiter reads it. The waiter then returns without blocking, so both checks pass even if disabling never wakes a blocked waiter. When the waiter blocks promptly, the 2 s recovery check still catches a missing notify.WaitForBackgroundCheckpoint(). The test should call the disable only after it observes that signal. The condition variable releases the mutex only while the waiter is blocked, so the disable then runs against a waiter that is already waiting.75a5dfc2-1666-4d70-bcd3-0cb59c217335Reviewing files that changed from the base of the PR and between
ece46222fcand56018cc557.core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/PipelineCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineCache.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_async_draw_compile_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/AsyncDrawCompile.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T04:36:09Z.
Review: COMMENTED
Actionable comments
649ef0c9-1de1-4c2c-a94b-6d527714d56cReviewing files that changed from the base of the PR and between
56018cc557and4d290deb48.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T04:52:17Z.
Review: COMMENTED
Reviewed — comments
The changed hunks were reviewed at head
325ce999b1de380a7df3d1b8fc91f23ebb2781d4; no verified blocking defect was found, but I did not read all ofVulkanDevice.cpp.What I ran
Read the prepared description, commits, manifest, diff, and targeted source context using
repo_read.pyat the pinned head. No tests or builds were run. The author reports Windows 11/GCC 15.2 tests and a Vulkan validation run; these were not independently verified.Results
Negative control
Not run; no tests were run during this review.
Findings
Blocking
None verified in the reviewed changed hunks.
Non-blocking
None.
Sources
Behavior review used the prepared diff and source at the pinned head. Changed lines reviewed included checkpoint admission and save logic in
PipelineCache.cpp, prebuild admission and device lifecycle changes inVulkanDevice.cpp, and replacement handling inPresentation.cpp.Not verified
The complete
VulkanDevice.cppwas not read; its changed hunks were inspected throughrepo_read.py. No tests, builds, or Vulkan runs were performed.files.jsonlists no files excluded by rule; the full text ofVulkanDevice.cppwas omitted from the review folder because it exceeded the folder size limit. Other changed files and their relevant hunks were read.To get this to a good state
Nothing is required.
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.