perf(agc): draw finisher pipeline (APS5_DRAW_PIPELINE) #6946
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6946"
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 Raghav314 on 2026-10-16T20:49:40Z.
What
An opt-in draw path,
APS5_DRAW_PIPELINE=1, that takes per-draw work off the queue worker. Meant withAPS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1(both onmain). Based onmaina6dcea927; #9508 (descriptor heap) is stacked on it.main's second-sight admission is replaced in place when the same read user words are seen twice.WRITE_DATAandRELEASE_MEMlabels queued while the finisher holds draws go through its queue instead of draining it, and aWAIT_REG_MEMon them stays beside it.Always on, with the same results: the draw resource key is built in place with a per-result memo, a vertex stage's attribute and buffer table words are read in one read, and the pending storage-image check skips ranges the pending set cannot overlap.
APS5_VERIFY_DRAW_PIPELINE=1runs the full checks next to the reused proofs and counts differences ([epoch-proofs]).APS5_PROFILE_DRAW=1finishes every draw on the worker, so it cannot measure this switch.PPSA36082 (Hades II)
The hub, player standing still,
APS5_TRACE_SECONDS=120:10,APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1. Caches warm (each setting run once into the hub, then the title restarted), no otherAPS5_TRACE_*orAPS5_PROFILE_*switch, log not redirected. Currentmainstops Hades II while the hub loads, so both builds have #6300 merged locally. The switch-on build is the head of #9508, which contains this PR, with the heap switch off.maina6dcea927+ #6300APS5_DRAW_PIPELINE=1+25% frame rate.
Summary lines, traces and digests
main+ #6300:APS5_DRAW_PIPELINE=1:Traces:
aps5-trace-de49f41349a9-624652.json.gz
aps5-trace-568369d27a2e-626697.json.gz
seconds 120:10 from present 8859: 706 presents, frame p50 14.0 / p90 15.7 / p99 18.7 / max 25.1 ms, GPU busy 2.2 ms per present
NVIDIA GeForce RTX 4090, NVIDIA 615.78.08, Linux 7.2.10-1-cachyos, 1920x1080, commit de49f41349a9, dropped: yes
Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 3.6, Driver.Packet.draw 3.5, Driver.Draw 3.4, Graphics.Draw 2.5, batch 2.2, Graphics.Draw.draw_and_resource_release 1.6, Driver.Draw.shader_compile_and_link 1.4, Recorder.Sync 0.3, VideoOut.Flip 0.3, VideoOut.Flip.present 0.3
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
seconds 120:10 from present 10851: 886 presents, frame p50 11.2 / p90 12.1 / p99 13.7 / max 41.2 ms, GPU busy 2.3 ms per present
NVIDIA GeForce RTX 4090, NVIDIA 615.78.08, Linux 7.2.10-1-cachyos, 1920x1080, commit 568369d27a2e, dropped: no
Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Graphics.Draw 2.6, Driver.Packet 2.4, batch 2.3, Driver.Packet.draw 1.9, Driver.Draw 1.8, Graphics.Draw.draw_and_resource_release 1.8, Driver.DrawFinish 1.7, Driver.DrawFinish.draw_enqueued 1.0, Driver.Draw.prepare 0.9, Driver.Draw.draw_handed_off 0.5
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
Tested
Linux (CachyOS), x86-64, GCC, 7800X3D / RTX 4090, NVIDIA 615.78.08, on
maina6dcea927.agc_driver_sample_order,agc_driver_sample_order_grid_referenceandagc_driver_sample_order_recipe_depth_locations, which fail the same way onmain. Conventions pass.*_draw_pipeline).agc_driver_pipelined_metadata_pass,agc_driver_program_writes_memory,agc_driver_draw_data_hit_user_words_refresh,agc_driver_draw_finisher_trace,agc_driver_finisher_label_order.agc_driver_address_passesexits cleanly again, as onmain.Known limits
Why this is one PR
In Hades II the parts on their own made the frame rate worse: the finisher alone made the committer the limit, which the commit trims and epoch proofs fix, and the faster worker dropped data-only stage reuse to 17% until the shape refresh brought it back to 83%.
Testing other titles
Please post:
APS5_TRACE_SECONDS=70:10, captured as the Performance report form describes) with and withoutAPS5_DRAW_PIPELINE=1, both withAPS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1and nothing else changed;APS5_VERIFY_DRAW_PIPELINE=1, the last[epoch-proofs]line (a nonzero "differed" or "failed" count is a bug).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 TideOPL on 2026-10-16T21:56:45Z.
Tested on Minecraft Dungeons II (PPSA16064, UE).
Setup
mainbc3c0fc13+ #6947's head ddb3938e0, which carries #5656, #6632 and this PR, plus #5372. #5372 keeps this title out of a slow mode where one buffer is copied on every draw, so the runs are comparable.APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1 APS5_TRACE_SECONDS=70:10 APS5_TRACE_EVENTS=1048576.APS5_DRAW_PIPELINE=1APS5_DRAW_PIPELINE=1 APS5_GPU_HEAP=1Draw pipeline. It doesn't speed up this title.
memory_waitfor the compute queue (worker 0x20, 99.5% busy), and that isn't on the path this PR moves.Rendering. Nothing renders wrong in either mode. We took screenshots every 3 s over 90 s of gameplay in each run: no missing textures, no flicker, and no red artefacts. Frames match the base build.
First boot with an empty shader cache. With
APS5_DRAW_PIPELINE=1 APS5_GPU_HEAP=1andANYPS5_SHADER_CACHE_DIRset to a new, empty directory, the first boot reached gameplay on the first try: title at 23 s, gameplay at 90 s, 919 misses in the first 10 s.Unrelated failure in the base mode. The base mode (
APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1without the new switches) aborted twice during gameplay withcompute shader 0x16000c4400: AGC graphics: storing storage image results pending over mem…, then completed on the third boot. Neither new mode hit it in these runs.Heap verify lines are in #6947.
Summary lines (second run of each)
Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-16T21:58:35Z.
Review: COMMENTED
Measurements are there and the numbers are good (469 to 807 presents in 10 s, p50 21.1 to 12.2 ms, p99 also lower). Three things before this can be judged.
agc_driver_draw_cache_relocationfails with the switch on. A path that breaks an existing test should not become a default. Make the walk fall back to the relocatable capture when the cache has relocation enabled, or document which titles need relocation.It is also stacked on #5656 and #6632, so the diff shown here includes their commits. Rebase after they land so only this PR's two commits remain.
Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-16T22:39:36Z.
@CnRJay thanks for the review.
"Menu". That was a poor word on my side. The scene is not the main menu: it is the item pickup UI in a level, which is the heaviest scene I found in Hades II. The hub holds a steady 120 fps and normal gameplay runs at 100 to 120 fps, so the pickup screen is where the worker is the limit and where the difference shows.
A gameplay trace with both switches (combat in a room, 15 s window, same machine, display at 120 Hz):
So in combat it sits at the vblank; there is no headroom left to show a difference there on this machine. I have not yet repeated the pair to show the spread.
Splitting. The parts depend on each other in Hades II:
main's second-sight admission left shape entries at old draws, and data-only reuse of vertex stages fell from about 80% to 17%. The shape refresh brings it back to 83% (hub 108 to 117 fps).APS5_VERIFY_DRAW_PIPELINE=1checks the walk against the IR evaluator.So each part could be measured against its predecessor, but the first ones would land as regressions. That is why it is one switch.
I will rebase so only the two commits remain once #5656 and #6632 land.
LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T00:54:55Z.
@TideOPL's run is the first outside Hades II: on Minecraft Dungeons II at 4K the draw pipeline doesn't help (queue 0 waits about 53 ms per frame on the compute queue) and nothing renders wrong. @CnRJay's asks stand: a gameplay pair with its spread, each part measured against its predecessor so they can land in order, and
agc_driver_draw_cache_relocationfailing with the switch on. To those we'd add an OFF-vs-main summary pair and a full ctest on the current head, a throw whenDrawFinisher::Drain,Settleor the full-queue wait inEnqueuerun under the GPU lock, and a failed finisher job reported against its own submission. Keep it a draft; it can't land before #5656.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T04:15:27Z.
Review: DISMISSED
Linux, RTX 5080 (driver 615.78.08), Ryzen 7 7800X3D. Base is
main2fab88d10with 5656 and 6632 as in the body, then 6946 at f8192a64b3, all withAPS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1, warm cache, two 10 s traces each.APS5_DRAW_PIPELINE=1Captures match the base in both, and a burst of consecutive Playroom frames shows no glitch. On a Radeon 680M (RADV) Playroom is GPU-bound and the same: 42 base, 43 and 39 with the switch.
One test fails with the switch. In the full ctest (1364 tests)
agc_driver_draw_cache_relocationfails 5 of 5 runs withAPS5_DRAW_PIPELINE=1on 6946 and passes 5 of 5 on the base:with graphics pipeline libraries: the draws that teach the moved pointer and its contents made 0 hits and 1 inserts, expected 0 and 2Without the switch the suite fails only where the base fails too:
agc_driver_store_over_untrackedfails 5 of 5 on the base itself, not from this PR. It passes 5 of 5 on currentmain0906c64501with 5656 or 6632 merged alone, so it only shows on the older base.Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-17T04:22:36Z.
007 First Light (PPSA11386 v01.018.000), 4K output, as asked on Discord. The heap runs are on #6947.
Setup:
mainbc3c0fc13, plus the four open PRs this title needs to boot (#5799, #6317, #6332, #6881), plus #6947's head ddb3938e0 merged in, which brings this PR's f8192a64b and its copies of #5656 and #6632. No other local changes. The title's executable is not patched (no #6172 change). Scripted pad input goes throughAPS5_PAD_INPUT_FILE, and every run starts from an existing save.APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1, with the shader cache and pipeline journal copied from a warm-up run with the switches off. The base run hit every cached shader (2,193 hits, 0 misses). WithAPS5_DRAW_PIPELINE=1, none matched (0 hits, 2,193 misses), and all were translated before the trace window.APS5_TRACE_SECONDS=1320:60withAPS5_TRACE_EVENTS=1048576, and the input reaches the menu before the window opens.APS5_DRAW_PIPELINE=1, run 1APS5_DRAW_PIPELINE=1, run 2Shader.DrawStage.capture_resources1,062 ms in the base,Driver.Draw.prepare1,065-1,089 ms with the draw pipeline. Another 0.34-0.39 s goes to dispatches.Driver.Packet.memory_wait.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-17T07:59:03Z.
A repeat on the current head (d63a8044f, with the Windows fix), next to #6949 which prepares draws on a thread pool. Hades II (PPSA36082), the level's item pickup UI, Linux, RTX 4090, 7800X3D, NVIDIA 615.78.08. All three builds are
main2fab88d10+ #5656 + #6632; #6949 is a local cherry-pick ofe2d9ac88conto it.APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1 APS5_HOST_IMPORT_MIB=6784, warm shader cache, trace70:10, one run each:APS5_DRAW_PIPELINE=1APS5_DRAW_PREP_THREADS=4The earlier run on the pre-rebase head gave 807 against a base of 469, so the gain repeats (+72% then, +65% now). In this scene #6949's pool keeps no draw in flight (
avg 0.0 in flight, the worker waits for it to empty about 13,000 times a second), so it does not add to this path yet; details are on #6949. The two PRs change the same part ofDriver::draw, so they conflict.LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-17T08:44:13Z.
Besiege (PPSA20313), Windows, RTX 4070 SUPER, Ancient Grounds sandbox (about 1000 draws per frame), head f8192a64b with APS5_DRAW_PIPELINE=1 on top of current main: 17.0 -> 20.0 FPS (three alternating runs each: 17.3/17.2/16.6 before, 20.3/19.8/20.0 after). A 10 minute run in the level on top of other open perf PRs had no errors and the frame looks the same.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T08:46:50Z.
Rebase handoff — rebased onto current
main(all nine commits, authorship unchanged; this PR is the lower half of the #6947 stack, so its commits re-anchor that series too). The conflict indocs/user/USAGE.mdkeeps your Draw-pipeline section alongsidemain's newer Texture-cache-budget section.Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV):tools/check_conventions.py --base origin/mainpassesmainregression (agc_driver_tessellationsegfault, #4727), not this PRTo pick it up:
Head is
c17fe7fa2.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T13:49:40Z.
We checked 5e45089b1: only 805774ead46 changed, and it resolves correctly against the committer Stop from #6641.
One low-priority follow-up, affecting
APS5_DRAW_PIPELINE=1at exit only:DrawFinisherisn't drained beforeQueue0().Stop(), and aProcessShutdownduring a submission skips its drain. AfinishDrawjob can then run afterdevice.Reset(). Draining the finisher before the queue stops would close it.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-17T14:19:10Z.
A macOS build fix for this PR, as a ready commit in case it's useful.
What fails. Apple clang's libc++ has no
std::atomic<std::shared_ptr<T>>. The recompiler headers stop atstd::atomic's static assertion, "std::atomic requires that 'T' be a trivially copyable type", on this line inResultKeyMemo:core/shader/recompiler/Recompiler.hpp:647:mutable std::atomic<std::shared_ptr<const std::vector<std::uint32_t>>> words;request_serializer_tests.The commit: 8a97b049c4 on
exp/pr6946-atomic-memo-5e45089. It is one commit on this PR's current head, 5e45089b19.ResultKeyMemo::wordsbecomesAtomicSharedPtr<const std::vector<std::uint32_t>>, fromprx/libc/include/general/AtomicSharedPtr.hpp.std::atomic<std::shared_ptr>,AtomicSharedPtris that type.shared_ptrwith the sameloadandstore, so the uses inDraw.cppdon't change.shaderCacheKeySources, which the cache key's include check requires;request_serializer_testsgetscore/libson its include path.Runs on our fork. These use the full Build workflow on Windows and macOS. The fork has no Linux job; libstdc++ takes the
std::atomicbranch, as Windows' MinGW build does.relinker (macos-latest, clang++)fails at the assertion above (job).request_serializerincluded (job).The commit also cherry-picks cleanly onto #6947's head cae12b7d51, so #6947 gets it through the stack. Take it as is, or fix it your own way. If either head moves again, we can redo it there.
Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-17T14:39:27Z.
@oneandonlydean thanks, you're right. The finisher is only drained at the end of a queue 0 submission, so a ProcessShutdown in the middle skipped it.
Driver::stop()now drains the finisher after the workers are joined and beforeQueue0().Stop(), so the committer is still there for any finishDraw that commits, and nothing runs afterdevice.Reset()(19ae93210).LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-17T14:39:28Z.
@EagleBearerYS thanks for this, and for the fork runs. I took 8a97b049c4 as is (now b31be5ae7 after a rebase on main), with you as the author. On Linux it is still std::atomic, so nothing changes there. #6947 has it through the stack.
LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-17T18:20:40Z.
Metal Gear Solid 4 (PPSA18194, Master Collection 1.004.003), gameplay after loading a save (Snake idle by the truck), plus two lighter scenes for contrast.
Setup
e09dbc2b4+ a few open PRs) merged with main82f0c9aec, then this PR's 11 commits at b31be5ae7.APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1 APS5_PIPELINE_STATS=1; arm B addsAPS5_DRAW_PIPELINE=1. 540 s runs, FPS from the window title over the last 150 s of gameplay.APS5_DRAW_PIPELINE=1)[finisher]per 10 sAbout +20-25 % on this scene. One run per arm, but the ranges barely overlap. The picture is identical (same spot, same HUD), no device faults, no failed commits.
Lighter scenes, no change (same build and env, warm runs):
Note on measuring:
APS5_PROFILE_DRAW=1turns the hand-off off (handOffinDriver::drawrequires!profile). Our first pair of runs used it and showed0 handed to the draw finisher. In that pair, with only the reused epoch proofs and the straight-line SRT walk active, the committer cost went from 48.9 to 44.3 us per commit (lookup 1.48 -> 1.20 s, resources 1.00 -> 0.69 s per 10 s), with FPS flat.APS5_PIPELINE_STATS=1keeps the[finisher]counters without disabling the hand-off. A line in USAGE.md would save others the same detour.Measured with AI assistance (Claude Code); runs, logs and numbers are from our machine.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-17T18:20:42Z.
Two of the new tests do not build with MinGW-w64 (WinLibs GCC 15.2, Windows) at b31be5ae7:
tests/execution/DrawDataHitUserWords.cpp:221near(andfar) are empty macros from<windef.h>. Renaming the lambda (we usedcloseTo) fixes it.tests/execution/PipelinedMetadataPass.cpp:32COFF section alignment stops at 8 KiB, so
alignas(65536)on a staticstd::arrayis rejected. Allocating the surface at run time, for example withVirtualAllocon Windows (64 KiB granularity) orstd::aligned_allocelsewhere, avoids it.Everything else builds. The game libraries are unaffected; only these two test targets fail, which stops a plain
cmake --build.Found with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-17T18:43:15Z.
@Raghav314 the test from my review still fails on b31be5ae7.
agc_driver_draw_cache_relocationpasses 5 of 5 without the switch and fails 5 of 5 withAPS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1, on the RTX 5080 (driver 615.78.08) and on a Radeon 680M (RADV), with the same message as before:AGC graphics: with graphics pipeline libraries: the draws that teach the moved pointer and its contents made 0 hits and 1 inserts, expected 0 and 2Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T22:19:15Z.
#7184 has merged ("let a draw that only reads through the BDA table continue its render pass"). It adds the read-only rule this PR also carries. Could you rebase onto current main and drop the duplicate read-only rule from this branch? #6947 needs the same change.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-18T15:42:30Z.
@Raghav314 the two MinGW-w64 test build breaks from my earlier comment are still there at 0f093bec1:
tests/execution/DrawDataHitUserWords.cpp:221:nearis an empty<windef.h>macro (we renamed the lambda tocloseTo).tests/execution/PipelinedMetadataPass.cpp:32:alignas(65536)is over COFF's 8 KiB section limit (a run-time allocation,VirtualAllocon Windows, avoids it).The libraries build; only these two test targets fail, which stops a plain
cmake --buildon Windows.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-18T16:00:49Z.
@fma-rc b31be5a still had the straight-line SRT walk. It records every user word it reads as a value word, so the draws it captures are never relocated, and that is what
agc_driver_draw_cache_relocationcaught. The rebase dropped that commit (main now replays SRT walks from the #6095 tape). On 0f093be the test passes 5 of 5 here withAPS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1(RTX 4090, 615.78.08). An older build that still has the walk fails with your message.@ps54all the two MinGW-w64 breaks are fixed in 6a80154:
DrawDataHitUserWords.cpp: the lambda iscloseTonow.PipelinedMetadataPass.cpp: the surface and CMASK are views into one 64 KiB-aligned allocation made at run time (VirtualAllocon Windows,std::aligned_allocelsewhere) instead ofalignas(65536)globals.I have no MinGW toolchain here, so I could not build the Windows test targets myself.
LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-18T18:24:02Z.
Review: COMMENTED
@Raghav314 thanks, confirmed. On 6a80154945
agc_driver_draw_cache_relocationpasses 5 of 5 on each of RTX 5080 (NVIDIA 615.78), Radeon 680M (RADV, Mesa 26.2) and lavapipe, run withAPS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1. That was the failure behind my change request, so it is resolved from my side. I did not rerun the MinGW build ps54all mentions.Imported from boykopovar/AnyPS5. Originally posted by teepean on 2026-10-18T21:43:42Z.
A gameplay pair with its spread, from Stray (PPSA02100, Unreal Engine 4) on Linux. The finisher takes every draw here, but the worker drains it about every second draw, so it only pays when the process stays in one L3 domain.
Setup. CachyOS (kernel 7.2.10), Ryzen 9 9950X (two CCDs: CPUs 0-7/16-23 and 8-15/24-31), RTX 3090 (NVIDIA 615.78.08), GCC 16.2.1 Release, 3840x2160 and stock settings, standing still at the start of Dead City, scx_lavd (lavd 1.1.3, autopilot). The build is
maine1338ff5e+ this PR at 6a8015494 + #6501. The head is now599bff4a0, the same change rebased onto a newermain. Without #6501, Stray drains the draw pipeline for an occlusion counter dump about every second draw, which would leave the finisher nothing to overlap. Every arm hasAPS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1. One run at a time, a warm-up per build, then four alternating rounds. Frame times are fromAPS5_TRACE_SECONDS=185:20summaries."Placement" is a local change that keeps the whole process in one L3 domain (here CCD0). Under EEVDF the kernel does that by itself on this machine; scx_lavd spreads the threads over both CCDs.
Frame p50 / presents in 20 s, mean of four runs (range of presents):
APS5_DRAW_PIPELINE=1Why the gain is small. With
APS5_PIPELINE_STATS=1(placement, switch on, per 10 s), all 305,000 draws are handed to the finisher. The worker drains it 165,000 times at packets, about every 1.8 draws:EVENT_WRITE(0x46), the occlusion counter dumpsSET_UCONFIG_REG_INDIRECT(0x64)SET_CONTEXT_REG_INDIRECT(0x9f)DMA_DATA(0x50)RELEASE_MEM(0x49)keepsDrawPipelinestill treats it as a drain. So the finisher empties first, andDrawPipeline::Enqueuewould drain it anyway for any item the worker queues. I tried sending the dump through the finisher's queue instead, so it is committed after the draws it counts, with the dump range as its pending write (a local switch, not proposed). That only moved the drain: the 0x46 drains went to 0, theRELEASE_MEMafter each dump drained the finisher instead (76,000 per 10 s), and the frame rate stayed the same (140.5 ms / 141 presents in three runs, against 137.8 / 144 in two; a third run fell into Stray's ~1 FPS mode). So the labels the worker queues would have to go through the finisher's queue as well, not only the dumps.PendingOverlapsfound 82,000 overlaps per 10 s, all with a held draw markedunknownand none with known writes. Of the held draws, 27 % are "no variant (fragment)" inheldWritesand the rest "targets only". Bounding the writes of a draw whose fragment variant isn't chosen yet would let these packets pass.Two small things I hit:
APS5_PROFILE_DRAWturns the hand-off off (!profilein thehandOffcondition inDraw.cpp). A profiled A/B of the switch then measures only the always-on parts: my profiled pair handed 0 draws.APS5_PIPELINE_STATS=1keeps it on.[finisher-held]reasons are printed only underAPS5_PROFILE_DRAW(noteHeld), so with the hand-off off they never print.AI-assisted: yes (analysis and text with Claude Code; the runs are from my machine).
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T01:36:37Z.
Reviewing
599bff4afor a Windows/NVIDIA 007 cross-test after our current-main baseline finishes. Host: 7800X3D / RTX 5070 Ti 617.42 / 32 GiB. Our public integration is https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-oct18-resume-main (9f9a532b1 on main876bd17af), with shared image-table snapshot/resolution reuse and sparse relocation partitioning already carried. 90 selected native tests pass; current title run is warming the new format38 pipeline cache, so no baseline FPS number yet. Previous same-host moving menu was about1.9 FPS with ~178ms GPU busy per present; compute is a substantial limit too.GitHub currently reports conflicts against main for this PR and #6947. I will start with the finisher independently rather than mixing both into the baseline. If you already have a newer current-main rebase/WIP, a head would help avoid duplicating that integration work. Will report exact head, flags, official digests, and validation counters for any actual cross-test. AI-assisted: Codex; title data remains local.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T02:36:04Z.
Public Windows/007 integration WIP is up: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-finisher-oct19 at c37dc2640, merging your599bff4a (including #5656fe87a2c) onto our pinned7bdb95886/main324e0e48e stack. Building now; NOT native-tested or runtime-staged yet.
Seven conflict files resolved: owned DrawTail data and new finisher proof APIs retained; newer main fixed-size vertex-input read records and output bitmasks retained; our ProgramMemory/multi-stage indirect patches and QueryPendingSpan/shared-table validation retained; trace binding kept on the committer. The finisher's owned program copy is used for the handoff rather than main6312's conditional local reference.
Thanks to @teepean's note: APS5_PROFILE_DRAW disables handOff. The planned same-binary on/off comparison will leave that unset, use APS5_PIPELINE_STATS=1 with APS5_PIPELINED_DRAWS=32 and APS5_PIPELINE_DISPATCH=1 on both arms, and check nonzero handoff counters. Our7800X3D has one CCD, so the two-CCD placement issue should not apply. GPU profiling/official interval summaries remain available; no measured gain claimed yet.
Separately, new-main native deferral modes exposed a Windows two-logger failure; #7709 makes the flush helper reach the shared driver's logger, and29/29 related native controls pass. That fix is carried here. Our previous integration114/114 controls pass, but this WIP still needs its own tests. Raw title data stays local. AI-assisted: Codex.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T02:45:05Z.
Windows integration update: public head
6d6021bb0oncodex/first-light-finisher-oct19(599bff4amerged into our pinned 7bdb/main324 stack).APS5_DRAW_PIPELINE=1 APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1 APS5_VERIFY_DRAW_PIPELINE=1: draw-cache relocation, mesh relocation, user-word output, metadata pass. PROFILE_DRAW unset. No skipped cases.599bff4asource:DrawDataHitUserWords.cppstill names its lambdanear, which Windows headers erase; renamed tocloseTo(0ac751e35). Runtime-aligned metadata allocation was already present. The verify/refresh user-word CTest variants also lacked the Windows DLL PATH modification: both failed to launch with 0xc0000135; added them to the existing PATH property list (6d6021bb0). The initial selected run was 134/136; the final complete rerun is green. Neither fix changes production rendering or test assertions.007's same-binary OFF/ON menu comparison is starting now with PROFILE_DRAW unset and pipeline stats/32/dispatch1 on both arms. No title result or FPS gain claimed yet. Raw title data stays local. AI-assisted: Codex.
Test-setting correction before measurement: use APS5_PIPELINE_STATS=0, not 1. The new finisher counters use presence, while VulkanDevice enables expensive executable statistics only for the value 1. The first OFF startup was intentionally stopped before any menu measurement after detecting this overlap. The restarted OFF/ON pair uses 0 on both arms; no production change needed.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-19T03:07:14Z.
007 Windows cross-test finished: no clear finisher benefit in this menu.
Same binary and SHA-256-verified HLE cohort, public integration
6d6021bb0(your599bff4a, including #5656, merged onto our 7bdb/main324 stack). Windows 11 26200, Ryzen 7 7800X3D (one CCD), RTX 5070 Ti, NVIDIA 617.42, 32 GiB, Release, SPIRV tools OFF, 3840x2160 output. No #6947 GPU heap, title binary/time patches or affinity change.Both arms: PROFILE_DRAW unset,
APS5_PIPELINED_DRAWS=32 APS5_PIPELINE_DISPATCH=1 APS5_PIPELINE_STATS=0 APS5_PROFILE_GPU=1. The finisher counters check presence, so 0 still enables them, while avoiding Vulkan executable statistics (which require the value 1). First stats=1 startup intentionally stopped before any menu sample; it is excluded here. Also identical: draw cache1024, in-place draw inputs, resource cache16, host import4096MiB, texture cache2048MiB, local 16MiB import-window experiment and force-SDR. Settings JSON comparison confirms the only differences are DRAW_PIPELINE and trace output directory. Warm shader cache/pipeline journal; actual menu observed before selecting intervals.One OFF/ON pair, animated menu, no clock lock: the ~1.6% difference is not evidence of a regression beyond run-to-run spread, and there is no gain here. This isolates the switch on a combined stack; it is not an OFF-versus-pristine-main result. No missing textures/obvious rendering change observed in the sampled menu screenshots; no pixel/flicker equivalence or audio check claimed.
Handoff verified: ON menu intervals hand roughly9.3–9.5k draws/10s to the finisher, zero finished on the worker; about320–334 packet drains, all reported as opcode0x49, roughly28 draws per drain. OFF consistently reports zero handoffs. So this is not an accidentally disabled finisher test.
Important profiling gap:
DrawFinisher::runnever callsPerformanceTrace::BindThread, so its CPU scopes are absent from the trace. Frame/present/GPU totals above remain usable, but I will not infer the finisher's CPU cost from those phase totals. Proposed fix on separate public branch:https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-finisher-trace-oct19
3362ca612addsBindThread("draw finisher")and extends the existing synthetic tracing fixture with configured/unconfigured finisher cases. With unchanged production, only the configured finisher case fails:draw worker CPU spans are absent from the trace; other3 controls pass. One-line production fix gives4/4 PASS0.52s; committed-head trace/relocation/user-word/metadata controls with the switch+proof verifier ON give8/8 PASS2.63s. Unconfigured tracing still allocates no trace buffer. Conventions pass; not runtime-staged or title-tested. Feel free to fold that commit and the two earlier Windows fixture fixes into your next rebase.After timing, two bounded thread samples were collected, then Resume tested once with the same RAM guard. Still loading at the last observation. Exit03:03:22.637UTC, ~51.59s after Resume03:02:31.043: verified-runtime memory guard, after trim private30,179,135,488bytes (
28.11GiB), free5.20GiB, three trims total. Private crossed the28GiB guard; no logged fatal/quadtree exception and no cinematic verified. Not a crash/#6172 fix claim, and no controlled load-time comparison. Finisher stays out of our performance baseline.Official
tools/trace_digest.pyoutput for the measured windows follows. The largest CPU phase is inclusive across workers and lacks the unbound finisher as explained above. Raw title data/captures remain local. AI-assisted: Codex.OFF trace_digest
6 intervals, 267.4 to 328.9 s, 120 presents
NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit 6d6021bb0ab4
ON trace_digest
6 intervals, 268.4 to 329.8 s, 118 presents
NVIDIA GeForce RTX 5070 Ti, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit 6d6021bb0ab4
Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-20T00:18:37Z.
ASTRO BOT (PPSA21564), Sky Garden, Linux RTX 3080 Ti: a data point for the head before today's rebase,
d63a8044f, measured on its base2fab88d10(at that point it conflicted withmain). Progress save, default settings, hands off from the level start,APS5_TEXTURE_CACHE_MIB=2816on all three runs (otherwise the sampled texture cache thrashes there, #357). One run each.2fab88d10d63a8044f+APS5_DRAW_PIPELINE=1d63a8044fwithout itAPS5_DRAW_PIPELINE=1set,[finisher]reported 0 draws handed to it, and all ~167k draws per 10 s finished on the worker. Is there a condition in Sky Garden that keeps draws off it?fbe1f8b1e, on0d8c51a54) no longer carries some of what was under the finisher atd63a8044f: the hand-off spin is inmainvia #6632, andc5da616a4(straight-line SRT walk) is in neither. So the gain above may not carry over to the current head. I haven't measured it yet.AI-assisted; the runs are from my machine(s).
Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-20T01:05:54Z.
Follow-up on the current head
fbe1f8b1e, measured on its base0d8c51a54. Same machine and settings as above, but started straight into the level with-lvl underwater_aerial_garden(no input, so every run starts the same way),APS5_TEXTURE_CACHE_MIB=2816, 17 intervals of 10 s from the level start, run alternately.0d8c51a54fbe1f8b1ewithoutAPS5_DRAW_PIPELINEfbe1f8b1e+APS5_DRAW_PIPELINE=1[finisher]reported 0 draws handed to it on both pipeline runs, so the gain comes from what is active without it: capture 15.7 → 14.4 µs, recompile ~15 → 12.7 µs and the committer wait 8.2 → 6.5 µs per draw. The draw-cache hit rate is unchanged (~0.6%).AI-assisted; the runs are from my machine(s).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T01:53:25Z.
@mrfelek On the 0 handed to the finisher:
APS5_PROFILE_DRAWturns the hand-off off (it is only taken when profiling is off), and the[finisher]line prints only underAPS5_PROFILE_DRAWorAPS5_PIPELINE_STATS. IfAPS5_PROFILE_DRAWwas set in those runs, 0 is what it does, and the per-draw capture / recompile / committer-wait breakdown suggests it was. Please rerun withAPS5_DRAW_PIPELINE=1 APS5_PIPELINE_STATS=1andAPS5_PROFILE_DRAWunset, and paste the[finisher]line. Indirect draws are never handed off either, so if that level is mostly indirect, 0 can still be right after that change; the line should tell which.Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-20T10:29:32Z.
@oneandonlydean you were right, thanks:
APS5_PROFILE_DRAWwas set in those runs. Rerun onfbe1f8b1e(base0d8c51a54), Sky Garden via-lvl underwater_aerial_garden, no input,APS5_TEXTURE_CACHE_MIB=2816,APS5_PROFILE_DRAWunset, presents fromAPS5_TRACE_SUMMARY_EVERY=10(17 intervals from the level start), run alternately:0d8c51a54fbe1f8b1e,APS5_PIPELINE_STATS=1onlyfbe1f8b1e+APS5_DRAW_PIPELINE=1 APS5_PIPELINE_STATS=1So the hand-off works in this level, almost every draw goes to the finisher, and the switch adds about 1 present per 10 s on top of the rest of the stack here. The +20% over the base is mostly what's active without it. One run without the switch, so that last step is close to noise.
AI-assisted; the runs are from my machine(s).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T03:18:45Z.
@Raghav314 full CI on de31751e98 has one failure, on Windows only:
agc_driver_draw_finisher_trace(#974) is counted as Failed, and its only output is the stub's "skipped, this build leaves the test out with ANYPS5_AGC_EXECUTION_TESTS". Linux, both macOS relinker lanes and relinker-asan pass.The Windows job builds only part of
tests/execution. Every test it leaves out is built fromtests/ExecutionTestNotBuilt.cpp, which returns 77, so each test needsSKIP_RETURN_CODE 77for ctest to count it as skipped. The test added in "include draw finisher work in CPU traces" is registered by hand (core/libs/prx/libSceAgcDriver/CMakeLists.txt:2325-2327) and itsset_tests_propertieshas noSKIP_RETURN_CODE. The two_disabledvariants next to it have it (lines 2324 and 2333) and show as Skipped in the same run. AddingSKIP_RETURN_CODE 77to theagc_driver_draw_finisher_traceproperties should fix it:One more thing while you're in that file:
agc_driver_draw_cache_relocationisn't inagcDrawPipelineTests, so CI never runs it withAPS5_DRAW_PIPELINE=1. That is the test that caught the SRT-walk problem in the earlier change request. Adding it to the list would keep that covered.The rest of the delta from fbe1f8b1ec looks right to me: the shutdown release runs after the finisher drain and the committer join and before
device.Reset(), and the rebase resolutions match main.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T06:36:40Z.
@Raghav314, in case it saves you a round trip: oneandonlydean's two requests above are ready as two commits on top of your de31751e98, on
EagleBearerYS:fix/6946-finisher-trace-skip(6e9279bcef):SKIP_RETURN_CODE 77toagc_driver_draw_finisher_trace, so a Windows build that leaves the test out counts it as skipped;agc_driver_draw_cache_relocationtoagcDrawPipelineTests, so CI also runs it withAPS5_DRAW_PIPELINE=1.Tested:
-DANYPS5_AGC_EXECUTION_TESTS=F16ToF32Unpack;F64FmaSubnormals;RegistrationPrepareShutdown, soagc_driver_draw_pipeline_trace_testsis the stub.ctest -R '^agc_driver_draw_(finisher|pipeline)_trace(_disabled)?$'failsagc_driver_draw_finisher_tracewith "skipped, this build leaves the test out with ANYPS5_AGC_EXECUTION_TESTS", as in the Windows CI run oneandonlydean describes, and skips the other three.agc_driver_draw_cache_relocation,agc_driver_draw_pipeline_trace,agc_driver_draw_finisher_trace, both_disabledvariants and the newagc_driver_draw_cache_relocation_draw_pipelinepass. The new one passed 10 of 10.check_test_registration.pyandcheck_conventions.py --base de31751e98 --head 6e9279bcefpass.The branch fast-forwards from your head (
git pull https://github.com/EagleBearerYS/AnyPS5 fix/6946-finisher-trace-skip), or you can make the same two edits yourself, whichever is easier.Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-22T10:53:41Z.
@oneandonlydean @EagleBearerYS thanks, both are in. I took EagleBearerYS's two commits as they are (fast-forward to 6e9279bcef):
SKIP_RETURN_CODE 77onagc_driver_draw_finisher_trace, andagc_driver_draw_cache_relocationinagcDrawPipelineTests. Locally the relocation test, its new_draw_pipelinevariant and the four trace tests pass. #9508 is rebased onto it and also passes the newagc_driver_draw_cache_relocation_gpu_heap.LLM assistance used.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T11:27:50Z.
@Raghav314 a merge-order note for this PR and #9521 against several of ours, to keep it to one message. Ours go after this PR in each case, and rebase over it:
Draw.cpp): this PR changes the pipelined block's condition totail.queue == nullptr || deferredLabels().labels.empty(). #7446 adds a capture check inside that block:runCaptureCheckHook, then a redo underRecaptureScopewhen the captured memory changed. Composed: your condition with the check inside.DrawCacheStatistics.cpp): both extend the[draw-cache]line. Composed, it prints both sets of fields.ShaderResources.hpp): adjacent declarations, itsSpirvFaultReportOnlyand yourShaderStoresThroughAddresses. Both stay.DrawPrecheck.cpp): #6146 decodes the DB depth expand pass next to the colour metadata pass, in oneif (metadata || expand)branch, and this PR pipelines the colour metadata pass. Composed: a colour metadata pass takes your pipelined branch when it applies; otherwise it takes #6146's shared branch, like a depth expand. The include lines keep both.DrawPrecheck.cpp): only the include lines. Both stay.#9521 and #6682 (
UnitShadow.cpp) need more than a text merge. #9521 stores a completion-time publish on the CPU (PublishOnCpuScope, thenrecordCopiesOnCpu's guarded store at completion). #6682 adds awaitedargument toPublishShadow, so a publish made while a completion is being waited for goes ahead, instead of being skipped as a store-site read during completion. They change different steps: #6682 decides whetherPublishShadowpublishes, and #9521 decides howpublishUnitsrecords it. What we'd check in the composition is a waited publish inside aPublishOnCpuScope: its CPU store has to land before the waiter reads. Since #9521's review is still open, I'd propose #6682 goes first and #9521 rebases over it. If you'd rather #9521 went first, #6682 can rebase instead.Imported from boykopovar/AnyPS5. Originally posted by Raghav314 on 2026-10-22T14:15:41Z.
@EagleBearerYS thanks, the compositions match what this PR changes: the pipelined block's condition with #7446's capture check inside it, both field sets on the
[draw-cache]line, both declarations in ShaderResources.hpp, and the colour metadata pass taking the pipelined branch when it applies, otherwise #6146's shared branch.For #9521 and #6682: either order works for me, I'll rebase #9521 as needed depending on which merges first.
Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-22T15:00:06Z.
@Raghav314 MinGW confirm on the current head 19c55cd3d (on
main8b3e39832), Windows 11, WinLibs GCC 15.2.0 Release, RTX 3080 10 GB (NVIDIA 610.74):--target libscomplete with no errors. Only the usual libstdc++-Wstringop-overreadwarnings and one'NOMINMAX' redefinedinGuestFopenLongHostPath.cpp, whichmainhas too.ctest -j8: 1916 of 1921 pass, including all 22*_draw_pipelinetests. The 5 failures also fail onmainhere and do not come from this PR:pr_overlap_tools,check_main_sync: our git 2.30.1 has nomerge-tree --write-tree.agc_driver_sample_order,agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations: the NVIDIA failure tracked in #9056.I did not run a title with
APS5_DRAW_PIPELINEon this head.(AI-assisted: the build, tests and this comment were done with Claude Code.)