Repository navigation
perf(agc): retile storage write-back windows straight into their unit-shadow slabs - #6490
Conversation
|
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.
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.
|
|
Same measurement on this PR's exact head (
No faults in any of the 14 runs. So a second title (Sword of the Sea) gains as well, and on the RTX 3060 both titles move about 5 %. @AlxcBTW is running the same pair on an RTX 5070 Laptop. AI-assisted: yes (Claude Code) |
|
Third card, as @parl0v asked in the working group: RTX 5070 Laptop 8 GB, Ryzen AI 9 365, NVIDIA 617.42, Windows 11, on AC. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input,
Storage write-back halves on this card too (−50 %, same bytes), GPU busy drops by ~5.3 ms, and the title gains ~4 % (warm rows 7.93-7.99 against 8.27-8.29). The frame is not GPU-bound here either (~44 ms of idle gaps per frame on both sides), so most of the GPU saving does not show as frame rate at this scene; the other classes (draw ~25 ms, copy ~5.3 ms, shadow-publish ~5.7 ms) are unchanged within noise. The last screenshot of both warm PR rows shows the title image as on main (logo, campfire, lighting); the other shots were not reviewed one by one. Not run: the test target, Linux, gameplay. AI-assisted: yes |
|
@AlxcBTW thanks for the third card: write-back −50 % (11.8 → 5.9 ms per present, same bytes) and +4 % at the title on the RTX 5070 Laptop, no timeouts or fatals, matching the RTX 3060 / 4060 rows. With ~44 ms of CPU-side idle per frame on all three, that's about what this scene can show. AI-assisted: yes (Claude Code) |
|
Fresh numbers on current
The gain is GPU time only (-7.7 ms per frame, idle gaps unchanged), the same signature as on the three cards in the description. Write-back volume is unchanged (53.4 vs 55.6 GB of storage write-backs per 10 s, ~all of them retiled through the unit shadow on both sides); the difference is the per-window scratch copy this PR removes. 0 fatal, 0 wait timeouts. AI-assisted: yes (Claude Code) |
…-shadow slabs writeBackWindows retiled every window into a device scratch buffer and then copied the kept bytes from the scratch into the unit-shadow slabs, so each stored byte was written twice. A window now retiles straight into its slabs, one dispatch per slab piece, when its kept range is its whole tiled range, every piece goes to a slab that needs no seed, the pieces are tile-block and 4-byte aligned, and it is not a tail, thick or saved slice. The bytes no element covers are copied into the slab from their current source before the retile, or left alone when the slab already holds them. Every other window keeps the scratch path, and the scratch is not allocated when no window needs it.
…w slabs The write-back padding test gains an unpadded surface, a padded one and one that spans two slabs, writes each of them back twice and checks the stored texels and the untouched bytes after each write-back. The storage refresh, write-back padding and single-pass tests run as agc_storage_write_back.
bde6e2f to
b4cb4f8
Compare
|
This pull request is labeled |
|
Traces of the performance capture in the description (they open in ui.perfetto.dev): |
What
A storage write-back retiled each window into a device scratch buffer and then copied the kept bytes from the scratch into the import's unit-shadow slabs, so every stored byte was written twice (plus a padding copy into the scratch and the barriers between them). Now a window retiles straight into its slabs when:
savebuffer.A window that crosses a slab boundary gets one dispatch per slab piece, with its range narrowed to that piece. This is exact: the retile writes only the elements inside the window's range, and every other byte the scratch copy would have stored is padding, which is copied into the slab from its current source before the retile, or left alone when the slab already holds it at that offset. Every other window keeps the scratch path.
Tested
Windows 10 19045, MinGW-w64 GCC 15.2, NVIDIA 617.42.
Minecraft Dungeons II (PPSA16064), title screen, same relinked executable and libraries on a lab build with a switch for the old path, alternating 2 × 240 s,
APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1; box 1 withAPS5_TEXTURE_CACHE_MIB=3072on both sides so storage-cache eviction doesn't mask it:[gputime]storage-writeback per presentStorage write-back GPU time drops about 45 % on both cards. The frame rate moves 2–3 % at this title because the frame isn't purely GPU-bound there; the saving applies to every title that writes storage images back. In isolation the detile/retile dispatch itself runs at 150–280 GB/s on the RTX 4060, so the copies, not the shader, were the cost.
ctest -R '^agc_' -j 6on RTX 4060:upstream/main0029e62 3 failed of 598, this branch 3 failed of 599, the same three (agc_shader_disk_cache,agc_driver_preparation_scope_settle, andagc_driver_gpu_indirect_arguments_misaligned_writer_ahead, which doesn't compile with this toolchain onmaineither). The newagc_storage_write_backpasses.agc_storage_write_back(--storage-write-back-only): runs the storage refresh, write-back padding and single-pass tests, and the padding test gains three watched surfaces written back twice each (512x512 with 3 mips and no padding, 1000x700 padded, 1900x1100 across two 8 MiB slabs) plus the existing 520x260 case, all required to go direct, with exact texel and untouched-byte checks after each write-back.tools/check_conventions.py --base upstream/mainpasses;git diff --checkclean.Found while working on Minecraft Dungeons II in the working group with @AlxcBTW (AlxcBTW/AnyPS5#56), where storage write-back is our side of the split.
Performance capture (as the Performance report form describes): Minecraft Dungeons II (PPSA16064) title screen, RTX 3060 12 GB (i5-12400F), NVIDIA 617.42, Windows 10.0.19045, 3840x2160 output. Only
APS5_TRACE_SECONDS=120:12set, caches warm (the title ran once on the build and was restarted), stderr not redirected.main48d61f5 against this PR's head b4cb4f8:Frame and GPU times (ms):
Top phases (ms per frame):
{"commit":"48d61f53b46f","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:12"},"gpu":"NVIDIA GeForce RTX 3060","driver":"NVIDIA 617.42","os":"Windows 10.0.19045","resolution":"3840x2160","window":{"spec":"seconds 120:12","first_present":2158,"ms":12053.995},"presents":99,"frame_ms":{"p50":117.162,"p90":145.047,"p99":158.422,"max":158.422},"gpu_busy_ms_per_present":100.711,"worker_busy_pct":{"queue worker 0x0":99.421,"queue worker 0x20":99.581},"top_phases_ms_per_frame":{"Driver.Packet":242.204,"Driver.Packet.dispatch":86.382,"Driver.Dispatch":85.879,"Driver.Packet.memory_wait":68.067,"Vulkan.Dispatch":40.265,"Vulkan.Dispatch.shader_resources":38.025,"Driver.Packet.device_lock":34.172,"Driver.Packet.prepare_memory":30.126},"trace_dropped":false,"trace":"aps5-trace-48d61f53b46f-9720.json.gz"} {"commit":"b4cb4f8dbdf6","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:12"},"gpu":"NVIDIA GeForce RTX 3060","driver":"NVIDIA 617.42","os":"Windows 10.0.19045","resolution":"3840x2160","window":{"spec":"seconds 120:12","first_present":2200,"ms":12056.238},"presents":106,"frame_ms":{"p50":109.015,"p90":142.643,"p99":156.665,"max":157.261},"gpu_busy_ms_per_present":92.346,"worker_busy_pct":{"queue worker 0x0":99.376,"queue worker 0x20":99.610},"top_phases_ms_per_frame":{"Driver.Packet":226.218,"Driver.Packet.dispatch":79.226,"Driver.Dispatch":78.648,"Driver.Packet.memory_wait":64.104,"Vulkan.Dispatch":35.801,"Vulkan.Dispatch.shader_resources":33.341,"Driver.Packet.device_lock":32.937,"Driver.Packet.prepare_memory":26.819},"trace_dropped":false,"trace":"aps5-trace-b4cb4f8dbdf6-2632.json.gz"}Traces:
aps5-trace-48d61f53b46f-9720.json.gz(main) andaps5-trace-b4cb4f8dbdf6-2632.json.gz(this PR), attached below.trace_digest.py, main
seconds 120:12 from present 2158: 99 presents, frame p50 117.2 / p90 145.0 / p99 158.4 / max 158.4 ms, GPU busy 100.7 ms per present
NVIDIA GeForce RTX 3060, NVIDIA 617.42, Windows 10.0.19045, 3840x2160, commit 48d61f5, dropped: no
{"commit":"48d61f53b46f","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:12"},"gpu":"NVIDIA GeForce RTX 3060","driver":"NVIDIA 617.42","os":"Windows 10.0.19045","resolution":"3840x2160","window":{"spec":"seconds 120:12","first_present":2158,"ms":12053.995},"presents":99,"frame_ms":{"p50":117.162,"p90":145.047,"p99":158.422,"max":158.422},"gpu_busy_ms_per_present":100.711,"worker_busy_pct":{"queue worker 0x0":99.421,"queue worker 0x20":99.581},"top_phases_ms_per_frame":{"Driver.Packet":242.204,"Driver.Packet.dispatch":86.382,"Driver.Dispatch":85.879,"Driver.Packet.memory_wait":68.067,"Vulkan.Dispatch":40.265,"Vulkan.Dispatch.shader_resources":38.025,"Driver.Packet.device_lock":34.172,"Driver.Packet.prepare_memory":30.126},"trace_dropped":false,"trace":"aps5-trace-48d61f53b46f-9720.json.gz"}Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 235.3, batch 100.7, Driver.Packet.dispatch 86.1, Driver.Dispatch 85.2, Driver.Packet.memory_wait 68.0, Vulkan.Dispatch 39.4, Vulkan.Dispatch.shader_resources 37.1, Driver.Packet.device_lock 32.2, Driver.Packet.prepare_memory 27.8, Recorder.Sync 20.7
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
trace_digest.py, this PR
seconds 120:12 from present 2200: 106 presents, frame p50 109.0 / p90 142.6 / p99 156.7 / max 157.3 ms, GPU busy 92.3 ms per present
NVIDIA GeForce RTX 3060, NVIDIA 617.42, Windows 10.0.19045, 3840x2160, commit b4cb4f8, dropped: no
{"commit":"b4cb4f8dbdf6","dirty":false,"env":{"APS5_TRACE_SECONDS":"120:12"},"gpu":"NVIDIA GeForce RTX 3060","driver":"NVIDIA 617.42","os":"Windows 10.0.19045","resolution":"3840x2160","window":{"spec":"seconds 120:12","first_present":2200,"ms":12056.238},"presents":106,"frame_ms":{"p50":109.015,"p90":142.643,"p99":156.665,"max":157.261},"gpu_busy_ms_per_present":92.346,"worker_busy_pct":{"queue worker 0x0":99.376,"queue worker 0x20":99.61},"top_phases_ms_per_frame":{"Driver.Packet":226.218,"Driver.Packet.dispatch":79.226,"Driver.Dispatch":78.648,"Driver.Packet.memory_wait":64.104,"Vulkan.Dispatch":35.801,"Vulkan.Dispatch.shader_resources":33.341,"Driver.Packet.device_lock":32.937,"Driver.Packet.prepare_memory":26.819},"trace_dropped":false,"trace":"aps5-trace-b4cb4f8dbdf6-2632.json.gz"}Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.Packet 219.3, batch 92.3, Driver.Packet.dispatch 78.9, Driver.Dispatch 78.0, Driver.Packet.memory_wait 64.0, Vulkan.Dispatch 35.0, Vulkan.Dispatch.shader_resources 32.4, Driver.Packet.device_lock 30.9, Driver.Packet.prepare_memory 24.4, Recorder.WaitSerial 20.5
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
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)