fix(agc): discard recorder batches after submission failure #5837
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5837"
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 akkadbakkad89 on 2026-10-14T13:02:55Z.
What
Carries #3298 by @mrcrapto, which was closed automatically by the intake pause (author has no merged PRs and cannot reopen it). Rebased onto current main; no open PR implements the same change.
If
vkEndCommandBufferorvkQueueSubmitfails afterRecorder::Submit()moves out the open batch, the batch destructor releases kept objects but leaves its Vulkan handles, label-table entries, completion counts and pending-write snapshot behind. Label entries can then refer to the destroyed batch.The batch is now discarded on unwind: its labels and completion counts are removed, the pending-write snapshot refreshed and its handles released without running its completions. Earlier in-flight batches remain tracked. The same label-removal helper is reused on normal completion.
Cherry-picked
e487ff005with the original authorship kept; it applied cleanly onto currentmain.Tested
WSL Ubuntu 24.04, llvmpipe (LLVM 20.1.2). Rebuilt
libSceAgcDriverand the recorder tests on this branch:agc_recorder_kept_bytespasses (includes the new mocked vkEndCommandBuffer/vkQueueSubmit failure cases) andagc_driver_recorder_testsruns clean under llvmpipe.tools/check_conventions.py --base upstream/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T01:03:00Z.
Ran this on PR head 27886f847 (merge base
131171e77, 501 commits behind mainab9a47684).Setup: PR head checked out as-is (not rebased), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), Linux. The test uses a MockDevice; no GPU was used.
So on this setup the test fails without the change and passes with it. Main has changed the Recorder files since the merge base (6 commits on Recorder.cpp), and many open PRs touch Recorder.cpp. I did not test the PR rebased onto main.
Not checked: real GPU submission failures, or any title.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:14Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppL754-755core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppL3317-3318, L3334-3343, L3872-3874Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppImported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-15T12:18:40Z.
Manual overlap review (per the pr-overlap note above — the listed PRs are dirty against base so they could not be diffed):
Of the same-file PRs, #5431 is a real semantic overlap: its
Submit()implements the same discard-on-failure path — batch is pushed toinFlight, and onvkEndCommandBuffer/vkQueueSubmitfailure it doesinFlightKeptBytes -= ...; inFlight.pop_back(); discardUnsubmitted(std::move(discarded), false); return;, and it definesRecorder::discardUnsubmitted(std::unique_ptr<Batch>, bool reusable).discardUnsubmittedis a name invented in #3298, so that machinery was derived from this change and extended for draw-token tracing. If #5431 merges first, this PR becomes largely redundant; conversely this PR is the standalone fix without the tracing feature.Other same-file PRs checked manually — #5609, #6188, #1747, #1896 touch
Recorder.*but none implement the submission-failure discard path (vkQueueSubmit/vkEndCommandBufferfailure → drop the batch).Rebased onto current main (
d92a8dad3);agc_recorder_kept_bytes_testsandagc_driver_recorder_testspass on the new base.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:34:33Z.
Checked on the PR merged onto current main:
agc_recorder_kept_bytespasses and fails withRecorder.*reverted, the rest of the libSceAgcDriver ctest is green apart fromagc_driver_preparation_scope_settleandagc_driver_tessellation, which also fail on main. The submission-failure cases (host/device OOM, device lost with idle success/loss) pin labels, completion counts, the write snapshot and earlier in-flight batches. Merging once the full Build is green.