perf(agc): match the dword pattern-fill kernel with its two compares in either order #6495
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6495"
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 winstrex on 2026-10-15T17:32:04Z.
What
Hades (PPSA03355) clears its 1920x1080 storage surfaces with the dword pattern-fill kernel that
MatchDwordPatternFillalready handles as a buffer fill (26035fab5, PPSA01325), about ten times a frame. Its copy of the kernel has words 27 to 29 in the other order: the SDWAv_cmpthat writess12(0x7d8c02f9 0x06068c02) comes before thev_cmpthat writesvcc_lo(0x7d860609). Neither compare reads what the other writes, so the two orders compute the same fill. The matcher compared the 69 words exactly, so onmainevery one of these dispatches runs as a shader (shader0x14075e400, from a 240 s gameplay run, 10 s window):Each such dispatch writes a whole storage image through its buffer view: the image's GPU results are published from the unit shadow into the import first, the kernel writes 8.4 MiB over the import, and the next use uploads the image again.
APS5_TRACE_DISPATCH_IO=2shows every one of them with a period of 1 (s9 = 1), over0x315d50000,0x312aa0000and0x3165c0000(1920x1080, 0x870000 bytes each, values0xff000000,0x80808080,0x80008080) and three smaller surfaces.MatchDwordPatternFillnow takes either order of those three words. Every other word, and every user-data and packet condition, is unchanged, so a kernel matches only if it is the listed one or the listed one with exactly these two compares exchanged. A matched dispatch goes throughfillBufferas before; in Hades all of them cover a resident image exactly and becomeFillClears.Tested
Windows 11 Pro (10.0.26300), RTX 5070 Ti (NVIDIA 591.86), WinLibs GCC 15.2.0 r7, Release, on
main0c4816f61.agc_driver_dword_pattern_fill: both orders through the matcher (periods 1, 2 and 4 give the same fill) and throughSubmit(all ten cases); each word of the swapped kernel flipped, a truncated kernel, and the other orders of the three words are refused. Onmainit fails:the kernel with its two compares in the other order was not recognized as the same fill.New ctest entry
agc_driver_dword_pattern_fill_translated: the same test withAPS5_NO_FILL_HLE=1, so both orders run as translated shaders against the same expected bytes. Both pass.The fill and clear tests (
ctest -R "fill|clear|htile|dcc_key"): 19 of 19.tools/check_conventions.py --base upstream/main: passes.Fork CI (the
build.ymlWindows job, run 38773335359 onmain0c4816f61+ this branch): 1297 of 1297,agc_driver_dword_pattern_fillandagc_driver_dword_pattern_fill_translatedincluded. Linux not run (the fork has no runner for it).Hades (PPSA03355), gameplay, 240 s per run, same relinked executable,
mainvs this PR, mean of the last twelve 10 s windows,APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1 APS5_TRACE_DISPATCH_IO=2:main0x14075e400per framefill HLE 3178per 10 s)[fill-clear]With the PR the run is bound by the queue-0 worker, not the GPU. Frame dumps (
APS5_DUMP_FRAMES=40, every 60th frame, menu and PLAY screen): each frame of the PR run matches a frame of themainrun to a mean difference of at most 5.7/255 (animated menu glow and fades; most pairs are 99 to 100% identical pixels). The gameplay window captures show the same scenes with no missing or black surfaces.Kernel use in dumped compute requests (
APS5_DUMP_SHADERS): Hades 1 (swapped order); LEGO Horizon Adventures 0 of 580; The Pathless 0 of 77; Balatro has no dumped compute request. The Pathless (menu, 120 s) runs at the same frame rate with and without the PR.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-15T18:27:03Z.
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/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txt