feat(agc): record depth-only draws on a recording pool behind APS5_PARALLEL_ATLAS #19697
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19697"
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 Logan1h on 2026-11-13T20:35:16Z.
What
APS5_PARALLEL_ATLAS=1records depth-only draws of the atlas pass on a secondary-command-buffer recording pool instead of the render pass's primary list. The flag is off by default (unset, empty, or starting with0); with it off the change is inert.RecordingPoolowns the pooled recorders; a draw is eligible only when the pass is depth-only and no fault tokens are pending (DrawFaultTokens()— soAPS5_GPU_CHECKPOINTSdisables the pool path), in which case the pool path is skipped entirely.Pipeline::Begin/StartDrawPass/LeaveRenderPassOpentake asecondaryContentspath for the pooled recording;noteDrawFaultTokenstays inline.ParallelAtlasEnabled()reads the switch's value;docs/dev/ENVIRONMENT.mddocuments the semantics.parallel atlas: 8 of 8 depth-only draws recorded on the recording pool).Honesty note on scope: in this PR the recording thread is still joined immediately — the committer waits on
assembly.Take()for every depth-only draw, so nothing overlaps with the rest of the frame yet and with the switch on this is slightly slower than inline recording; the recorder, resources and thread-local slots are safe precisely because the caller is parked. Deferring the join to the end of the pass, with a ThreadSanitizer run and a paired timing on a title with a shadow atlas, is the follow-up PR.No title-specific behaviour; the pool path is keyed on pass shape, not on any title.
Tested
Current head
967a12dc6098912de6c62cfb0effe878a21a7d53, rebased ontomain851212fb98fe1da701103a5acf38dfdf8a856615(2026-11-22); 1 commit ahead, 0 behind at rebase time. This rebase was conflict-free:git merge-treeclean, the PR patch is byte-identical to the previous head7b5169b70cf(git range-diffshows=, zero diff-of-diffs), and none of the six upstream commits (all reverts — #25189 libressl CONF, #23139 libresslSSL_get1_session, #19566 agc SDWA clamp, plus their merges) touch any file in this diff. The earlier rebase ontoef7dc4452dfhad two conflicts, resolved and carried forward unchanged in this identical patch:Draw.cppkeeps main's non-movableBorrowedDraw&recordDrawsignature and main's moved-push patching (ShaderResources::MovedPushPatches,resources.PatchPushConstants,PatchMovedPushConstants, localmovedPushcopy,pushBytes/pushStages) inside this PR's relocatedrecordPassOpen/recordBodylambdas, so the pooled recorder binds the same patched push constants as the inline path;docs/dev/ENVIRONMENT.mdis the alphabetical union of theAPS5_PARALLEL_ATLASandAPS5_PAUSE_CLOCK_FOR_PIPELINESrows. The diff is 16 files, +495/−59,3rdparty/untouched; GitHub reportsMERGEABLE.mainhas since advanced tod8635c3179b(the base tip GitHub merges against) andffc2be13513;git merge-treeagainst the current base tip is clean with no file overlap, and the libressl revert46d238fa7a6is an ancestor of it. Windows CI triage on the previous head7b5169b70cf(Build44953161910, windows job136998444197): thewindowsjob failed on a single pre-existing test,guest_libressl_conf(Exit code 0xc0000409, assertiontests/Conf.cpp:94→abort()), 1 of 5530; conventions, library portability (Emscripten44953161907) and the progress report (44953162087) passed. The same test fails identically onmainat the exact previous baseef7dc4452df(run44953469601, windows job136998961932:4723 - guest_libressl_conf, 1 of 6665), and this diff touches nolibSceLibreSsl/libcsource, so the failure was pre-existing onmain, not introduced by this PR. Its root cause was #25189's new CONF test mapping a temp directory viaAddPathAlias(path.string()), which fails only on Windows; the maintainer reverted #25189 in46d238fa7a6(namingef7dc4452d), and that revert is now inmain. This rebase absorbs the fix, so the new head'swindowsjob runs the correctedConf.cpp; its CI is in progress. The AGC GPU tests (agc_pass_contents,agc_driver_depth_plane_sampling,_evicting,agc_driver_recorder) are***Skippedon the GPU-less CI runner, so their verification is the local GPU re-run below.libSceAgcDriver(including the newRecordingPool.cpp),agc_driver_recorder_testsandagc_driver_depth_plane_sampling_testsbuild with-DBUILD_TESTING=ONvianinja -j2; the build exits 0 with noerror:orFAILED:line.ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer, the focused setagc_pass_contents,agc_driver_depth_plane_sampling,agc_driver_depth_plane_sampling_evicting,agc_driver_recorderpasses 4 of 4 in each of the three switch states (unset,APS5_PARALLEL_ATLAS=0,APS5_PARALLEL_ATLAS=1). Every state log contains 4Insert instance layer "VK_LAYER_KHRONOS_validation"lines, 0was not found but was requested by env var VK_INSTANCE_LAYERSlines and 0VUID-lines.=0, both depth-plane tests reportparallel atlas: 0 of 8 depth-only draws recorded on the recording pool; with=1both report8 of 8.git diff --check,tools/check_conventions.py --base origin/main --head HEADandtools/check_test_registration.py --scriptspass on this head. The configured-build registration check reports 3329 test executables, 0 built but not run, and everycore/libs/prxsource that defines anAPS5_VABIfunction is compiled.python3 tools/pr_overlap.py --branch rebase/pr19697-parallel-draw-main-20261117completed a full scan on this head (2364 open PRs againstmain, 2363 probed, 275 share files or exports) and exited 2 (fail-closed): 7 confirmed line-overlaps — #8246 (Draw.cppL3090-3091), #10894 (DepthPlaneSampling.cppL6-7, L76-77), #15572 (Draw.cppL3194-3199), #22531 (DepthPlaneSampling.cppL77), #24327 (Recorder.cppL1665-1668), #24572 and #24735 (Draw.cppL3206) — and 121 unconfirmed (their heads conflict with currentmain, so the tool cannot project their lines). Among the unconfirmed, #17943/#18029 are the encoder-thread recording stack in the same parallel-recording domain (Draw.cpp/Recorder.cpp): they were confirmed against the older base but now conflict withmain, so merge order matters andpr_overlapmust be re-run at merge time. No open PR implements the same depth-only recording pool (RecordingPool/OrderedAssembly/APS5_PARALLEL_ATLAS).0cab3b02b575565827a3192e10fafc969f8ae2fb(rebased ontof87ede04b82dacb196ee460b060994b9767d7338):tools/vulkan_validation_gate.py, baselinef87ede04b82vs that head,APS5_PARALLEL_ATLAS=1,agc_driver_depth_plane_sampling, two iterations per side:status=complete,exit_code=0,problems=[]; every run insertedVK_LAYER_KHRONOS_validation, no new diagnostics, 8 of 8 pooled draws in both iterations. This is not a current-head run; the independent re-run above is the current verification.a886cc9057bydomx4q(report): Arch Linux, GCC 16.2.1, RTX 4090, proprietary driver 620.70.06, that head merged cleanly onto then-main1adc0e2f4b. With and withoutAPS5_PARALLEL_ATLAS=1, baseline passed 3 of 3 and the PR passed 4 of 4 focused tests; every selected device was the RTX 4090, the Khronos layer was inserted, and noVUID-was reported. Both depth-plane tests reported 0 of 8 pooled draws with the switch off and 8 of 8 with it on. This is not a current-head run.No speed claim: the flag is off by default and this PR makes no performance assertion.
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 MarcZX10 on 2026-11-19T22:29:11Z.
Review: COMMENTED
Reviewed — comments
The review covers the changed implementation and tests at head
0cab3b02b575565827a3192e10fafc969f8ae2fb; no checks were run here, and two changed files were not read in full.What I ran
No commands or tests were run. I inspected the prepared diff and selected changed-file context through
repo_read.py.Results
Findings
Blocking
None found in the code inspected.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded because each was too large for the review folder; only their diff hunks were inspected. No build, test, validation, or runtime checks were performed here. The Windows and historical Linux results in the PR description are author-reported, not independently confirmed.Files read:
core/libs/prx/libSceAgcDriver/CMakeLists.txt,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp(changed hunk only),core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/OrderedAssembly.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp,core/libs/prx/libSceAgcDriver/Graphics/include/RecordingPool.hpp,core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/RecordingPool.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/Resources.cpp,core/libs/prx/libSceAgcDriver/tests/Recorder.cpp(changed hunk only),core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake,core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp, anddocs/dev/ENVIRONMENT.md.files.jsonwas not available; the listing confirms the two exclusions above.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T03:47:05Z.
Review: COMMENTED
Reviewed — no blocking findings
The prepared bundle and targeted source context show no verified blocking defect; a complete review and independent checks were not possible in this session.
What I ran
Reviewed head
356be689d624b321b37b0139d7c4cb163fe1f1d0using the prepared diff andrepo_read.pysource context. No build or tests were run here. The description reports Windows builds and focused test runs; those are author-reported results, not runs performed for this review.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded from the bundle; only relevant diff hunks were inspected. Other changed files were listed in the manifest, but this review read targeted ranges rather than every full file. Runtime behavior, builds, and tests were not independently verified.To get this to a good state
Nothing is required. Optional: independently run the focused build and tests on this head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T13:02:24Z.
Review: COMMENTED
Reviewed — no blocking findings
This review cannot be completed because the required reader and review-folder contents were not available through the provided tools.
What I ran
Not run. The pinned-head reader was unavailable.
Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The description, commits, diff, manifest, changed files, and test coverage were not read. No files can be confirmed as read against the reviewed list.
To get this to a good state
Provide access to the review inputs and pinned-head reader, then complete the review before selecting a verdict.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T11:17:58Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: fix the worker command-buffer lifecycle so buffers are not returned to a command pool while still pending on the GPU.
What I ran
Reviewed head
967a12dc6098912de6c62cfb0effe878a21a7d53. No commands or tests were run; inspected the prepared diff and targeted code throughrepo_read.py.Results
Findings
Blocking
core/libs/prx/libSceAgcDriver/Graphics/src/RecordingPool.cpp:143: theReleaseobject returns each secondary command buffer to the worker's reusable list when the recorder releases its keep-alive. That occurs when the recording batch is retired, not when Vulkan has necessarily finished executing the batch. On a later draw,acquirecan retrieve that same buffer andresetBuffer/beginBufferit while it is still pending in a submitted batch, which violates Vulkan command-buffer lifetime rules and can cause validation errors or corrupted rendering. Keep the buffer unavailable until completion of the submission that references it (or allocate a fresh buffer per in-flight use and recycle only after the corresponding fence signals).Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cpp, which were excluded from the review folder; their relevant changed ranges were inspected withrepo_read.py.To get this to a good state
Tie secondary command-buffer recycling to GPU completion, then rerun the Vulkan validation and focused depth-only recording tests with the pool enabled.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:58:57Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: remove the unresolved merge-conflict markers from the changed source and documentation files.
What I ran
c40dcb5d1537e08c5d26b6075e92f712e8d82e54usingrepo_read.pyto inspect the prepared diff and repository files.Results
Findings
Blocking
Recorder.hpp,Draw.cpp, andENVIRONMENT.md. The markers split function declarations and draw timing logic; as committed, the C++ sources cannot compile. Resolve the conflicts and retain the intended combined changes. Evidence:core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp:195,core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3293,docs/dev/ENVIRONMENT.md:504.Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwas excluded by the prepared review folder; their changed hunks were inspected indiff.patchonly.review/files/were not all read in full; review focused on the pool implementation, draw path, assembly helper, and conflict locations.To get this to a good state
Resolve the conflict markers in the three cited files, then run the build and focused tests for the changed recording path on the new head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T19:31:56Z.
Review: DISMISSED
Reviewed — changes requested
The changed depth plane sampling test refers to
stencilValueafter removing it fromDrawDepth’s parameter list, so the test cannot compile.What I ran
Reviewed head
960a77e61617169d0e43af858293f84c2f0b3560using the prepared diff and the pinnedrepo_read.pyreader. No build or tests were run.Results
Findings
Blocking
core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp:190:DrawDepthno longer acceptsstencilValue, but its body still callsstencilValue.has_value()and dereferences it (around lines 243–246). This leaves the identifier undeclared and prevents compilation. Remove the stale block or restore an appropriate parameter and call-site handling.Non-blocking
None.
Not verified
No build, test run, or CI results were independently verified. Full head text was not read for every changed file. The prepared diff covered all 16 changed files; the manifest marks
core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppas excluded from the review folder. Targeted head ranges were read inDraw.cpp,Pipeline.cpp,Recorder.cpp,RecordingPool.cpp,VulkanDevice.cpp, andDepthPlaneSampling.cpp; the addedOrderedAssembly.hppwas read in full.To get this to a good state
Fix the stale
stencilValuereferences, then build and run the affected tests on the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:19:14Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed change at
7f46b210c7170bd1d854bed993162c9b77ec5a1badds an opt-in pool for recording eligible depth-only draws; I found no verified blocking defect, but two changed files were not read in full and no checks were run during this review.What I ran
No build or tests were run. I read the prepared description, commit list, diff, manifest, and changed source ranges through
repo_read.py.Results
Findings
Blocking
None identified in the code reviewed.
Non-blocking
RecordingPool::Recordqueues each draw, thenDraw.cppimmediately waits onassembly.Take(). This prevents recording from overlapping with other frame work, as the description acknowledges. Consider measuring again when a later change defers the join.Not verified
VulkanDevice.cppandtests/Recorder.cppwere excluded from the prepared review folder; their changed lines are visible in the diff, but I did not read the full files through the pinned reader. Therefore those files are not fully reviewed.To get this to a good state
Nothing is required.