perf(agc): skip the queued-draw read check when a storage flush stores nothing #8911
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8911"
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 Celegans12 on 2026-10-21T05:48:41Z.
What
Since #6914,
StorageTexture::FlushPendingasksDrawPipeline::HeldReadsfirst on every call. That takes the draw pipeline's mutex and walks the read ranges of every queued draw. Most flushes come from sampled-texture lookups and storage refreshes over memory with no pending results, and those return false without storing or publishing anything, held or not. In a Yōtei profile on our tree the check cost the draw commit thread about 3.3 s per 120 s, 2.1 s of it in the winpthreads mutex.FlushPendingnow returns false before the check when nothing would be stored: no pending image with a unit in the range, none being flushed, and no unit shadow over it when the scope publishes. That's the same answer the old path gives in that case.HeldReadsfirst, so #6914's ordering is unchanged.DrawPipeline::HeldReadQueriesreturns the existing query counter, for the test.[storage]line's "held for a queued draw read" and "pretest skipped" counts no longer include flushes that had nothing to store.Overlaps: #6615 renames
refreshingtoRefreshing::Get(), which the new check reads too, so whichever lands second needs that one-word change. #6682 changesFlushPending's signature right next to these lines (textual only).Tested
-DBUILD_TESTING=ON, RTX 3080 Laptop, based onmain7ab4b2e561: ctest 1824/1828. The 4 failures (log_macros,log_macros_timestamps,guest_kqueue, andagc_driver_image_array_window_past_layer_limit, which doesn't compile with MinGW here) fail onmaintoo.agc_driver_queued_index_read_ordernow also flushes a range with no pending results while an image is pending elsewhere, and checks thatHeldReadswasn't asked. Withmain'sTexture.cppit fails: "a flush with nothing to store asked the draw pipeline for held reads".main: 1760/1780; the same 20 fail onmain(WSL has no userfaultfd write watching).main, with #8911, #8912 and #8913 switched on and off together in one in-run open-world A/B (9+9 phases): 6.17 vs 5.16 presents per 10 s (paired -0.95 +- 0.20 SE) for the combined set. This PR's own counter in that run: 948k flushes skipped the check in the on phases (a counter in our tree, not in this diff).mainvs this change, measured by @Dextroid17 (thanks), in this comment: Ghost of Yōtei title menu and loading, RTX 3080 Ti, Linux,APS5_TRACE_SECONDS=20:30, cleared shader cache, main/change interleaved three times each. Frame p50 160.1 vs 158.9 ms (mean of 3), GPU busy 75.4 vs 73.9 ms per present: within the run-to-run spread, so no speedup on that scene. The traces andtrace_digest.pyoutput are attached there. The two summary lines below are his medianmainrun and the closest change run. I only fixed thetitlefield, which the summary writer had double-encoded.aps5-summary.jsonl,main2b3baacdbaand #8911 bfd4634c88daChecklist
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-21T05:48: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 MarcZX10 on 2026-10-21T05:50:03Z.
Review: COMMENTED
The empty-flush fast path looks consistent with the existing pending-list and shadow-publication paths on inspection. One merge-readiness gap: the description reports a measured speedup, but CONTRIBUTING.md requires the
aps5-summary.jsonllines frommainand this commit for the same title/scene/machine, plus both traces andtools/trace_digest.pyoutput. The perf label bot has also requested those artifacts. Could you attach them (or remove the quantified speed claim if it cannot be reproduced)?Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-21T06:18:54Z.
@MarcZX10 thanks for checking the fast path against the pending-list and shadow-publication paths, that's the part I was most worried about.
You're right about the number. The only measurement I have is from our own Yōtei tree, not
main, and in it I switched this PR and #8912/#8913 on and off together, so it says nothing about this change alone. I've rewritten the speed line to say exactly that. The one figure that is specific to this PR is the count of flushes that skipped the check. I can't make a matchedmain/change capture right now, so the summary lines, traces andtrace_digest.pyoutput are still owed. I'll add them here when I have them, but I can't give a date.Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-21T08:45:50Z.
AMD / Linux data point for #8911, #8912 and #8913 together, on a different title. The result is neutral: no measurable change and no regression.
Setup: ASTRO BOT (PPSA21567) 01.019.000, level
underwater_aerial_garden(-lvlargument), Linux 7.2.10 (CachyOS), RX 9070 XT, Mesa 26.2.4 RADV, Ryzen 7 7800X3D, 32 GB, GCC Release. The game renders at 3840x2160. Headless gamescope,APS5_TRACE_SECONDS=90:50, 180 s per run, one untimed warm-up run per build.mainf894ba69d+ #7844 (merge3def32090). #7844 is included because without it this level runs at ~830 ms/frame on this machine.521a161bc, all three merged cleanly)Runs were interleaved: base, change, change, base.
The p50 difference (~2-3 %) is smaller than the spread between the two base runs. The change-1 p99 includes the first present of the window (753.8 ms), which is a load spike.
From
trace_digest.py, the draw committer is not the bottleneck on this title. It is busy 30.5 ms per frame on base and 33.9 on change.queue worker 0x0is at 99 % in both, dominated byDriver.Draw.shader_compile_and_link(140.6 vs 143.2 ms per frame). That explains why the set has no effect here. #8913's rebind path is described as coming from #6763's NVIDIA draw-input copies, so it is probably not reached on RADV at all.Both builds ran 3 × 180 s with no device lost, no amdgpu kernel messages and no new exceptions.
Not tested: the PRs one at a time, NVIDIA/Intel, CTest.
Tested and written by Claude (AI assistant) on a contributor's machine.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T23:19:24Z.
Windows measurement of this change, for reference. Setup: AMD Radeon RX 6700 XT, AMD driver 26.10.1, Windows 11. Spirit of the Island (PPSA13934) title screen,
APS5_TRACE_SUMMARY_EVERY=10, mean p50 of the nine 10 s intervals after loading. The builds aremain0c6a5bd59and this PR merged onto it, alternated:mainOn that screen, most of the remaining
HeldReadstime on Windows wasgetenvitself. #9490 reads that variable once, and it composes with this PR. Built together, they measured 107.2 and 107.0 ms on the same base. I did not run the test suite on this PR here; these are frame-time runs only.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-22T09:49:27Z.
I measured this one on its own now, as asked on #8912. Plain main can't take Ghost of Yōtei to the open world: its loading screen stops presenting after about 160 s and the game later aborts on a blend into a 10_11_11 unorm target that main doesn't support. So this is our tree (our local merge with main of 2026-10-21) with only this PR's switch flipped every 60 s in one run (
APS5_NO_HELD_READ_SKIP), which keeps the scene and session the same for both halves.With the skip on I got 6.16 presents per 10 s against 5.61 with it off. Paired against the neighbouring phases that's -0.35 +- 0.30 presents with the change off, so about 1 SE: a lean in its favour, not a result I'd call measured. Committer time per commit didn't move (316 vs 310 us). What it clearly does is the thing it says: per phase, about 858k storage flushes skipped the queued-draw check with it on against 44k off, and the flushes that held for a queued read dropped from about 104k to 5k.
I also tried a boot-scene pair on plain main, but those captures turned out to be pipeline-cold on this machine, so I'm not quoting them. If you'd rather see a longer A/B to tighten the error bar, I can run one.
Details
Run
pb-8911, our local merge with main557682ca44, warm caches (NVIDIA pipeline cache readable, dictionary checked before the run), web-teshio-b save, 1,300 s cap,APS5_AB=60:APS5_NO_HELD_READ_SKIPfrom present 760, RTX 3080 Laptop (610.62), Windows 11. B = the switch set, i.e. this PR's change off.Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-22T14:48:28Z.
A measurement that bears on how this change and #9490 split the held-read cost, from ASTRO BOT (PPSA21564) in the Crash Site hub. Setup: Windows 11, Ryzen 7 5800X3D, RX 9070 XT,
main4777caca3plus local experiments.With
main'sHeldReads, a steady-stateAPS5_SAMPLE_COMMITTERwindow put 16.3 % of the draw committer's samples inHeldReads. Of that:ucrtbaseunder the per-callgetenvthat #9490 removes;So in this game nearly all of the cost is the
getenv. With #9490's change alone (same build, onlylibSceAgcDriver.prxswapped, 3 interleaved rounds), hub hold went from 10.50 to 11.68 FPS, and the committer from 25.5 to 21.9 µs per commit (details on #9490).I haven't measured this PR's skip on top of that. From the split above, its saving here would be at most the remaining ~1.5 % of committer samples. That still adds up across the ~370k commits per 10 s, but it is smaller than in your Yōtei profile, where the mutex dominated.