Repository navigation
perf(agc): handle the zero dword fill kernel as a buffer fill - #4012
Conversation
|
Could you measure the Palworld menu with and without this PR on the same base? Perf PRs need numbers for the change itself (#218); frame time, or the key-refresh waits per frame, is enough. |
|
Measured on the Palworld main menu, idle, with and without this change on the same build. Setup
What is left. About 2 waits per frame remain. They are mostly on a 2536x1428 R8 target whose keys another shader writes, about 25 ms each. That shader is a different kernel and not part of this PR. AI-assisted (Claude Code) |
|
Tested on Linux, which the description lists as not tested: Ubuntu, kernel 7.0, RX 7600 (RADV NAVI33, Mesa 25.2.8), GCC Release, head Epic Mickey: Rebrushed (PPSA15657, Unreal Engine 4) uses the same kernel. Base: main + #3763, #2904, #425 and #4363, which it needs to reach the first level. Measured with
The kernel matches about 108 times a second, and the level renders the same. Recorded-store syncs ( |
|
Sword of the Sea (PPSA25344, UE5) runs this exact kernel every frame to clear DCC keys, so here are two points from testing a buffer-fill version of it on our side. Output format. The kernel stores with Keys outside storage images. The fill is noted in the GPU key-store memo only when AI-assisted: yes (Claude Code) |
|
|
|
Tested #4012 and #4603 together on Minecraft Dungeons II (PPSA16064) gameplay at the Squid Coast spawn: Windows 11, RTX 5070, trace window 25-40 s after the HUD (#4526 trace, MCD2 clears DCC keys with both kernels. Run as shader dispatches, their stores made the key proofs of later render-target refreshes wait for the GPU ( The two PRs conflict in Not run: Linux, AMD, the PRs' own tests. AI-assisted (Claude Code). |
A wave64 compute kernel that stores dword 0 at index group * 64 + thread through a 4-byte stride buffer is run as a buffer fill. Palworld (PPSA23126) clears its DCC keys with it every frame; as a shader dispatch its writes were unknown to the DCC key proofs, so every refresh of those targets waited for the GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel stores through the V# FORMAT; with an 8- or 16-bit format it writes 1 or 2 bytes per element, which a zero fill of the whole range would also clear between. Same check as MatchDwordPatternFill (format 20-22), with test rows.
|
Thanks for the PR and the measurements, and to @AlxcBTW and @oneandonlydean for the review. Added the output-format check @oneandonlydean asked for as a separate commit on top (99ebc65), rebased on current
Checked: |
fed11bd to
99ebc65
Compare
|
Checked the zero-fill match (stride, swizzle, add_tid, OOB select, FORMAT 20-22, alignment, partial dispatch, record clamp) and its execution test against the recompiled path; |
What
A wave64 compute kernel that stores dword 0 at
group * 64 + threadthrough a buffer descriptor is run as a buffer fill of zeros, next to the existing dword pattern-fill kernel (#2081). The kernel is 6 words:Palworld (PPSA23126) clears the DCC keys of its render targets with it every frame. As a shader dispatch its stores were unknown to the DCC key proofs, so each later refresh of those keys waited for the GPU to finish.
MatchZeroDwordFilltakes a dispatch as this fill only when all of these hold, and otherwise leaves it to the recompiler:s4;add_tidand out-of-bounds select 0;min(groups * 64, records)dwords is a non-zero multiple of 16 bytes at a 16-byte-aligned base.Tested
Windows 11 Pro 26300, i5-13600K, RTX 2080 Ti (NVIDIA 610.74), MinGW-w64 GCC 15.2.0 (WinLibs r7), configured like the Windows CI job (
-G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON), atfed11bde:ctest --timeout 120 --parallel 12: 844 tests, 839 passed, 5 skipped (video_out_flip_*andguest_video_out_wqhd_detection_no_vulkan), 0 failed.agc_driver_zero_dword_filltest:add_tid, out-of-bounds select 3, an unaligned base, or 102 records;Submit, comparing every dword of the buffer with what the kernel writes. Fill-shaped dispatches and ones it refuses are both included (100 and 102 records, stride 8, a 70-thread partial dispatch, 0 groups). It also passes withAPS5_NO_FILL_HLE=1, where the recompiled shader runs instead.tools/check_test_registration.py,tools/check_conventions.py --base upstream/mainandgit diff --checkpass.I don't know which compiler or engine emits this kernel. Only the exact code words above match.
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