fix(libSceGnmDriver): pace submissions without hanging on compute queues #20730
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20730"
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 Gag21 on 2026-11-15T13:58:10Z.
What
When
APS5_GNM_SUBMIT_WAIT_IDLEis set,SubmitLockedinlibSceGnmDriver/Export.cpppaces graphics submissions so earlier command buffers and descriptor tables are not overwritten while still in flight on Queue 0. Previously, it calledAgcDriverWaitIdle_nid_postfix(), which waits for all accepted submissions across every queue to complete. When a title maps an asynchronous compute queue that runs a ring buffer parked inWAIT_REG_MEMon a title-written label (such as CUSA01709 run 22), the idle wait blocked indefinitely under the submit lock.This replaces the pacing wait in
SubmitLockedwithAgcDriverWaitSubmissionPaced_nid_postfix, backed byDriver::WaitSubmissionPacedFor. It waits until Queue 0 has completed all submitted work (no uncommitted work, no pending submissions, not executing, and draw pipeline / labels not busy), while allowing compute queues to be settled if they are parked waiting on a title-written label.Tested
AgcDriverWaitIdle_nid_postfix,TestParkedComputeQueueWaitreproduced the bug and failed withSubmit hung while compute queue was parked on title.gnm_driver_submit_testspassed 100% (TestFrameBoundaryWaitandTestParkedComputeQueueWaitin 1.70s).gnm_driver_packetspassed 100% (0.04s).gnm_driver_compute_queuepassed 100% (1.16s).ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layerpassed with layer insertion confirmed and 0VUID-validation errors.check_conventions.py --base origin/mainpassed.pr_overlap.py --namesandpr_overlap.py --branchcompleted with no duplicate exports or implementation conflicts.debt_fold.py --checkpassed fordocs/dev/debt/changes/fix-gnm-submit-pacing-wait-settled.md.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_GNM_SUBMIT_WAIT_IDLE=1is enabled. Subsequent submissions wait for queued work to reach a paced state, including acrosssceGnmSubmitDone. This option is off by default.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T18:45:17Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: ensure a compute queue is still mapped to its awaited slot before treating it as parked.
What I ran
Reviewed head
fdc542d375e8df9bf9bf4ac1c141ff27fb9866c8; no commands or tests were run. I read the prepared description, commits, manifest, diff, all seven changed files, and targeted queue mapping and submission callers throughrepo_read.py.review/files.jsonwas unavailable, so the exclusion list was not verified.Results
Findings
Blocking
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp:512:submissionPaced()considers any nonzero awaited address sufficient to treat a compute worker as safely parked whenawaitsTitle()andstillAwaited()pass, but it does not check that the guest queue is still mapped.sceGnmUnmapComputeQueueclears the ring mapping without synchronizing with the worker. If the title unmaps a queue while its worker remains blocked on a title-written label, the pacing wait can return as though that work were a harmless parked queue. A subsequent submission may then reuse command buffers or descriptors while the worker still has work in flight. Track mapping/lifecycle state under synchronization and only exempt a queue that is confirmed mapped and parked; otherwise wait for its work to settle.Non-blocking
None.
Sources
Not verified
No test/build commands were run. The reported Windows/Vulkan test runs and convention checks were not independently confirmed. The prepared exclusion list was unavailable.
To get this to a good state
Synchronize compute queue unmapping with worker state and only exempt workers whose queues remain mapped and are confirmed parked. Then rerun the submission wait tests, including the parked compute queue case.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T12:23:47Z.
Review: COMMENTED
Actionable comments posted: 2
7540d6ff-1ab5-4b17-a5da-0340506f0660Reviewing files that changed from the base of the PR and between
f51f7fec91andef02243e96.core/libs/prx/libSceAgcDriver/Execution/include/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cppcore/libs/prx/libSceGnmDriver/Export.cppcore/libs/prx/libSceGnmDriver/tests/Submit.cppdocs/dev/debt/changes/fix-gnm-submit-pacing-wait-settled.mdIncluded 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 MarcZX10 on 2026-11-28T12:26:15Z.
Review: COMMENTED
Reviewed — no blocking findings
The change is coherent at head
ef02243e965beaa70928e6a662f0e31cdbdf75d5; no blocking defect was identified in the changed implementation, though I could not run the reported checks or confirm all reviewed files were read.What I ran
I read the prepared description, commit summary, manifest, and diff, then inspected targeted repository ranges through
repo_read.py. No tests or build commands were run. The author reports Windows 11 tests in the description; those results were not independently verified.Results
Findings
Blocking
None identified in the inspected ranges.
Non-blocking
None.
Not verified
The manifest marks eight files as reviewed/included, but this review only inspected targeted ranges in the two driver implementation files and the first line of each other changed file. The remaining contents of
Driver.hpp,EntryPoints.cpp,Export.cpp,tests/Submit.cpp, and the debt note were not read.Driver.hppandSubmission.cppwere read partially; other than their reported changed hunks, their full contents were not examined.files.jsonwas unavailable through the reader, so excluded-file status could not be checked. No build, tests, validation layer run, convention check, overlap check, or debt-fold check was performed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:21:27Z.
Review: COMMENTED
The trial merge onto
a1b75b0947was clean. The pacing predicate lets a compute queue parked on a title-owned label yield while requiring queue 0 and its commit/finisher work to settle. Please document what happens when the new five-second deadline expires:AgcDriverWaitSubmissionPaceddiscards the false return and the caller proceeds, so the one-submission pacing guarantee in the debt text has a timeout exception. The parked-compute fixture tests a different path from an actual timeout. Local paired execution is pending.AI-assisted: yes.