perf(agc): queue CPU-path indirect draws on the draw pipeline #6931
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6931"
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 AnthonyClemens on 2026-10-16T19:32:46Z.
What
CPU-path indirect draws (
DRAW_INDIRECT,DRAW_INDEX_INDIRECT,DRAW_INDEX_INDIRECT_MULTIwhose records the worker reads) drained queue 0's draw pipeline on entry and recorded every record on the worker. A title that draws mostly this way got no overlap between the worker capturing one draw and the committer recording the previous one.With this change:
DrawWriteRanges.APS5_NO_PIPELINED_INDIRECT=1drains at every indirect draw, as before.docs/dev/ARCHITECTURE.mddescribes the new behaviour in the draw pipeline paragraph.Related: #1896, a draft that pipelines both GPU-side and CPU-side indirect draws behind
APS5_PIPELINE_INDIRECTon an older base. This PR is the CPU-side half alone, on currentmainand on by default, measured on a title whose draws take that path. GPU-side indirect draws still drain here, so #1896's GPU-side part can build on this.Tested
Windows 11 (10.0.26200), AMD Radeon RX 9070 XT, AMD proprietary driver 26.9.1 (LLPC).
New test,
agc_driver_pipelined_indirect_draw(about 4 s). It holds the committer with a blocking item and checks two things:Each check fails with its half of the change reverted. With
APS5_NO_PIPELINED_INDIRECT=1, it fails with "the indirect draws drained the pipeline instead of queuing behind it". With the overlap drain removed, it fails with "the indirect draw whose record a queued label wrote: byte 0 is 64, the direct draw wrote 255". It passed 8 of 8 repeated runs.Existing tests:
agc_driver_pipelined_*,agc_driver_indirect_patched_stage,agc_driver_indirect_arguments_written_ahead,agc_driver_draw_write_rangesandagc_driver_draw_offset_indicespass.tools/check_conventions.pypasses.Performance: Resident Evil 2 (PPSA04288), opening cutscene, seconds 300–360 of the run, 3840x2160.
Current
mainstops at RE2's title screen about 35 s in: "shader 0x2073ceae00 stage 5: ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value". Local fixes that are not yet upstream get past it. So both captures come from one build of a local branch that carries this change and those fixes,c74326916c54. They differ only inAPS5_NO_PIPELINED_INDIRECT=1, which restoresmain's drain.The build is marked dirty because of an uncommitted diagnostic message in the draw cache's verify mode, which is off in both runs. Each capture followed a warm-up run of the scene. No
APS5_PROFILE_*or otherAPS5_TRACE_*switch was set.In this scene nearly every draw is a CPU-path indirect draw ("patched SGPR not folded" or "non-vertex path").
APS5_NO_PIPELINED_INDIRECT=1(asmain)Driver.Drawper frameOver full 900 s runs with
APS5_PROFILE_DRAW=1, the same section went from about 2,800–3,000 to about 3,400–3,800 draws per 10 s.Summary lines:
The first capture lost 282 worker events after 60.002 s, past the window's last present, so its totals are complete (
totals_full: false).Traces:
aps5-trace-c74326916c54-29376.json.gz(change off) andaps5-trace-c74326916c54-11312.json.gz(change on), attached.aps5-trace-c74326916c54-29376.json.gz
aps5-trace-c74326916c54-11312.json.gz
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 github-actions[bot] on 2026-10-16T19:43:27Z.
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.
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ARCHITECTURE.mddocs/dev/ARCHITECTURE.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ARCHITECTURE.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ARCHITECTURE.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppdocs/dev/ARCHITECTURE.mddocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mdImported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-16T21:58:37Z.
Review: COMMENTED
Good PR: small, on by default, with a test that fails when either half is reverted and a before/after on a title that takes this path (RE2, 123 to 134 presents in 60 s,
Driver.Draw423 to 283 ms per frame).Two things to tighten.
APS5_DUMP_FRAMES*set (frame dumping at 4x scale) and a dirty build. Dumping perturbs exactly what is measured, and p90 is not better (498 to 509 ms) while queue worker 0 stays at 98.8% busy. Please post a pair without the dump switches, and a second pair to show the spread. The p50 gain is there but the tail is unchanged, so "faster" should say p50.drawable()repeats the skip conditions of the record loop. If the loop skips a record for another reason (an index range, a rejected stage),lastDrawablecan name a record that never reaches the enqueue, and the last real record falls through to the inline path: correct, but without the overlap the PR is for. A test with a trailing zero-count record and one with a trailing out-of-range index would show that the last record that does draw is the one queued.Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T22:13:57Z.
Data point from a CPU-bound scene on Windows: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows,
APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1;mainbc3c0fc13vsmain+ this PR, interleaved with five other PRs in one batch, two rounds. FPS is the mean of the last 10[present]windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (45-47 ms of idle gaps per frame).mainWithin the run-to-run spread (about ±1.5 % here), no regression, 0 fatal.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by marco-scheffler on 2026-10-17T14:09:22Z.
Linux NVIDIA data point: Ubuntu 24.04.4, RTX 4000 SFF Ada Generation, driver 595.99.02, GCC 13.3.0, Release. This PR at
a00773731merged ontomainc9e6c45de, fullcteston the RTX (ANYPS5_GPU=RTX, Xvfb with-DANYPS5_VIDEO_OUT_TEST_DRIVER=x11): no new failures. The only failures,video_out_flip_eop{,_main,_aftergpu}(#6616) andagc_driver_{f16_fma,fma_mix_f16}_denormal_modes, fail the same way on thatmain(0/5 serial with and without this PR).Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T12:36:54Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T14:48:57Z.
Rebased onto current
main(only conflict: the adjacent ARCHITECTURE.md paragraph, both kept) and added the missingAPS5_NO_PIPELINED_INDIRECTrow todocs/dev/ENVIRONMENT.md, whichcheck_conventions.pyrequires. The drain/overlap condition, the inline-record ordering and the new test (fails with either half reverted) were checked; full ctest passes on the rebased tree; merged.