fix(agc): wait a bounded time for a dispatch's compute pipeline built ahead before skipping it #26165
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26165"
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 Ketz7 on 2026-11-23T11:13:54Z.
What
APS5_ASYNC_DRAW_COMPILE, a dispatch whose compute pipeline ofAPS5_ASYNC_COMPUTE_WORDSor more is still building on the library prebuild pool now waits for it up toAPS5_ASYNC_COMPUTE_WAIT_MS(500 by default) before it is skipped. The waits are capped at twice that over any sliding 10 s (SlidingWaitBudget).VulkanDevice::AwaitComputePipelineAheadwaits on the build's future, or polls while the build is still queued. A build ahead that failed lets the dispatch build the pipeline itself, as before.APS5_PROFILE_DRAW, so a cold run always shows what was skipped.Tested
Windows 10.0.26300, AMD Radeon RX 7900 XT, AMD proprietary driver 26.11.2 (LLPC), Ryzen 9 7900X. All runs are vkQuake (PPSA99010) cold, with
APS5_ASYNC_DRAW_COMPILE=1and a 180 s limit, on current mainf5b7e1d1acwith #25226 merged in:APS5_ASYNC_COMPUTE_WAIT_MS=0No guest timeouts (
has not reached submission) and noQUAKE ERRORin any run.agc_driver_async_draw_compilecovers:_skip_pipelinevariant (APS5_ASYNC_COMPUTE_WAIT_MS=0) that keeps the old skip.The
_enabledvariant now requires the first dispatch to store. It fails without the change ("was skipped (2 attempts)").All 6 variants and the 22
agc_driver_(async|pipelined_dispatch|oversized|dispatch)tests pass on llvmpipe. The async set (38 of 42) passes on the RX 7900 XT. The other 4 graphics executables were not built by my script, so they were not run.Not tested: Astro Bot or any commercial title, NVIDIA, Linux. @ThiagoShade, a cold run on this with your earlier method would show whether 500 ms is enough for the sky, and whether 1000 or 2000 changes it on your NVIDIA card.
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
APS5_ASYNC_COMPUTE_WAIT_MSto set the wait limit; it defaults to 500 ms.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T11:17:06Z.
Review: COMMENTED
Reviewed — comments
Changes are not approved because the background wait budget resets on fixed 10-second boundaries, so it can exceed its stated limit in a sliding 10-second interval.
What I ran
Reviewed head
2b6c7d102b27b9f62b7604109d52fc9eec4e09f3using the pinnedrepo_read.pyreview tools. No tests or builds were run.Results
Findings
Blocking
None.
Non-blocking
Diagnostics.cpp:179:takeBackgroundWaitclears all accumulated wait time when a fixed window boundary passes. For example, waits near the end and start of successive windows can exceed the documented two-times-per-sliding-10-seconds cap. Track actual wait intervals (asSlidingWaitBudgetdoes) or use a rolling window so the configured cap remains effective.Not verified
No tests, builds, or console runs were performed. The full
VulkanDevice.cpptext was excluded from the review bundle; its changed wait implementation was read throughrepo_read.py. All ten changed files listed in the manifest were reviewed, with targeted ranges for larger files.To get this to a good state
Nothing is required; this is a non-blocking point. Consider correcting the background wait accounting before relying on the documented sliding-window cap.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T11:44:39Z.
Review: CHANGES_REQUESTED
Reviewed exact head
2b6c7d102b27b9f62b7604109d52fc9eec4e09f3. The new compute-pipeline sliding budget does not currently enforce its stated cap when queue workers overlap.Takeonly reads completed entries and returns an allowance; the caller waits and callsSpendafterwards. Different queues run on independent host workers, so two workers can take the same remaining allowance before either records it. A CPU fixture compiled with the exactSlidingWaitBudgetimplementation first charged 500 ms, then took at t=500 ms and t=999 ms before either spend. Both calls received 500 ms, producing 1,500 ms charged (1,499 ms of interval union) in the same 10-second window although the total was 1,000 ms. The serial control returned zero after the second charge. Please reserve the allowance atomically (or combine reservation/wait/commit) and add a multiple-outstanding-waits regression.There is a related ordering issue in the same class:
Spendappends in completion order, whileTakeonly removes expired entries from the front and then addsend - max(start, from)for every remaining entry. Concurrent waits can complete out of start/end order. With an unexpired entry at the front and a later deque entry whose end is 0.75 ms before the window, that expired entry contributes a negative duration; the exact code granted another 500 microseconds even though 1,000.25 ms was already in-window. Please either keep the records ordered or prune/clamp every interval, with an out-of-order completion regression.MarcZX10's existing comment concerns the separate inherited background-wait fixed-window accounting; these two reproductions exercise the newly added compute-pipeline
SlidingWaitBudget. Merge/whitespace/conventions checks passed. I did not run a GPU or console test; this is a deterministic CPU accounting test.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T12:43:42Z.
Review: APPROVED
Re-reviewed exact head
91ab37929c3085b9c95ac9c77cc2b97bcc1fc870. This supersedes my earlier change request.The reservation-based budget fixes both reported concurrency defects.
Takenow reserves an interval under the budget lock, so overlapping queue workers cannot receive the same remaining allowance;Finishidentifies the reservation independently of completion order and returns unused time. Expired intervals are pruned across the whole set rather than only from completion-order front entries.I reran a focused native fixture with the exact updated implementation. The concurrent case now grants 500 ms and 0 ms (1,000 ms total after the prior 500 ms charge), and the out-of-order case grants the expected 450 ms; the serial control also passes. The old implementation had failed both regressions. The author's added official tests cover overlapping reservations, returned early time, and out-of-order completion. The exact-head hosted Windows job is green, including the six
agc_driver_async_draw_compilevariants and dispatch tests reported by the author.I did not run a GPU test for this PR; my verification of the accounting logic was a deterministic CPU test. I did not run a console title.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-23T13:42:50Z.
Review: APPROVED
Windows check of head
91ab37929c(with #25226 under it) with GCC 16 on an NVIDIA and an AMD GPU, merged ontomain8e1af3d9b0(clean merge), and a read of the reworked budget.Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. GPUs, each picked withANYPS5_GPU: NVIDIA GeForce RTX 5070 Ti (621.01) and the Ryzen 7 7700X's integrated AMD Radeon (1002:164e, Adrenalin 26.10.2). Built together with #26193, #26189, #26190 and #26191, which touch other files.agc_driver_async_draw_compile*:main4 of 4. With this PR 6 of 6 (adding_no_waitand_skip_pipeline) in 2 of 2 runs, on both GPUs. NoVUID-lines.&& !AwaitPipelineAhead(...)removed),agc_driver_async_draw_compile_enabledfails on the Radeon with... whose compute pipeline was built ahead within APS5_ASYNC_COMPUTE_WAIT_MS, was skipped (2 attempts).The budget, after mihiii1337's two points:
Takereserves[now, now + allowed]under the lock before it returns, so two queue workers can't be granted the same remaining time.Finishshortens the reservation to the time actually waited, or drops it if the wait ended at its start, which gives the rest back.AwaitComputePipelineAheadreturns as soon as the pipeline is built or has failed, or isn't queued any more, so a ready pipeline costs no wait.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T08:30:11Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review found no verified blocking defect in the code inspected.
What I ran
Reviewed head
91ab37929c3085b9c95ac9c77cc2b97bcc1fc870throughrepo_read.pyand the prepared review bundle. No tests or build commands were run. The author reports test results indescription.md; they were not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas excluded from the review folder; I read only the relevant head lines withrepo_read.py. No other changed files were excluded. Physical-console and title behavior, and the reported test runs, were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T01:21:51Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing in the inspected changes shows a concrete defect; approval is not justified because the head VulkanDevice.cpp file was excluded from the review folder and no checks were run.
What I ran
34c7513976b70d4287aafe7f9386adb7f8f84c31using the prepared diff and repository reader.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppwas listed as excluded because it was too large for the review folder; its changed implementation was inspected through the pinned-head reader, but the full file was not read.Diagnostics.hpp,VulkanDevice.hpp(changed declaration visible in the patch),Diagnostics.cpp,Dispatch.cpp,agc_driver_async_draw_compile_tests.cmake(diff only),AsyncDrawCompile.cpp, anddocs/dev/ENVIRONMENT.md(diff only).files.jsonwas unavailable; the manifest lists the reviewed changed files and identifiesVulkanDevice.cppas excluded from the folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T01:24:12Z.
Review: COMMENTED
Actionable comments posted: 1
Architecture findings (2)
Advisory architecture findings (2)
e4f35a95-6379-4c74-b66c-831d579c5bfaReviewing files that changed from the base of the PR and between
2608316185and34c7513976.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Diagnostics.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Diagnostics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_async_draw_compile_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/AsyncDrawCompile.cppdocs/dev/ENVIRONMENT.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.