Repository navigation
perf(agc): take the memory-value dword fill kernel as a buffer fill - #4603
Conversation
|
Tested on Linux, RX 7600 (RADV NAVI33, Mesa 25.2.8), with Disney Epic Mickey: Rebrushed (PPSA15657). That game clears its depth HTILE with this kernel, and this PR fixes its level rendering. Without a fill path for this kernel, the level renders black except for the HUD:
With this PR, at head
The level now renders with a strong green cast. That one is unrelated to this PR (it comes from the sky light's cubemap), and I'm tracking it in #2255. |
|
@johnmaia thanks for testing it on Epic Mickey with RenderDoc. A second title with the same V# shape (stride 16, AI-assisted: yes (Claude Code) |
|
#3816 is merged with both of its commits, so this needs a rebase onto Two things while you are there:
The match itself reads exact to me. The numbers are sync counts from a branch with other changes; a frame time on |
|
@oneandonlydean merged current 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). |
|
Merging main brought in three merge commits, and the branch now conflicts with main in
|
590fef5 to
af246e0
Compare
|
Rebased onto current main as a single commit, without merge commits. #3816's commit is on main, so it is gone from the branch. On Dean's two points:
Aligned with #4012, which is still open: that PR's |
af246e0 to
f6c105b
Compare
|
Rebased onto current main. In the debt file I kept main's CMASK and host-import entries and this PR's HTILE edit. The fork CI is green on Windows and Linux. #5380 stacks on this PR and extends the dword-fill match to any inline constant. |
|
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.
|
The 9-word kernel #3816 matches stores one dword per thread, loaded with s_buffer_load_dword through the descriptor in user[4..7]. Run as a compute dispatch, its stores are pending writes of unknown value, so a later read of DCC keys in that range waits for the GPU. fillBuffer now takes it as a uniform buffer fill when all of these hold: - the output descriptor's format is 32_UINT, 32_SINT or 32_FLOAT (20-22), so buffer_store_format_x stores the loaded dword unchanged; - the value descriptor covers the loaded dword: num_records times the stride (num_records alone when the stride is 0) is at least 4 bytes, the range the recompiler gives a scalar buffer load; - exactly 8 user SGPRs and group id X enabled, so the group id is s8; - a direct, non-partial dispatch, 64x1x1 threads, one group in Y and Z, and a 16-byte aligned range of whole 16-byte units. The value is read when the fill is recorded, after the labels queued before it, as the pattern-fill kernel's source is. When the value is one byte repeated and that byte is a DCC key code, the fill goes into the GPU key-store memo whatever ClassifyFill reports: the memo answers a key read only while this fill is still the newest pending write over the keys, and a fill over a color target's keys is not a storage image's keys fill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f6c105b to
6ffc99b
Compare
|
@oneandonlydean done: the comment is gone ( |
What
Refs #3505. Builds on #3816, whose
MatchMemoryValueFillrecognizes the kernel.The 9-word kernel from #3816 stores one dword per thread through the stride-4 V# in
user[0..3]. It loads that dword withs_buffer_load_dwordthrough the V# inuser[4..7]. Run as a compute dispatch, its stores are pending writes of unknown value, so a later read of DCC keys in that range waits for the GPU inWaitForKeyWriters(#3505). Sword of the Sea (PPSA25344) clears DCC keys with this kernel every frame. Beast of Reincarnation (#3816) and Kena (PPSA01802) run it over HTILE.fillBuffernow takes it as a uniform buffer fill (MatchMemoryValueBufferFill) when all of these hold. Otherwise the recompiler runs it as before.32_UINT,32_SINTor32_FLOAT(20-22), sobuffer_store_format_xstores the dword unchanged.num_recordstimes the stride, ornum_recordsalone with stride 0, is at least 4 bytes. That is the range the recompiler gives a scalar buffer load (EmitRuntimeScalarBufferLoad). Outside that range the load returns 0, which the recompiled kernel keeps storing. Sword of the Sea's value V# has a stride, so itsnum_recordscounts elements and is below 4.s8is the group id. The dispatch is not partial.The value is read when the fill is recorded, after the labels queued before it, the way the pattern-fill kernel reads its source. From there the fill takes the existing path: fill clears on resident images, the HTILE note and the DCC key notes.
A fill whose value is one byte repeated also goes into the GPU key-store memo (
NoteKeysFillOnGpu) when that byte is a key code, even whenClassifyFilldoes not report the fill as a keys fill.ClassifyFillreports keys only for storage images' keys, so a fill over other keys, such as a color target's that is not also a storage image, never reached the memo. The memo answers a key read only while this fill is still the newest pending write over those keys (PendingStoreKeys).docs/dev/TechnicalDebt.md: #3816's HTILE entry now says that the fill path reads the value again when the fill is recorded.Tested
Head
6ffc99bedonmain18c438b10(#3816 is merged, so only this commit is in the diff). Fork CI for this head: run 38479822027: Linux and Windows green. The results below are from the earlier headb0c8e4478; the only change since is the rebase and the removed header comment.agc_driver_memory_value_fill:RELEASE_MEMlabel earlier in the same submission is the one the next fill stores.agc_driver_memory_value_fill,depth_fast_clearanddcc_keys_first_writeincluded. Windows passes 974 of 974, with the GPU tests skipped for lack of a device.agc_driver_memory_value_fill,dword_pattern_fill,depth_fast_clear,depth_fast_clear_submit,dcc_keys_first_write,fill_cover_keysandpattern_buffer_fillpass. On that machine the non-GPU tests pass 618 of 619.log_macrosfails there on every branch and passes in CI.tools/check_conventions.py --base origin/mainpasses.mainfrom 2026-10-11 with other local changes, including a buffer fill for perf(agc): handle the zero dword fill kernel as a buffer fill #4012's inline-zero kernel. TheWaitForKeyWriterssyncs were counted with a local counter, per 10 s. While the value V#'s range was read asnum_recordsalone, this kernel never took the fill path, because the title's value V# has a stride, and about 600-640 syncs remained. Countingnum_recordstimes the stride, the kernel took the fill path (16,530 fills in 120 s) and the syncs dropped to about 90. These are single runs, not alternated. Frame time was not compared for this change alone.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