perf(agc): release GPU mutex for early index waits #21923
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21923"
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 Azaluz on 2026-11-16T21:49:09Z.
What
Rebased onto
bb89b8a4f5c4. The grouped indirect path from #27686 keeps its individual-record fallback. WithAPS5_INDEX_IN_PLACE_BEHIND_WRITER=1, eligible draws use the in-place index path first, including fixed vertex attributes. When the queue-0 pipelined direct draw still needs the indices on the CPU, releaseGpuMutexonly around the Vulkan timeline wait for an overlapping GPU write, at depth 1 and outside completion.This runs before resolving host imports, choosing Vulkan input buffers, or recording draw input and attachment state. The queue committer releases its queue lock before dispatching the draw. No import or resource lock is held across the wait. When the mutex is reacquired, the normal proof invalidation runs before draw-state memoization, batch-owned keeps retain their references, and the unlock hook hands off already retired batches.
After relock, check recorder identity, liveness and driver device, then refresh writer evidence and drain intervening writes with the ordinary locked flush. Recorder loss traces
draw-skippedand stops both normal and recipe paths before fallback or submit.Tested
Windows build 26300, WinLibs GCC 15.2, Intel i5-14600KF, NVIDIA RTX 4080 SUPER, driver 621.01. Exact revisions A =
bb89b8a4f5c4and B =7abece5f4e06.All 18 common focused tests passed on both revisions with
APS5_INDEX_IN_PLACE_BEHIND_WRITERunset and set to1. The head-onlyagc_draw_index_flushpassed in both modes. The Khronos layer loaded for every Vulkan test, with zeroVUID-orSYNC-HAZARDdiagnostics. The two CPU packet tests also passed on both revisions.Vulkan runs used
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer.agc_driver_committed_read_mappingis registered on Windows.GTA V (PPSA04263 v01.010.002). Three matched 60-second pairs in the Ludendorff bank at “Go to the guard”, standing still at 3840×2160 SDR. The in-place switch was unset. Each revision used its own relinked executable and frozen warm cache seed. All six captures confirmed the scene and recorded zero dropped events.
GpuMutex.wait.*ms/present A → BMean aggregate GPU mutex wait across workers fell from 377.96 to 72.25 ms per present (−80.88%). Baseline wait varied by 18.66 ms per present. FPS, p50 and p99 changes were within the respective baseline ranges.
Main traces and digests · PR traces and digests
Native Linux validation for
7abece5f4e06is pending. domx4q's previous native Linux run on241a0a22aeb8Native trace summary lines from pair 2
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-19T08:10:54Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected diff demonstrates a blocking defect; the described hardware and performance checks are author-reported, not runs performed for this review.
What I ran
Inspected the prepared diff and targeted source at head
80fa3ab5fccb7a9827b5661f5c23169d92e830a1usingrepo_read.py. No build or test commands were run. Readcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppand targeted changed lines incore/libs/prx/libSceAgcDriver/tests/Recorder.cpp; the test file’s full text was excluded because it exceeded the review folder limit.Results
Findings
Blocking
None identified in the inspected source.
Non-blocking
None.
Not verified
The remainder of
tests/Recorder.cppwas not read. Builds, focused tests, validation-layer output, and performance captures were not independently run or confirmed; those results are reported in the PR description.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T00:29:01Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed code shows no verified blocking defect, but the review is incomplete because some changed files were not fully read and checks were not run.
What I ran
Reviewed head
5fefb9957ed0eb8b46648cae110f889b6794eb7dusingrepo_read.pyreader tools for the prepared diff and targeted source ranges. No tests or builds were run; the test results in the PR description are author-reported.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The complete contents of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwere not read; targeted ranges were inspected. Other changed files were read only at relevant ranges rather than in full. Runtime behavior, build results, and the reported test runs were not independently verified. The bundle’sfiles.jsonwas not available through the reader; exclusions were taken frommanifest.json(VulkanDevice.cppandtests/Recorder.cpp, both too large for the review folder).To get this to a good state
Nothing is required. Optional: independently run the focused tests and build on the reviewed head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T17:27:14Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this review; a native Linux rerun for this head is still pending.
What I ran
Reviewed head
241a0a22aeb8dbd65ba10837378a8aecfb968be4using the prepared diff and pinned repository reader. No tests were run. The PR description reports Windows focused test results and matched performance captures; these were not independently run or verified here.Results
Findings
Blocking
None.
Non-blocking
Not verified
Read
description.md,commits.md,manifest.json,diff.patch, and the full text ofDriver.hpp,Recipe.hpp,VulkanDevice.hpp,Driver/Draw/Draw.cpp,Graphics/Draw.hpp,Graphics/Recorder.hpp,Graphics/Draw.cpp, andGraphics/Recorder.cpp. Inspected targeted ranges inVulkanDevice.cppandtests/Recorder.cpp, whose full text was excluded as too large;tests/cmake/agc_driver_recorder_tests.cmakewas listed in the manifest but not read. No test execution, native Linux rerun, or independent check of author-supplied traces was performed.To get this to a good state
Nothing is required. Optional: report the native Linux rerun result when available.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T16:05:09Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and reported checks support the proposed index-wait behavior, though I did not run the checks.
What I ran
Reviewed head
7abece5f4e062658e32e74e898fca4e09f1ce3dcusingrepo_read.pyto inspect the prepared description, commit list, diff, manifest, and targeted source ranges. No tests or build commands were run; the test results below are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded from the review folder; targeted relevant ranges were read throughrepo_read.py. Full text ofcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppwas also excluded; relevant ranges were read. All other changed files listed in the manifest were included, but not all were read. I did not independently verify the reported test runs, performance captures, or Linux behavior.To get this to a good state
Nothing is required. Optional: attach native Linux validation for this head when available.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-02T23:45:26Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes show no verified blocking defect; this review is limited to changed hunks and focused source context.
What I ran
Reviewed head
0cc4aab246e5e4f0df1e78e65576c8943fd16c20. Read the prepared description, commits, manifest and diff, then usedrepo_read.pyfor focused source ranges and call-site searches. No tests or builds were run; the test and performance results in the PR description are author-reported.Results
Negative control
Not run; no tests were run in this review.
Findings
Blocking
None identified in the inspected changes.
Non-blocking
None.
Sources
Behavior was checked against the pinned source at
0cc4aab246e5e4f0df1e78e65576c8943fd16c20, including the draw commit path, recorder flush path, draw input preparation, Vulkan draw and recipe wrappers, and relevant call sites.Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded from the review folder because of size; their changed ranges were read throughrepo_read.py. No test output, performance traces, or native Linux behavior was independently verified.files.jsonlists 11 reviewed paths and no rule-excluded paths.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-02T23:45:58Z.
Review: COMMENTED
Actionable comments
cb676b4c-9bc3-4afe-9260-318e67bb1504Reviewing files that changed from the base of the PR and between
7abece5f4eand0cc4aab246.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmakeIncluded 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 ligmaSec on 2026-12-03T22:13:52Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. The recorder fixture exercises retirement, replacement, and failed device revalidation while the wait is unlocked. Please also show an end-to-end indexed draw with the early wait enabled and the recorder kept alive, so the test covers resuming the read and recording the draw through the production callback. If publishing a speed gain, include pairedtrace_digest.pysummaries for the same scene and machine. Paired recorder 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.