Repository navigation
feat(agc): record depth-only draws on a recording pool behind APS5_PARALLEL_ATLAS - #19697
Conversation
|
Overlap note (pr_overlap could not test-merge, compared manually): this branch textually conflicts with #18390 in |
|
@Logan1h I reviewed 80a0a1b. With the switch off I found nothing that changes behaviour, so I am passing it as an opt-in perf step, with three notes for follow-up.
A default-off gate run of PPSA21564 on this head would show that the |
80a0a1b to
0303c68
Compare
|
@oneandonlydean All three notes are in 0303c68:
Re-ran the three focused tests on this head with On the PPSA21564 default-off gate run: noted — I don't have that title locally, so if the neutral-refactor gate matters for merge, I'd need a run from someone who has it installed. AI-assisted: yes. |
|
AMD run of head
So on AMD's Windows driver the pooled path records all eight depth-only draws as secondary command buffers inside |
|
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.
Some 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.
|
|
Windows check of head all 137 selected tests (
AI-assisted: yes. |
|
@Logan1h @oneandonlydean here is the PPSA21564 default-off gate run on head Setup: Linux 7.3, RTX 3080 Ti 12 GB, NVIDIA 615.71.09, Ryzen 9 5950X, GCC 15.3, Release. A is Tests:
The fourth test on this head is Title: PPSA21564 01.007.000, 3840x2160, no input, headless. Each run was stopped 90 s after the level started. Every run used the same build and runtime.
AI-assisted. |
0303c68 to
1749281
Compare
|
Rebased onto current main (74900e8). The rebase crossed the CommandState migration, so the pooled path now follows it: the pool no longer keeps a raw vkCmdExecuteCommands pointer (FunctionName rejects it outside a CommandState); execution goes through the new CommandState::ExecuteCommands on the primary batch's graphics state, and the pooled secondary records with a fresh CommandState (cold suppression, matching the old raw-buffer semantics). DeviceFunctions gains the tracked cmdExecuteCommands member, filled in FillDeviceFunctions. Focused tests on this head (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation): agc_driver_depth_plane_sampling, agc_driver_depth_plane_sampling_evicting, agc_graphics_state_recorder, agc_graphics_state_recorder_unsuppressed, agc_pass_contents — 5/5 pass, no VUID- lines, the layer loads (checked with VK_LOADER_DEBUG=layer). tools/check_conventions.py --base origin/main passes; git diff --check is clean. AI-assisted: yes. |
bdcf6c8 to
8683b8d
Compare
|
Rebased onto current main (c04f8be); head is 8683b8d. @oneandonlydean your SDL2 submodule-pointer fix is folded into the rebased commit (the tree's 3rdparty/ now matches main exactly — thanks for catching that). Focused tests re-run on this head in all three switch states (unset, =0, =1) with the validation layer: agc_pass_contents, agc_driver_depth_plane_sampling, agc_driver_depth_plane_sampling_evicting all pass, no VUID- lines. Conventions and diff-check clean. AI-assisted: yes. |
|
@Logan1h 8683b8d conflicts with current main in
Please rebase on main, keep those in the pooled path as in the serial one (the patched push constants must be assembled before |
8683b8d to
ff4dd64
Compare
|
Rebased onto current main (a2f4c8d); head ff4dd64. The two recordPipeline hunks are carried into the relocated code as you described: the moved-buffer push-constant patching (MovedPushPatches / PatchPushConstants / PatchMovedPushConstants with the local movedPush copy) is now assembled before the lambdas, so both the serial path and the pooled recording see the patched pushBytes/pushStages, and recordStencilReplay takes them. The record.moved passReads loop and the snapshot.buffer == nullptr skip came in with the base. Re-ran agc_driver_recorder, agc_pass_contents and the depth-plane-sampling pair on this head with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation in both switch states: 8/8 pass, no VUID- lines. check_conventions and diff --check clean. (Noted on the Windows agc_driver_graphics fixture, thanks — leaving it to #20134.) AI-assisted: yes. |
ff4dd64 to
a886cc9
Compare
|
Ran the Tested section's tests with the Khronos validation layer on Linux and an NVIDIA GPU at the current head, with and without Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor Then the same command again with
No new AI-assisted: yes (Claude Code) |
21a7c65 to
7b5169b
Compare
7b5169b to
967a12d
Compare
MarcZX10
left a comment
There was a problem hiding this comment.
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 through repo_read.py.
Results
| Check | Result | Note |
|---|---|---|
| Source review | failed | Found a command-buffer reuse defect |
| Build and tests | not run | Author-reported Windows GPU run is not independently verified |
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
- Read the complete diff and full head text for the changed driver and documentation files except
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. - Did not independently verify author-reported build, GPU tests, CI state, or merge-base claims.
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.
|
This passed review on 967a12d, but it now conflicts with main in Recorder.hpp, Draw.cpp, DepthPlaneSampling.cpp and 1 more. Please merge main into the branch and push; it goes back to the merge queue on the new head. |
…RALLEL_ATLAS Opt-in and off by default. A per-device worker pool records single-sample depth-only draws into secondary command buffers that the recorder executes in draw order; a pass begun for secondary contents never takes inline draws and the reverse. The pool is slower per draw than inline recording in the synthetic depth-plane benchmark, so the flag stays off until the assembly moves to the end of the pass.
967a12d to
c40dcb5
Compare
|
Rebased onto main (1afab89). Conflicts resolved in:
Force-pushed to rearch/parallel-draw-main. CI should pick it up and the merge queue will re-evaluate. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
Changes are required before merge: remove the unresolved merge-conflict markers from the changed source and documentation files.
What I ran
- Reviewed head
c40dcb5d1537e08c5d26b6075e92f712e8d82e54usingrepo_read.pyto inspect the prepared diff and repository files. - No build or tests were run during this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff and manifest | passed | 16 changed files listed |
| Conflict marker search | failed | Markers found in three changed files |
| Build and tests | not run | No checks run during review |
Findings
Blocking
- Literal unresolved merge-conflict markers remain in
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
- Build and test behavior was not run.
- The full text of
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. - Other changed files whose full text is in
review/files/were not all read in full; review focused on the pool implementation, draw path, assembly helper, and conflict locations. - Description-reported CI and GPU test results were not independently run for this review.
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.
|
@Logan1h the rebase commit still has conflict markers, so this head does not compile:
After that the rest of the PR is the same as the head that passed review, so I only need to look at the resolution. |
- Recorder.hpp: keep main's three declarations + add secondaryContents param - Draw.cpp: keep HEAD's DrawStageTimingEnabled timing, remove duplicate timeEachDraw/eachDrawTiming - ENVIRONMENT.md: keep both APS5_PASS_STAGING and APS5_PARALLEL_ATLAS
|
Rebase conflicts resolved:
Force-pushed to . CI should pick it up. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
The changed depth plane sampling test refers to stencilValue after removing it from DrawDepth’s parameter list, so the test cannot compile.
What I ran
Reviewed head 960a77e61617169d0e43af858293f84c2f0b3560 using the prepared diff and the pinned repo_read.py reader. No build or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff review | passed | 16 changed files inspected |
| Build and tests | not run | No commands run |
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.cpp and core/libs/prx/libSceAgcDriver/tests/Recorder.cpp as excluded from the review folder. Targeted head ranges were read in Draw.cpp, Pipeline.cpp, Recorder.cpp, RecordingPool.cpp, VulkanDevice.cpp, and DepthPlaneSampling.cpp; the added OrderedAssembly.hpp was read in full.
To get this to a good state
Fix the stale stencilValue references, then build and run the affected tests on the new head.
|
@Logan1h the markers are gone and Recorder.hpp and Draw.cpp now match what I described.
Please keep main's six constants, move the |
- Restore main's six Stencil*Offset constants (StencilArrayDepthOffset through StencilCubeOffset) - Move Parallel* constants after StencilCubeOffset (0x840000+) - Fix DrawDepth signature to match main: (swizzle, stencilAddress, stencilValue, depthOnly, waitIdle) - Update all ParallelAtlasCase calls to use new signature with named parameters - Fix typo: std::.uintptr_t -> std::uintptr_t
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The reviewed change at 7f46b210c7170bd1d854bed993162c9b77ec5a1b adds 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
| Check | Result | Note |
|---|---|---|
| Diff and targeted source review | passed | Reviewed changed code paths |
| Build and tests | not run | Author-reported results are not independently verified |
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.- I did not run a build, tests, Vulkan validation, or hardware checks. The test and hardware results in the PR description are author-reported.
- Other files in the diff were inspected at changed ranges or relevant functions, rather than read in full.
To get this to a good state
Nothing is required.
19697 MarcZX10 CR 6063767599 (25 Nov 19:31Z on 960a77e): met
Claim: DrawDepth lost its stencilValue parameter while its body still uses it (compile error).
Live head 7f46b21, core/libs/prx/libSceAgcDriver/tests/execution/DepthPlaneSampling.cpp:196 declares std::optional<std::uint8_t> stencilValue = std::nullopt, used at :249-251. The file compiles as written.
PASS HIGH YES by pr-review1 on 7f46b21 at 26 Nov 02:33Z, after the CR.
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 — fix(agc): preserve CPU writes after resident linear target draws #8246 (Draw.cppL3090-3091), perf(agc): reuse a cached resource build that samples a texture remade per use #10894 (DepthPlaneSampling.cppL6-7, L76-77), feat(agc): group GPU draw timings by complete shader stage sets #15572 (Draw.cppL3194-3199), fix(agc): bind memory only for the backed slices of a depth plane copy #22531 (DepthPlaneSampling.cppL77), fix(agc): take 16-bit depth bias units exactly on float depth targets #24327 (Recorder.cppL1665-1668), fix(agc): replay stencil reference exports of indirect draws #24572 and fix(agc): check stencil replay depth feedback against buffer descriptors #24735 (Draw.cppL3206) — and 121 unconfirmed (their heads conflict with currentmain, so the tool cannot project their lines). Among the unconfirmed, perf(agc): record Vulkan draw commands on an encoder thread #17943/perf(agc): record transfers in the encoder stream without waiting #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)