perf(agc): prebuild missing compute pipelines on dispatch cache hits #28220
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28220"
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-29T08:03:32Z.
What
When a window attaches, AGC replaces the headless Vulkan device and retains translated dispatches. A translation-cache hit can therefore need a new device pipeline. Let compute lookahead check the current device for that pipeline and queue the existing prebuild operation when it is missing. The existing lookup also accounts for a build already in progress.
Tested
Synthetic workload. Submit 24 different compute shaders, attach a hidden 128 × 128 SDL Vulkan window, and resubmit the same shaders. Each kernel writes a distinct, checked result. Time submission through idle for the first batch on the replacement device, then for 24 resident batches. Four prebuild threads, Release GCC 15.2, i7-13700K and RTX 4090. Each row gives independently calculated medians and the median within-pair latency decrease.
d77ab2d7a21f56d72520vs this PR at43fc5fd7d3The original matrix used 96 fresh processes across both queues and both baselines, with matched pairs in counterbalanced order. The updated main included only relinker code-generation changes. The confirmation used another 24 fresh processes. On the original compute-queue runs, ahead-built pipelines rose from 0/24 to 23–24/24. The first graphics-queue batch had medians of 8.883 → 8.918 ms on main and 8.956 → 9.057 ms with #27872. Resident compute medians were 0.540 → 0.556 ms on main, 0.563 → 0.545 ms with #27872, and 0.970 → 0.964 ms in the confirmation. The extra device lookup has no consistent resident benefit. Fixture, build revisions and reproduction steps · 96-run matrix · 24-run confirmation
Performance traces. On the clean PR base and head, captured one present spanning the first post-attach compute batch, after a warm-up and restart for each build. Trace window 11.241 → 8.928 ms. Inclusive dispatch time on the queue worker fell from 8.482 to 6.162 ms, and the candidate digest shows pipeline work on shader preparation threads. The table above uses untraced process runs. Base trace · Head trace · Base digest · Head digest
Regression. The new test checks both dispatch output and the device's created/ahead counters. It failed specifically at the ahead counter on the PR base. On the head,
agc_driver_compute_pipeline_cached_after_attach,agc_driver_compute_pipeline_outside_gpu_mutexandagc_driver_gated_dispatch_capturepassed. Vulkan loader logs confirmed insertion of validation layer 1.4.369 and zero VUIDs on both sides, withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1. The gated-dispatch test also passed on all four benchmark arms under validation. The project's overlap checker reported no conflicts with open PRs.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 MarcZX10 on 2026-11-29T08:05:56Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
43fc5fd7d3fdc64f6f08fcb5daaf993b56293528usingrepo_read.py. No commands or tests were run by me; test and performance results below are author reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests, builds, or benchmark runs were performed during this review. Author-reported tests and measurements were not independently verified. The review folder's
files.jsonwas unavailable; the manifest lists three changed files, and all three were read. No other repository files were read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T10:39:13Z.
Review: APPROVED
I read the diff at
43fc5fd7d3. Windows 11, GCC 15.2, merged intomainatb97867d3ce6together 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_compute_pipeline_cached_after_attachandagc_driver_compute_pipeline_outside_gpu_mutex: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.main's):agc_driver_compute_pipeline_cached_after_attachfails on both GPUs: "the cached dispatch's pipeline was not built ahead on the replacement device".Not checked: the timings in the body.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:13:26Z.
Review: COMMENTED
A translation-cache hit can now submit a prebuild while another job for the same key is already queued.
HasComputePipelinesees completed and building pipelines, but the job becomes visible there only once a worker starts it. A run of identical dispatches after device replacement can fill the prebuild queue with duplicate jobs during that gap. Can lookahead reserve the device pipeline key before enqueue, releasing the reservation on submission failure? The fixture's single post-attach dispatch does not exercise this case.Source review at
43fc5fd7d3. The head trial-merges ontod2e04ef9b3. Paired Vulkan execution and the added window-attach fixture are queued.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T04:13:08Z.
Review: COMMENTED
Actionable comments
f077bc21-ce56-420f-9b13-813526a1fd98Reviewing files that changed from the base of the PR and between
43fc5fd7d3and4d674f57b4.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppIncluded 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-12-04T04:14:02Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes at head
4d674f57b414f3d173151f5aacb2dad2fc1e24fbare consistent with the stated goal, and I found no verified blocking defects.What I ran
Reviewed the prepared diff and all three files listed as reviewed in the manifest. Used
repo_read.pyat the pinned head to inspect dispatch handling, pipeline state coordination, and the changed test. No build or test was run. Performance figures and test results in the PR description are author-reported.Results
Negative control
Not run independently. The PR reports that its new cached-pipeline test failed on the base at the ahead counter and passed on the head.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
No tests or performance measurements were independently run. I did not verify behavior on other operating systems, GPUs, or physical consoles. All files listed as reviewed were read;
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:28:26Z.
Review: COMMENTED
Actionable comments
2f9a8bc1-a640-406d-b5a4-2e7c3102cf95Reviewing files that changed from the base of the PR and between
4d674f57b4andeb7b7390c5.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-04T04:38:39Z.
Review: COMMENTED
Actionable comments
cfdb371c-d8c7-4031-afd1-78cd4c785a4eReviewing files that changed from the base of the PR and between
eb7b7390c5andecbcc30f51.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T04:47:36Z.
Review: APPROVED
Reviewed — looks good
The reviewed change has no verified blocking findings; source inspection supports merging.
What I ran
Reviewed head
ecbcc30f519a102b3966624f3299eaf49aca9895. I inspected the prepared diff and manifest, then usedrepo_read.pyto read changed code and relevant callers at the pinned head. No tests or builds were run.Results
Negative control
Not run; no test was run during this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
No tests, builds, benchmark runs, or Vulkan runtime behavior were independently verified. The author reports these in the PR description. I reviewed all four files listed under
reviewedinfiles.json:Dispatch.cpp,ShaderRegistry.cpp,agc_driver_compute_pipeline_outside_gpu_mutex_tests.cmake, andComputePipelineOutsideGpuMutex.cpp. No files were excluded by the supplied review rules.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-04T15:33:50Z.
Review: APPROVED
Re-checked
4d674f57b4,eb7b7390c5andecbcc30f51, added since my approval at43fc5fd7d3, applied to main484b0368d3. Windows 11, GCC 15.2,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer(layer 1.4.363), run once with the RTX 5080 (621.24) and once with the AMD iGPU (26.11.2) loader selected. NoVUID-errors in any log, and nowas not found but was requested.ComputePipelineAhead(...) == Startbefore queueing the prebuild. If queueing throws, it erases the resolved entry and abandons the reservation.RegistrationPreparePool::submitnow commitssubmitted,unfinishedandownedonly after the task is queued, and rolls them back if that throws.agc_driver_compute_pipeline_outside_gpu_mutex,agc_driver_compute_pipeline_cached_after_attachandagc_driver_graphics: 3 of 3 pass with each loader.AI-assisted: yes (Claude Code)
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.