perf(agc): learn a bound depth target's fast clear from its pending HTILE fill #6764
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6764"
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 SP4C3B4R-8 on 2026-10-16T10:36:50Z.
What
When a depth target is bound while a recorded uniform fill of its HTILE is still pending,
storeBackClearedHtilereads the whole HTILE on the CPU to learn the fast clear. The read goes through the flush hook, so it waits for the batch that holds the fill, inside the draw.Astro Bot (PPSA21564) clears its shadow cascades this way every frame (2048x2048, a 256 KiB HTILE each). At
-lvl hub_crashsitethat was about 190 such reads per 10 s, 3.3 s of hook waits inside queue 0's draws ([draws] ... hook waits inside draws), and every one of them read the uniform word the fill had just been noted with (NoteDepthMetadataFill).NoteDepthMetadataFillkeeps the fill's word with the recorder note of its write (LastWriteNote, only under the GPU mutex, so a fill stored on the CPU keeps none).NewestWriteNote) and no unit shadow covers it, the HTILE will hold that word: the clear is taken from it without reading. Same scheme as the DCC key memo (NoteKeysFillOnGpu/PendingStoreKeys).forgetHtileReads: another fill, a recognized HTILE clear kernel) drops the kept fill. Anything else, the CPU path runs as before.Measured on Windows (where draw inputs need #6763 to leave the GPU-bound regime), Crash Site,
APS5_PROFILE_DRAW=1/APS5_PROFILE_GPU=1: hook waits inside draws 3.3 s -> 0.0 s per 10 s, queue 0 worker 74.6 -> 32.1 us per draw packet; with the draw input copies, 7.52 -> 7.86 fps. Dumped frames match (shadows of the player, the tower and the foliage on the sand).Tested
Windows 11 Pro (26300), MinGW-w64 GCC 15.2.0, Release, Ryzen 7 7800X3D, RTX 5070 Ti.
agc_driver_depth_fast_clear_submitgainsPendingFillClearsWithoutWait: a GPU fill of the HTILE, noted and still pending, then a bind of the target (depth only, and depth with stencil in the HTILE): the clear is taken with no hook wait (Recorder::ThreadHookWaitsunchanged), the HTILE ends expanded (0xfffc000f / 0xfffff3ff), and the next draw keeps its depth. With the new path disabled it fails ("the bind read the HTILE under its pending fill: it waited for the batch").ctest -R "depth|htile|fast_clear|_fill") pass.agc_driver_multisample_fill_host_onlyfails now and then here ("the sentinel fill did not land"), 1 of 10 runs onmainwithout this change too.tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T10:51:51Z.
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.
main)core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL3core/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppL10core/libs/prx/libSceAgcDriver/tests/execution/DepthFastClearSubmit.cppL2, L258Some 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/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppImported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T21:06:38Z.
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;mainc84249186vsmain+ this PR, interleaved with three 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-48 ms of idle gaps per frame).maind9621eddb)Within 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 keravyn-ops on 2026-10-17T08:13:36Z.
Hi @SP4C3B4R-8 — this looks like the same change as #6505 (opened 2026-10-15): both take a bound depth target's fast clear from a pending uniform HTILE fill and record the expanded words as a GPU fill behind it, instead of reading the HTILE in
storeBackClearedHtile.#6505 has test reports so far from ASTRO BOT
hub_crashsite(Windows/AMD, 5.3 → 6.9 fps), Planet of Lana (RTX 3070 Laptop, 7.06 → 8.89 fps, pending-write syncs 263 → 0) and Hollow Knight: Silksong (Radeon 780M, 44–46 → 60–61 fps), and now also covers the depth and stencil case yourPendingFillClearsWithoutWaitchecks.Happy to run both PRs side by side on the 780M if that helps the maintainers pick one.
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-17T14:51:28Z.
Tested on GTA V (PPSA04264) in the open world (Los Santos, a story save resumed), Windows 11, RTX 4090 (driver 616.92), i9-13900K. Both HTILE PRs were measured on the same base, one run each, in the same session:
main47a266cf9+ #6488 + #6848, which GTA needs to render.APS5_PROFILE_DRAW=1, last 12 windows of 10 s (two minutes in the world, warm shader cache).[hooksync]pending-write syncs / 10 sd9621eddb)A committer profile of the base (sampling the
DrawPipelinethread) putsDepthSurfaceView→storeBackClearedHtile→GuestMemory::Read→FlushForAccess→Recorder::Syncat about 5 % of the committer's samples, so GTA hits the case both PRs handle. In this scene #6505 removes about 75 % of the hook wait time and #6764 about 40 %. FPS and the committer cost per draw stay within run-to-run noise: the committer is ~84 % busy with other per-draw work. Neither run crashed. I checked the rendering on the #6764 run's screenshots (correct); the #6505 run's were overwritten before I looked.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by SP4C3B4R-8 on 2026-10-18T08:28:02Z.
Closing in favour of #6505, which takes the same idea further (75% of the GTA V hook wait removed against 40% here, per @tibzejoker's side-by-side run) and now covers the depth and stencil case
PendingFillClearsWithoutWaitchecked. Thanks @keravyn-ops for pointing it out.Pull request closed