fix(libkernel): submit APR command buffers asynchronously #2455
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2455"
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 Scramblrrrr on 2026-10-09T21:50:36Z.
What
APR submission currently runs the command stream synchronously. A stream that waits for a value written by its submitting thread after the call returns therefore deadlocks. PPSA11386 (007 First Light) records a WaitOnAddress followed by a file read, submits through sceKernelAprSubmitCommandBufferAndGetId, writes the awaited value immediately after submission, then calls sceKernelAprWaitCommandBuffer. The submit never reaches that write on main.
Snapshot each submitted command stream into an owned FIFO job and return its submission ID immediately. Completion waits now wait for that job and propagate execution exceptions instead of always returning success. Successful jobs release their command storage and completion records; repeated waits remain valid. Buffers with invalid bounds and unknown IDs are rejected. Execution failures without an observable submission ID terminate instead of silently reporting success.
The asynchronous contract is corroborated by ampr_emu's APR submission reactor. No game assets or title-specific constants are added. AMM submission remains unchanged.
On Windows the queue has process lifetime: destroying a worker during PRX teardown joins under the loader lock and hangs. Linux uses a stoppable worker and cancels unsatisfied waits during queue destruction. Priority scheduling, console error codes, ID rollover, result-buffer layout and unloading libkernel while the Windows process stays alive remain unverified and are recorded in TechnicalDebt.
Tested
Windows 11, MinGW-w64 GCC 15.2.0, Ryzen 7 7800X3D / RTX 5070 Ti.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T22:01:30Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-10T10:48:39Z.
Coordination update: SleglJan/AnyPS5#20 is the agreed canonical APR implementation. Its detached priority lanes and libc shutdown hook avoid joining from loader-lock teardown. Our exact b225b3fb Windows cross-check passed 30 runs of each of guest_ampr_markers, guest_ampr_lane_failure and guest_ampr_shutdown (90/90); the collaborator also reports Windows CI passing. I am keeping this overlapping PR closed rather than advancing a second APR implementation. If a distinct Windows teardown failure is reproduced, it will be addressed on the canonical branch.
Pull request closed