perf(agc): handle the dword pattern-fill kernel as a buffer fill #2081
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2081"
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 orbz22 on 2026-10-09T07:11:40Z.
What
Astro's Playroom (PPSA01325) runs a 64-thread compute kernel (69 dwords) every frame to fill DCC keys, HTILE and other metadata. It ran as a shader. Before the fill, every key read of those surfaces waited for a drain (on the UI target
0x534830000, among others).What the kernel does, read from its code and confirmed by the new test against the translated kernel:
ibelowmin(launched threads, s8, num_records). The group id is ins10, so the kernel has exactly 10 user SGPRs.iof a 4-byte-stride buffer (s[0:3]) it storespattern[min(i % s9, 3)], where the pattern iss4..s7ands9is the period.s4,s5ands6; anything else storess7.MatchDwordPatternFill(new headerDriver/Memory/DwordPatternFill.hpp) recognizes the exact code and accepts only one shape:That shape is a 16-byte pattern fill, and
fillBuffertakes it the same way it takes the existing fill kernel: clear path,FillBuffer, key memo. Everything else still runs the kernel.APS5_NO_FILL_HLEturns both matchers off.#1335 recognizes a different, typed pattern-fill kernel (18 dwords, pattern and control read from buffers). Both PRs touch
fillBuffer, so whichever merges second needs a small rebase.Tested
Windows 11, WinLibs GCC 15.2, RTX 3060 Laptop:
agc_driver_dword_pattern_fill_tests(tests/execution/DwordPatternFill.cpp):Submit: matched ones and unmatched ones (periods 3 and 5, a count of 250, a partial dispatch).APS5_NO_FILL_HLE=1, the translated kernel meets the same expectations, which is where themin(i % s9, 3)reading comes from.agc_driver_testsandagc_driver_pm4_testspass, andtools/check_conventions.py --base upstream/mainpasses.maindoes not reach the title, so both sides ran on an integration branch; details and per-run numbers are in the comments.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 (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T09:23:02Z.
Could you measure main against main plus this PR alone on PPSA01325, frame time on the same scene over a few runs? Perf PRs need numbers for the change itself (#218); the 40-57 ms is the cost on main, and the after run had other changes in it.
Imported from boykopovar/AnyPS5. Originally posted by orbz22 on 2026-10-09T12:35:03Z.
@oneandonlydean measured as an A/B with only this change between the two sides. PPSA01325 title screen, the same scene in every run; frames counted over 111-202 s of each run, three runs per side, A and B alternating.
Current
maindoes not reach the title in PPSA01325. It stops in turn on:missing static shader ABI register 201(#1836);rectangle ABI refers to a replaced shader header(#1837);DB_RENDER_CONTROLdepth clear draws (#1395);vertex fetch exceeds descriptor record count(no PR yet);main).So both sides run on my integration branch:
mainfrom 2026-10-08 plus those PRs, with the same build and the same switches on both sides. The only difference is the fill kernel:APS5_NO_DWORD_FILL_HLE=1), so the kernel runs as a dispatch, as onmain;About 7 ms per frame, with B ahead in every pair. That is far below the 40-57 ms in the description. Those were the cost of the waits on
0x534830000measured onmain, not an A/B, so I've replaced them in the description with these numbers.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:17:42Z.
Conflicts with main in
BufferFill.cppnow that #1335 is in; please rebase. It matches a different kernel from #1335, so both stay.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:41:51Z.
Rebased onto current
mainas @oneandonlydean asked (conflict infillBufferwith #1335; both kernels stay). The dword pattern-fill match is evaluated first and feeds the same clear /FillBuffer/ key-memo path;MatchesPatternFillKerneland the 16-byte kernel are untouched. Checked: local build and ctest of libSceAgcDriver green (306/306),agc_driver_dword_pattern_fillandagc_driver_pattern_buffer_fillpass. Merging once CI is green on the rebased head.