feat(agc): count why draws begin render passes #11361
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11361"
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 johandavidcm on 2026-10-26T08:29:08Z.
What
The
[draws]line counts how many render passes the recorded draws began and how many continued the open one, not why a draw could not continue. Yakuza 0 Director's Cut (PPSA31327) records about 1,000 passes per frame, one every 8 draws; each break costs the pass's attachment store and load and twoALL_COMMANDSbarriers (the pass end, the next pass's leading barrier), and which of those breaks a change could avoid is not visible in any line today.Recorder::StartDrawPassreturns why the draw begins a pass (PassBreak, next toPassHazardinPassHazards.hpp): the batch is new (the first draw of a batch, also after a submit), a non-draw command, a label store, the sample counter or a sample segment closed the previous pass, the draw asked for a pass of its own (forced), the pass key differs, or one of the sixPassHazardvalues. The batch remembers which caller closed its last pass (RenderPass::closedBy, set byendOpenRenderPass), so a draw that finds no open pass names that caller.Drawkeeps the reason in the draw's outcome; the[draws]line prints the non-zero reasons of the 10 s window in parentheses afterrender passes N begun, andGraphics::DrawPassBreaks()returns the cumulative counts, asDrawPassTotals()does for the pass counts.StartDrawPassalready makes; the change records which branch was taken. No environment variable is added.In PPSA31327 (Kamurocho gameplay,
APS5_PROFILE_DRAW=1,APS5_DRAW_PIPELINE=1 APS5_DRAW_INPUTS_IN_PLACE=1), one 10 s report of the[draws]line now reads, in the part this changes:Over the last four reports of the run, 77 % of the passes begin because the pass key differs, 14 % because the batch is new, 8 % on an image hazard and 1.5 % after a non-draw command. With
APS5_BATCH_CAP=0the new-batch breaks fall from about 6,300 to 1,100 per 10 s and the key breaks stay at about 35,000, so the batch cap is not where most passes end.Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, head 57cb47b6b onmainf616a1397.New test
agc_driver_pass_break_reasons(tests/execution/PassBreakReasons.cpp): six draws through aRecorderinto four-sample color and depth targets, readingDrawPassTotals()andDrawPassBreaks()around each: the first draw of a batch (new batch), the first draw afterSubmit(new batch), a draw with the open pass's key and no hazard (continued, no reason counted), a draw afterCommands()ran for a non-draw command (command), a draw that keeps the color target and switches depth targets (image: the shared multisampled attachment), and a draw into targets the open pass does not touch (key).StartDrawPassreportingkeyfor every draw that finds no open pass (theclosedByread replaced by a constant), it fails withthe first draw of a batch was not counted once as 'new batch': 1 begun, 0 continued; key 1.--repeat until-fail:20.Pass with the change:
agc_driver_address_passes,agc_driver_address_passes_targets_split,agc_driver_multisampled_pass_order,agc_driver_pass_input_hazard,agc_driver_pipelined_metadata_pass,agc_driver_pipelined_metadata_pass_draw_pipeline,agc_driver_presentation_pass,agc_pass_hazards,agc_driver_graphics.With
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan SDK 1.4.363.0; the loader log shows the layer inserted),ctest -R <those tests> -Vpasses onmainf616a1397(9 of 9) and on the change (10 of 10, with the new test); both logs showInsert instance layer "VK_LAYER_KHRONOS_validation"(VK_LOADER_DEBUG=layer), neither containswas not found but was requested by env var VK_INSTANCE_LAYERS, and neither contains aVUID-line (0 onmain, 0 on the change).PPSA31327 01.015.000, gameplay in Kamurocho, scripted boot through the first dialogue, on
main6cd36e651+ #8098 + the port of #6192 with and without this commit (the same base on both sides; only this commit differs):APS5_PROFILE_DRAW=1) for the line above, and one withAPS5_BATCH_CAP=0.APS5_DUMP_FRAMES=600, every 40th frame) at the same points of the scene match between the two builds: the intro, the title screen and two gameplay frames in the street.APS5_PROFILE_DRAW, so the clean runs execute the same work; the difference is within this scene's run-to-run spread (up to 15 ms between runs of one build).Not a performance change; no A/B pairs.
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-10-26T08:41:51Z.
Review: APPROVED
Reviewed exact head
8717b03c1c8ffbedfcb75fa7bae493e9edb57b5fagainst currentmain204c6747d0a1cbaf932def3dea0778810cc3935e. This is instrumentation-only: each close path records its reason, the next draw consumes that reason, and continued draws are excluded from break counts. The reporting window snapshots cumulative reason counters, and the unit test checks both reason deltas and pass/continuation deltas. I found no behavior change or blocking issue in the diff.The author reports nine existing Vulkan tests pass on baseline and ten on the change, with the new test repeated 20 times, validation layer loaded, and no VUID output. The title run and GPU are also described in the PR. I did not independently run the Windows/Vulkan suite or title. Hosted eligibility, conventions, intake, labels and report checks pass; build/product jobs are skipped by path policy. The branch is 3 commits ahead of current main, has a clean merge preview, and main has not changed the touched paths since its base.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T10:03:28Z.
Review: DISMISSED
The instrumentation diff and the author-reported paired Vulkan-validation/title tests were reviewed on the earlier base
19af7f44e4. The exact head is still8717b03c1c8ffbedfcb75fa7bae493e9edb57b5f, now 116 commits behind currentmain5b5d24cb22. The merge preview is clean, the six changed paths have no main-side edits since the merge base, and current-main conventions and diff checks pass. However,CONTRIBUTING.mdrequires branches based on currentmain; please rebase/sync and rerun the focusedagc_driver_pass_break_reasonsvalidation-layer test on the resulting head before approval. The previously reported Windows/title runs remain useful evidence but do not cover that new head. Hosted policy checks pass; product jobs are skipped by path policy.