perf(agc): store whole words of 1- and 2-byte texels in the detile shader #6905

Merged
parl0v merged 2 commits from upstream-pr/6905 into main 2026-11-03 08:09:16 +00:00
parl0v commented 2026-10-16 17:34:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-16T17:34:24Z.


What

TextureDetile.comp moves one element per invocation. For 1- and 2-byte elements (R8, R16 and the other 8/16-bit formats) the destination word is shared by 4 or 2 invocations, so every element is written with an atomicAnd + atomicOr pair on that word (copyElement in the buffer paths, loadElement in the image retile). Neighbouring invocations hit the same word, and those paths run at 9-44 GB/s on an RTX 4060 against 253 GB/s for 4-byte elements.

  • perf: two new variants of the shader (-DWORD_GROUPS=1, buffer and image) combine the elements of each destination word in workgroup shared memory and store the word once. Each invocation still locates its own element (locate, the per-element addressing split out of main unchanged); after a barrier, a group of 4 (1-byte) or 2 (2-byte) neighbouring invocations whose elements are all in the window's range and land in one aligned 4-byte word, in order, store that word with a plain write. Any other group (a row or window edge, a partial word at a range boundary, an unaligned base) falls back to the existing per-element atomic path, so the bytes written are exactly the old ones.
  • The host (TextureDetiler::pipeline) picks the word variants only where they help: 1- and 2-byte buffer detiles (the linear destination always keeps neighbours in one word), and retiles of the linear and standard (non-equation) layouts. Equation-swizzled retiles (_X, thick) keep the old shader: their tiled words hold elements of other rows, and grouping them measured slower. 4-, 8- and 16-byte elements are unchanged and use the same SPIR-V as before.
  • test: agc_detile_small_elements (agc_driver_recorder_tests --small-element-detile-only) runs the buffer retile, buffer detile and image retile on the device for 1- and 2-byte elements over SW_64KB_S, SW_4KB_S, SW_64KB_R_X and linear, odd sizes (37x21, 70x9, 37x5), a tail mip of each 64 KB mode, and three windows (whole mip, a byte range with unaligned ends, columns 3 to width-2). Every byte of each destination is compared with a CPU reference (the swizzle equations for _X, the shader's standard-swizzle bit layout for SW_*_S), including the bytes no element maps to. Breaking the word store (^ 1u) fails it at the first byte.

This is a throughput fix for those paths: no title I have is bound by 1- or 2-byte detiles yet, so it makes no frame-rate claim (title runs under Tested).

Tested

Windows 10 19045, MinGW GCC, Release.

  • RTX 4060 8 GB (NVIDIA 617.42): agc_detile_small_elements, agc_driver_graphics, agc_unit_shadow, agc_shadowed_key_stores and the agc_storage_* tests pass.
  • Microbenchmark on the RTX 4060 (a local --detile-bench harness timing 20 dispatches per path with timestamp queries, 1920x1080, median; main 452494439 vs this PR in the same build tree, two runs each, mean of the two):
path layout element main this PR
buffer detile SW_64KB_S 1 B 228.9 us 37.9 us 6.0x
buffer detile SW_64KB_R_X 1 B 231.9 us 74.8 us 3.1x
buffer detile SW_64KB_S 2 B 94.5 us 35.8 us 2.6x
image retile SW_64KB_S 1 B 79.9 us 35.8 us 2.2x
buffer detile SW_64KB_R_X 2 B 95.2 us 71.7 us 1.3x
image retile SW_64KB_S 2 B 37.9 us 33.8 us 1.1x
image retile SW_64KB_R_X 1 / 2 B 62.5 us 63.5 / 63.2 us unchanged path
every path both 4 / 8 B 0.98-1.05x (unchanged SPIR-V)
  • In a title, RTX 3060 12 GB (NVIDIA 617.42), title screens, 200 s rows alternating, APS5_PROFILE_GPU=1: no change, because their per-frame write-backs are not 1- or 2-byte standard-layout retiles. Minecraft Dungeons II (PPSA16064): 6.60 / 6.71 / 6.60 FPS on main, 6.68 / 6.58 / 6.67 with this PR, storage-writeback 17.3-17.6 ms per present on both. Sword of the Sea (PPSA25344): 9.62 / 9.60 FPS on main, 9.60 / 9.60 with this PR, storage-writeback 15.3-15.5 ms and storage-upload 5.0-5.1 ms per present on both. The paths this speeds up are the buffer detile of 8- and 16-bit textures (sampled texture uploads) and the standard-layout storage write-backs of such images; I have no title scene yet that is bound by them, so this is offered as a throughput fix with the benchmark above, not a frame-rate claim.
  • tools/check_conventions.py --base upstream/main passes.

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:12 set, caches warm (the title ran once on the build and was restarted), stderr not redirected. main 48d61f53b4 against this PR's head 283b057afe16:

Frame and GPU times (ms):

Metric Baseline Candidate Change Change (%)
frame_ms.p50 117.162 116.903 -0.259 -0.221
frame_ms.p90 145.047 144.762 -0.285 -0.196
frame_ms.p99 158.422 163.666 +5.244 +3.310
frame_ms.max 158.422 163.666 +5.244 +3.310
mean_frame_ms 121.758 120.905 -0.852 -0.700
gpu_busy_ms_per_present 100.711 100.576 -0.135 -0.134

Top phases (ms per frame):

Metric Baseline Candidate Change Change (%)
Driver.Dispatch 85.879 83.654 -2.225 -2.591
Driver.Packet 242.204 240.507 -1.697 -0.701
Driver.Packet.device_lock 34.172 36.328 +2.156 +6.309
Driver.Packet.dispatch 86.382 84.174 -2.208 -2.556
Driver.Packet.memory_wait 68.067 67.603 -0.464 -0.682
Driver.Packet.prepare_memory 30.126 28.913 -1.213 -4.026
Vulkan.Dispatch 40.265 39.326 -0.939 -2.332
Vulkan.Dispatch.shader_resources 38.025 37.045 -0.980 -2.577
{"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":"283b057afe16","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":2159,"ms":12090.542},"presents":100,"frame_ms":{"p50":116.903,"p90":144.762,"p99":163.666,"max":163.666},"gpu_busy_ms_per_present":100.576,"worker_busy_pct":{"queue worker 0x0":99.411,"queue worker 0x20":99.593},"top_phases_ms_per_frame":{"Driver.Packet":240.507,"Driver.Packet.dispatch":84.174,"Driver.Dispatch":83.654,"Driver.Packet.memory_wait":67.603,"Vulkan.Dispatch":39.326,"Vulkan.Dispatch.shader_resources":37.045,"Driver.Packet.device_lock":36.328,"Driver.Packet.prepare_memory":28.913},"trace_dropped":false,"trace":"aps5-trace-283b057afe16-15136.json.gz"}

Traces: aps5-trace-48d61f53b46f-9720.json.gz (main) and aps5-trace-283b057afe16-15136.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 48d61f53b4, 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)

  • present 2199: 158.4 ms at 4990 ms: Driver.Packet (queue worker 0x20) 156.8, Driver.Packet (queue worker 0x0) 152.3, batch (gpu) 105.5, Driver.Packet.dispatch (queue worker 0x20) 75.5
  • present 2183: 157.2 ms at 3021 ms: Driver.Packet (queue worker 0x20) 155.6, Driver.Packet (queue worker 0x0) 150.7, batch (gpu) 105.6, Driver.Packet.dispatch (queue worker 0x20) 74.6
  • present 2246: 153.0 ms at 10688 ms: Driver.Packet (queue worker 0x20) 151.5, Driver.Packet (queue worker 0x0) 146.6, batch (gpu) 108.3, Driver.Packet.dispatch (queue worker 0x20) 74.8
  • present 2166: 149.2 ms at 933 ms: Driver.Packet (queue worker 0x20) 147.7, Driver.Packet (queue worker 0x0) 142.9, batch (gpu) 107.0, Driver.Packet.dispatch (queue worker 0x20) 68.2
  • present 2198: 148.9 ms at 4841 ms: Driver.Packet (queue worker 0x20) 147.2, Driver.Packet (queue worker 0x0) 142.6, batch (gpu) 106.4, Driver.Packet.dispatch (queue worker 0x20) 69.5

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 85.8 (70 %) 29.6 (24 %) 6.3 34.1 Driver.Packet 115.4, Driver.EndSubmission 0.0
queue worker 0x20 39.7 (33 %) 80.2 (66 %) 1.8 7.3 Driver.Packet 119.8, Driver.EndSubmission 0.1
presenter 0.6 (0 %) 0.0 (0 %) 121.1 0.1 VideoOut.Flip 0.6, Driver.Present 0.0
gpu 100.7 (83 %) 0.0 (0 %) 21.1 0.0 batch 100.7

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

  • Driver.Packet.memory_wait (queue worker 0x20) 45.5 ms at 10797 ms, present 2246
  • Driver.Packet.memory_wait (queue worker 0x20) 45.1 ms at 5104 ms, present 2199
  • Driver.Packet.memory_wait (queue worker 0x20) 44.3 ms at 1038 ms, present 2166
  • Driver.Packet.memory_wait (queue worker 0x20) 43.9 ms at 8841 ms, present 2230
  • Driver.Packet.memory_wait (queue worker 0x20) 43.0 ms at 3137 ms, present 2183
  • Driver.Packet.memory_wait (queue worker 0x20) 41.8 ms at 6905 ms, present 2214
  • Driver.Packet.memory_wait (queue worker 0x20) 41.5 ms at 4949 ms, present 2198
  • Driver.Packet.memory_wait (queue worker 0x20) 41.1 ms at 8989 ms, present 2231
  • Driver.Packet.memory_wait (queue worker 0x20) 41.1 ms at 2981 ms, present 2182
  • Driver.Packet.memory_wait (queue worker 0x20) 40.4 ms at 7050 ms, present 2215

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 4140: 11.6 ms at 7393 ms, present 2218: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 11.7, Driver.Packet (queue worker 0x20) 1.9, Driver.Packet.dispatch (queue worker 0x20) 1.4, Driver.Dispatch (queue worker 0x20) 1.3
  • batch 163: 11.5 ms at 303 ms, present 2160: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.0, Driver.Dispatch (queue worker 0x20) 0.9, Driver.Packet.prepare_memory (queue worker 0x20) 0.5
  • batch 2466: 11.5 ms at 4439 ms, present 2194: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 13.9, Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.2
  • batch 3269: 11.5 ms at 5830 ms, present 2205: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.8, Driver.Packet.dispatch (queue worker 0x20) 1.2, Driver.Dispatch (queue worker 0x20) 1.1, GpuMutex.wait.label (queue worker 0x20) 0.8
  • batch 988: 11.4 ms at 1761 ms, present 2172: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.6, Driver.Packet.dispatch (queue worker 0x20) 1.1, Driver.Dispatch (queue worker 0x20) 1.1, GpuMutex.wait.label (queue worker 0x20) 0.6
trace_digest.py, this PR

seconds 120:12 from present 2159: 100 presents, frame p50 116.9 / p90 144.8 / p99 163.7 / max 163.7 ms, GPU busy 100.6 ms per present
NVIDIA GeForce RTX 3060, NVIDIA 617.42, Windows 10.0.19045, 3840x2160, commit 283b057afe16, dropped: no

{"commit":"283b057afe16","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":2159,"ms":12090.542},"presents":100,"frame_ms":{"p50":116.903,"p90":144.762,"p99":163.666,"max":163.666},"gpu_busy_ms_per_present":100.576,"worker_busy_pct":{"queue worker 0x0":99.411,"queue worker 0x20":99.593},"top_phases_ms_per_frame":{"Driver.Packet":240.507,"Driver.Packet.dispatch":84.174,"Driver.Dispatch":83.654,"Driver.Packet.memory_wait":67.603,"Vulkan.Dispatch":39.326,"Vulkan.Dispatch.shader_resources":37.045,"Driver.Packet.device_lock":36.328,"Driver.Packet.prepare_memory":28.913},"trace_dropped":false,"trace":"aps5-trace-283b057afe16-15136.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 2244: 163.7 ms at 10263 ms: Driver.Packet (queue worker 0x20) 162.1, Driver.Packet (queue worker 0x0) 157.3, batch (gpu) 108.6, Driver.Packet.dispatch (queue worker 0x20) 83.3
  • present 2165: 160.1 ms at 726 ms: Driver.Packet (queue worker 0x20) 158.4, Driver.Packet (queue worker 0x0) 153.9, batch (gpu) 106.1, Driver.Packet.dispatch (queue worker 0x20) 76.1
  • present 2197: 156.0 ms at 4595 ms: Driver.Packet (queue worker 0x20) 154.4, Driver.Packet (queue worker 0x0) 149.8, batch (gpu) 105.3, Driver.Packet.dispatch (queue worker 0x20) 82.8
  • present 2228: 151.6 ms at 8333 ms: Driver.Packet (queue worker 0x20) 150.0, Driver.Packet (queue worker 0x0) 145.4, batch (gpu) 107.6, Driver.Packet.dispatch (queue worker 0x20) 70.9
  • present 2212: 150.4 ms at 6399 ms: Driver.Packet (queue worker 0x20) 148.7, Driver.Packet (queue worker 0x0) 144.3, batch (gpu) 106.0, Driver.Packet.dispatch (queue worker 0x20) 76.7

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 87.1 (72 %) 27.5 (23 %) 6.3 34.0 Driver.Packet 114.6, Driver.EndSubmission 0.0
queue worker 0x20 39.5 (33 %) 79.6 (66 %) 1.8 7.2 Driver.Packet 119.0, Driver.EndSubmission 0.1
presenter 0.6 (1 %) 0.0 (0 %) 120.3 0.1 VideoOut.Flip 0.6, Driver.Present 0.0
gpu 100.5 (83 %) 0.0 (0 %) 20.4 0.0 batch 100.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 233.6, batch 100.5, Driver.Packet.dispatch 83.9, Driver.Dispatch 83.0, Driver.Packet.memory_wait 67.5, Vulkan.Dispatch 38.4, Vulkan.Dispatch.shader_resources 36.1, Driver.Packet.device_lock 34.3, Driver.Packet.prepare_memory 26.5, Recorder.WaitSerial 20.3

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x20) 45.0 ms at 10382 ms, present 2244
  • Driver.Packet.memory_wait (queue worker 0x20) 44.5 ms at 842 ms, present 2165
  • Driver.Packet.memory_wait (queue worker 0x20) 43.6 ms at 684 ms, present 2164
  • Driver.Packet.memory_wait (queue worker 0x20) 43.2 ms at 8441 ms, present 2228
  • Driver.Packet.memory_wait (queue worker 0x20) 42.6 ms at 6507 ms, present 2212
  • Driver.Packet.memory_wait (queue worker 0x20) 42.6 ms at 4710 ms, present 2197
  • Driver.Packet.memory_wait (queue worker 0x20) 41.7 ms at 4554 ms, present 2196
  • Driver.Packet.memory_wait (queue worker 0x20) 41.3 ms at 6653 ms, present 2213
  • Driver.Packet.memory_wait (queue worker 0x20) 40.8 ms at 8589 ms, present 2229
  • Driver.Packet.memory_wait (queue worker 0x20) 40.7 ms at 2771 ms, present 2181

Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)

  • batch 365: 14.6 ms at 650 ms, present 2164: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 16.3, Driver.Packet (queue worker 0x20) 1.8, Driver.Packet.dispatch (queue worker 0x20) 1.4, Driver.Dispatch (queue worker 0x20) 1.4
  • batch 3045: 11.9 ms at 5433 ms, present 2203: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.4, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.2, Vulkan.Dispatch (queue worker 0x20) 0.6
  • batch 1756: 11.6 ms at 3113 ms, present 2184: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 2.1, Driver.Packet.dispatch (queue worker 0x20) 1.6, Driver.Dispatch (queue worker 0x20) 1.5, Driver.Packet.prepare_memory (queue worker 0x20) 0.6
  • batch 667: 11.5 ms at 1189 ms, present 2168: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 11.7, Driver.Packet (queue worker 0x20) 1.9, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.3
  • batch 3920: 11.5 ms at 6998 ms, present 2216: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.1, Driver.Dispatch (queue worker 0x20) 1.0, Driver.Packet.prepare_memory (queue worker 0x20) 0.5

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4060 8 GB, driver 617.42, Windows 10 (tests and benchmark); NVIDIA GeForce RTX 3060 12 GB, driver 617.42, Windows 10 (title runs)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4892008424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-16T17:34:24Z. --- ### What `TextureDetile.comp` moves one element per invocation. For 1- and 2-byte elements (R8, R16 and the other 8/16-bit formats) the destination word is shared by 4 or 2 invocations, so every element is written with an `atomicAnd` + `atomicOr` pair on that word (`copyElement` in the buffer paths, `loadElement` in the image retile). Neighbouring invocations hit the same word, and those paths run at 9-44 GB/s on an RTX 4060 against 253 GB/s for 4-byte elements. - perf: two new variants of the shader (`-DWORD_GROUPS=1`, buffer and image) combine the elements of each destination word in workgroup shared memory and store the word once. Each invocation still locates its own element (`locate`, the per-element addressing split out of `main` unchanged); after a barrier, a group of 4 (1-byte) or 2 (2-byte) neighbouring invocations whose elements are all in the window's range and land in one aligned 4-byte word, in order, store that word with a plain write. Any other group (a row or window edge, a partial word at a range boundary, an unaligned base) falls back to the existing per-element atomic path, so the bytes written are exactly the old ones. - The host (`TextureDetiler::pipeline`) picks the word variants only where they help: 1- and 2-byte buffer detiles (the linear destination always keeps neighbours in one word), and retiles of the linear and standard (non-equation) layouts. Equation-swizzled retiles (`_X`, thick) keep the old shader: their tiled words hold elements of other rows, and grouping them measured slower. 4-, 8- and 16-byte elements are unchanged and use the same SPIR-V as before. - test: `agc_detile_small_elements` (`agc_driver_recorder_tests --small-element-detile-only`) runs the buffer retile, buffer detile and image retile on the device for 1- and 2-byte elements over `SW_64KB_S`, `SW_4KB_S`, `SW_64KB_R_X` and linear, odd sizes (37x21, 70x9, 37x5), a tail mip of each 64 KB mode, and three windows (whole mip, a byte range with unaligned ends, columns 3 to width-2). Every byte of each destination is compared with a CPU reference (the swizzle equations for `_X`, the shader's standard-swizzle bit layout for `SW_*_S`), including the bytes no element maps to. Breaking the word store (`^ 1u`) fails it at the first byte. This is a throughput fix for those paths: no title I have is bound by 1- or 2-byte detiles yet, so it makes no frame-rate claim (title runs under Tested). ### Tested Windows 10 19045, MinGW GCC, Release. - RTX 4060 8 GB (NVIDIA 617.42): `agc_detile_small_elements`, `agc_driver_graphics`, `agc_unit_shadow`, `agc_shadowed_key_stores` and the `agc_storage_*` tests pass. - Microbenchmark on the RTX 4060 (a local `--detile-bench` harness timing 20 dispatches per path with timestamp queries, 1920x1080, median; `main` 452494439 vs this PR in the same build tree, two runs each, mean of the two): | path | layout | element | `main` | this PR | | |---|---|---|---|---|---| | buffer detile | `SW_64KB_S` | 1 B | 228.9 us | 37.9 us | **6.0x** | | buffer detile | `SW_64KB_R_X` | 1 B | 231.9 us | 74.8 us | **3.1x** | | buffer detile | `SW_64KB_S` | 2 B | 94.5 us | 35.8 us | **2.6x** | | image retile | `SW_64KB_S` | 1 B | 79.9 us | 35.8 us | **2.2x** | | buffer detile | `SW_64KB_R_X` | 2 B | 95.2 us | 71.7 us | 1.3x | | image retile | `SW_64KB_S` | 2 B | 37.9 us | 33.8 us | 1.1x | | image retile | `SW_64KB_R_X` | 1 / 2 B | 62.5 us | 63.5 / 63.2 us | unchanged path | | every path | both | 4 / 8 B | | | 0.98-1.05x (unchanged SPIR-V) | - In a title, RTX 3060 12 GB (NVIDIA 617.42), title screens, 200 s rows alternating, `APS5_PROFILE_GPU=1`: no change, because their per-frame write-backs are not 1- or 2-byte standard-layout retiles. Minecraft Dungeons II (PPSA16064): 6.60 / 6.71 / 6.60 FPS on `main`, 6.68 / 6.58 / 6.67 with this PR, `storage-writeback` 17.3-17.6 ms per present on both. Sword of the Sea (PPSA25344): 9.62 / 9.60 FPS on `main`, 9.60 / 9.60 with this PR, `storage-writeback` 15.3-15.5 ms and `storage-upload` 5.0-5.1 ms per present on both. The paths this speeds up are the buffer detile of 8- and 16-bit textures (sampled texture uploads) and the standard-layout storage write-backs of such images; I have no title scene yet that is bound by them, so this is offered as a throughput fix with the benchmark above, not a frame-rate claim. - `tools/check_conventions.py --base upstream/main` passes. **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:12` set, caches warm (the title ran once on the build and was restarted), stderr not redirected. `main` 48d61f53b46f against this PR's head 283b057afe16: Frame and GPU times (ms): | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | frame_ms.p50 | 117.162 | 116.903 | -0.259 | -0.221 | | frame_ms.p90 | 145.047 | 144.762 | -0.285 | -0.196 | | frame_ms.p99 | 158.422 | 163.666 | +5.244 | +3.310 | | frame_ms.max | 158.422 | 163.666 | +5.244 | +3.310 | | mean_frame_ms | 121.758 | 120.905 | -0.852 | -0.700 | | gpu_busy_ms_per_present | 100.711 | 100.576 | -0.135 | -0.134 | Top phases (ms per frame): | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | Driver.Dispatch | 85.879 | 83.654 | -2.225 | -2.591 | | Driver.Packet | 242.204 | 240.507 | -1.697 | -0.701 | | Driver.Packet.device_lock | 34.172 | 36.328 | +2.156 | +6.309 | | Driver.Packet.dispatch | 86.382 | 84.174 | -2.208 | -2.556 | | Driver.Packet.memory_wait | 68.067 | 67.603 | -0.464 | -0.682 | | Driver.Packet.prepare_memory | 30.126 | 28.913 | -1.213 | -4.026 | | Vulkan.Dispatch | 40.265 | 39.326 | -0.939 | -2.332 | | Vulkan.Dispatch.shader_resources | 38.025 | 37.045 | -0.980 | -2.577 | ```json {"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":"283b057afe16","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":2159,"ms":12090.542},"presents":100,"frame_ms":{"p50":116.903,"p90":144.762,"p99":163.666,"max":163.666},"gpu_busy_ms_per_present":100.576,"worker_busy_pct":{"queue worker 0x0":99.411,"queue worker 0x20":99.593},"top_phases_ms_per_frame":{"Driver.Packet":240.507,"Driver.Packet.dispatch":84.174,"Driver.Dispatch":83.654,"Driver.Packet.memory_wait":67.603,"Vulkan.Dispatch":39.326,"Vulkan.Dispatch.shader_resources":37.045,"Driver.Packet.device_lock":36.328,"Driver.Packet.prepare_memory":28.913},"trace_dropped":false,"trace":"aps5-trace-283b057afe16-15136.json.gz"} ``` Traces: `aps5-trace-48d61f53b46f-9720.json.gz` (`main`) and `aps5-trace-283b057afe16-15136.json.gz` (this PR), attached below. <details><summary>trace_digest.py, main</summary> **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 48d61f53b46f, dropped: no ```json {"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) - present 2199: 158.4 ms at 4990 ms: Driver.Packet (queue worker 0x20) 156.8, Driver.Packet (queue worker 0x0) 152.3, batch (gpu) 105.5, Driver.Packet.dispatch (queue worker 0x20) 75.5 - present 2183: 157.2 ms at 3021 ms: Driver.Packet (queue worker 0x20) 155.6, Driver.Packet (queue worker 0x0) 150.7, batch (gpu) 105.6, Driver.Packet.dispatch (queue worker 0x20) 74.6 - present 2246: 153.0 ms at 10688 ms: Driver.Packet (queue worker 0x20) 151.5, Driver.Packet (queue worker 0x0) 146.6, batch (gpu) 108.3, Driver.Packet.dispatch (queue worker 0x20) 74.8 - present 2166: 149.2 ms at 933 ms: Driver.Packet (queue worker 0x20) 147.7, Driver.Packet (queue worker 0x0) 142.9, batch (gpu) 107.0, Driver.Packet.dispatch (queue worker 0x20) 68.2 - present 2198: 148.9 ms at 4841 ms: Driver.Packet (queue worker 0x20) 147.2, Driver.Packet (queue worker 0x0) 142.6, batch (gpu) 106.4, Driver.Packet.dispatch (queue worker 0x20) 69.5 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 85.8 (70 %) | 29.6 (24 %) | 6.3 | 34.1 | Driver.Packet 115.4, Driver.EndSubmission 0.0 | | queue worker 0x20 | 39.7 (33 %) | 80.2 (66 %) | 1.8 | 7.3 | Driver.Packet 119.8, Driver.EndSubmission 0.1 | | presenter | 0.6 (0 %) | 0.0 (0 %) | 121.1 | 0.1 | VideoOut.Flip 0.6, Driver.Present 0.0 | | gpu | 100.7 (83 %) | 0.0 (0 %) | 21.1 | 0.0 | batch 100.7 | **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** - Driver.Packet.memory_wait (queue worker 0x20) 45.5 ms at 10797 ms, present 2246 - Driver.Packet.memory_wait (queue worker 0x20) 45.1 ms at 5104 ms, present 2199 - Driver.Packet.memory_wait (queue worker 0x20) 44.3 ms at 1038 ms, present 2166 - Driver.Packet.memory_wait (queue worker 0x20) 43.9 ms at 8841 ms, present 2230 - Driver.Packet.memory_wait (queue worker 0x20) 43.0 ms at 3137 ms, present 2183 - Driver.Packet.memory_wait (queue worker 0x20) 41.8 ms at 6905 ms, present 2214 - Driver.Packet.memory_wait (queue worker 0x20) 41.5 ms at 4949 ms, present 2198 - Driver.Packet.memory_wait (queue worker 0x20) 41.1 ms at 8989 ms, present 2231 - Driver.Packet.memory_wait (queue worker 0x20) 41.1 ms at 2981 ms, present 2182 - Driver.Packet.memory_wait (queue worker 0x20) 40.4 ms at 7050 ms, present 2215 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4140: 11.6 ms at 7393 ms, present 2218: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 11.7, Driver.Packet (queue worker 0x20) 1.9, Driver.Packet.dispatch (queue worker 0x20) 1.4, Driver.Dispatch (queue worker 0x20) 1.3 - batch 163: 11.5 ms at 303 ms, present 2160: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.0, Driver.Dispatch (queue worker 0x20) 0.9, Driver.Packet.prepare_memory (queue worker 0x20) 0.5 - batch 2466: 11.5 ms at 4439 ms, present 2194: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 13.9, Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.2 - batch 3269: 11.5 ms at 5830 ms, present 2205: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.8, Driver.Packet.dispatch (queue worker 0x20) 1.2, Driver.Dispatch (queue worker 0x20) 1.1, GpuMutex.wait.label (queue worker 0x20) 0.8 - batch 988: 11.4 ms at 1761 ms, present 2172: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.6, Driver.Packet.dispatch (queue worker 0x20) 1.1, Driver.Dispatch (queue worker 0x20) 1.1, GpuMutex.wait.label (queue worker 0x20) 0.6 </details> <details><summary>trace_digest.py, this PR</summary> **seconds 120:12** from present 2159: 100 presents, frame p50 116.9 / p90 144.8 / p99 163.7 / max 163.7 ms, GPU busy 100.6 ms per present NVIDIA GeForce RTX 3060, NVIDIA 617.42, Windows 10.0.19045, 3840x2160, commit 283b057afe16, dropped: no ```json {"commit":"283b057afe16","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":2159,"ms":12090.542},"presents":100,"frame_ms":{"p50":116.903,"p90":144.762,"p99":163.666,"max":163.666},"gpu_busy_ms_per_present":100.576,"worker_busy_pct":{"queue worker 0x0":99.411,"queue worker 0x20":99.593},"top_phases_ms_per_frame":{"Driver.Packet":240.507,"Driver.Packet.dispatch":84.174,"Driver.Dispatch":83.654,"Driver.Packet.memory_wait":67.603,"Vulkan.Dispatch":39.326,"Vulkan.Dispatch.shader_resources":37.045,"Driver.Packet.device_lock":36.328,"Driver.Packet.prepare_memory":28.913},"trace_dropped":false,"trace":"aps5-trace-283b057afe16-15136.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 2244: 163.7 ms at 10263 ms: Driver.Packet (queue worker 0x20) 162.1, Driver.Packet (queue worker 0x0) 157.3, batch (gpu) 108.6, Driver.Packet.dispatch (queue worker 0x20) 83.3 - present 2165: 160.1 ms at 726 ms: Driver.Packet (queue worker 0x20) 158.4, Driver.Packet (queue worker 0x0) 153.9, batch (gpu) 106.1, Driver.Packet.dispatch (queue worker 0x20) 76.1 - present 2197: 156.0 ms at 4595 ms: Driver.Packet (queue worker 0x20) 154.4, Driver.Packet (queue worker 0x0) 149.8, batch (gpu) 105.3, Driver.Packet.dispatch (queue worker 0x20) 82.8 - present 2228: 151.6 ms at 8333 ms: Driver.Packet (queue worker 0x20) 150.0, Driver.Packet (queue worker 0x0) 145.4, batch (gpu) 107.6, Driver.Packet.dispatch (queue worker 0x20) 70.9 - present 2212: 150.4 ms at 6399 ms: Driver.Packet (queue worker 0x20) 148.7, Driver.Packet (queue worker 0x0) 144.3, batch (gpu) 106.0, Driver.Packet.dispatch (queue worker 0x20) 76.7 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 87.1 (72 %) | 27.5 (23 %) | 6.3 | 34.0 | Driver.Packet 114.6, Driver.EndSubmission 0.0 | | queue worker 0x20 | 39.5 (33 %) | 79.6 (66 %) | 1.8 | 7.2 | Driver.Packet 119.0, Driver.EndSubmission 0.1 | | presenter | 0.6 (1 %) | 0.0 (0 %) | 120.3 | 0.1 | VideoOut.Flip 0.6, Driver.Present 0.0 | | gpu | 100.5 (83 %) | 0.0 (0 %) | 20.4 | 0.0 | batch 100.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 233.6, batch 100.5, Driver.Packet.dispatch 83.9, Driver.Dispatch 83.0, Driver.Packet.memory_wait 67.5, Vulkan.Dispatch 38.4, Vulkan.Dispatch.shader_resources 36.1, Driver.Packet.device_lock 34.3, Driver.Packet.prepare_memory 26.5, Recorder.WaitSerial 20.3 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x20) 45.0 ms at 10382 ms, present 2244 - Driver.Packet.memory_wait (queue worker 0x20) 44.5 ms at 842 ms, present 2165 - Driver.Packet.memory_wait (queue worker 0x20) 43.6 ms at 684 ms, present 2164 - Driver.Packet.memory_wait (queue worker 0x20) 43.2 ms at 8441 ms, present 2228 - Driver.Packet.memory_wait (queue worker 0x20) 42.6 ms at 6507 ms, present 2212 - Driver.Packet.memory_wait (queue worker 0x20) 42.6 ms at 4710 ms, present 2197 - Driver.Packet.memory_wait (queue worker 0x20) 41.7 ms at 4554 ms, present 2196 - Driver.Packet.memory_wait (queue worker 0x20) 41.3 ms at 6653 ms, present 2213 - Driver.Packet.memory_wait (queue worker 0x20) 40.8 ms at 8589 ms, present 2229 - Driver.Packet.memory_wait (queue worker 0x20) 40.7 ms at 2771 ms, present 2181 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 365: 14.6 ms at 650 ms, present 2164: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 16.3, Driver.Packet (queue worker 0x20) 1.8, Driver.Packet.dispatch (queue worker 0x20) 1.4, Driver.Dispatch (queue worker 0x20) 1.4 - batch 3045: 11.9 ms at 5433 ms, present 2203: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.4, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.2, Vulkan.Dispatch (queue worker 0x20) 0.6 - batch 1756: 11.6 ms at 3113 ms, present 2184: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 2.1, Driver.Packet.dispatch (queue worker 0x20) 1.6, Driver.Dispatch (queue worker 0x20) 1.5, Driver.Packet.prepare_memory (queue worker 0x20) 0.6 - batch 667: 11.5 ms at 1189 ms, present 2168: GPU no ranges; recorded by Recorder.WaitSerial (queue worker 0x20) 11.7, Driver.Packet (queue worker 0x20) 1.9, Driver.Packet.dispatch (queue worker 0x20) 1.3, Driver.Dispatch (queue worker 0x20) 1.3 - batch 3920: 11.5 ms at 6998 ms, present 2216: GPU no ranges; recorded by Driver.Packet (queue worker 0x20) 1.5, Driver.Packet.dispatch (queue worker 0x20) 1.1, Driver.Dispatch (queue worker 0x20) 1.0, Driver.Packet.prepare_memory (queue worker 0x20) 0.5 </details> ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4060 8 GB, driver 617.42, Windows 10 (tests and benchmark); NVIDIA GeForce RTX 3060 12 GB, driver 617.42, Windows 10 (title runs) - [x] AI-assisted: yes
CnRJay commented 2026-10-16 22:10:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-16T22:10:01Z.

Review: COMMENTED


Good PR: the microbenchmark is clear (buffer detile 1-byte SW_64KB_S 228.9 to 37.9 us, 6x; image retile 2.2x), unchanged SPIR-V for 4/8/16-byte elements is shown (0.98-1.05x), the fallback to the per-element atomic path keeps the bytes identical, and the test compares every byte against a CPU reference including bytes no element maps to.

  • The title runs (Minecraft Dungeons II, Sword of the Sea) show no change, which the description explains. The gain is therefore real only for titles that write back 1- or 2-byte standard-layout images each frame. Name one, or say it is a latent improvement; the speed-up claim in the title shouldn't read as a game-level one.
  • Two new shader variants (WORD_GROUPS, buffer and image) are compiled for every title that detiles 1- or 2-byte formats. Please state the extra compile time on a cold cache and whether the variants are built on first use or prewarmed (the journal/prewarm path has to know them, otherwise they compile on the queue worker at the first write-back).
  • The groups use workgroup shared memory and a barrier. Post the shared memory use per workgroup, since it caps occupancy on some devices (the RTX 4060 only was measured); an AMD or Intel run of agc_detile_small_elements would show the barrier path is correct there too.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5554241179 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#pullrequestreview-5554241179). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-16T22:10:01Z. **Review:** COMMENTED --- Good PR: the microbenchmark is clear (buffer detile 1-byte `SW_64KB_S` 228.9 to 37.9 us, 6x; image retile 2.2x), unchanged SPIR-V for 4/8/16-byte elements is shown (0.98-1.05x), the fallback to the per-element atomic path keeps the bytes identical, and the test compares every byte against a CPU reference including bytes no element maps to. - The title runs (Minecraft Dungeons II, Sword of the Sea) show no change, which the description explains. The gain is therefore real only for titles that write back 1- or 2-byte standard-layout images each frame. Name one, or say it is a latent improvement; the speed-up claim in the title shouldn't read as a game-level one. - Two new shader variants (`WORD_GROUPS`, buffer and image) are compiled for every title that detiles 1- or 2-byte formats. Please state the extra compile time on a cold cache and whether the variants are built on first use or prewarmed (the journal/prewarm path has to know them, otherwise they compile on the queue worker at the first write-back). - The groups use workgroup shared memory and a barrier. Post the shared memory use per workgroup, since it caps occupancy on some devices (the RTX 4060 only was measured); an AMD or Intel run of `agc_detile_small_elements` would show the barrier path is correct there too.
keravyn-ops commented 2026-10-17 09:26:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by keravyn-ops on 2026-10-17T09:26:03Z.


AMD / Windows run of this PR at 1061179c8: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

  • agc_detile_small_elements: pass (0.65 s)
  • agc_driver_graphics: pass (4.95 s)
  • agc_unit_shadow, agc_shadowed_key_stores: pass
  • agc_storage_kept_unit_settle, agc_storage_baseline_settled, agc_storage_integer_clear, agc_storage_upload_lifetime, agc_storage_upload_failure, agc_storage_written_buffer_order, agc_storage_split_writeback, agc_storage_cpu_snapshot: pass

No benchmark run on this device.

AI-assisted: yes (runs made on the device above).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232270985 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6232270985). Originally posted by [keravyn-ops](https://github.com/keravyn-ops) on 2026-10-17T09:26:03Z. --- AMD / Windows run of this PR at 1061179c8: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release. - `agc_detile_small_elements`: pass (0.65 s) - `agc_driver_graphics`: pass (4.95 s) - `agc_unit_shadow`, `agc_shadowed_key_stores`: pass - `agc_storage_kept_unit_settle`, `agc_storage_baseline_settled`, `agc_storage_integer_clear`, `agc_storage_upload_lifetime`, `agc_storage_upload_failure`, `agc_storage_written_buffer_order`, `agc_storage_split_writeback`, `agc_storage_cpu_snapshot`: pass No benchmark run on this device. AI-assisted: yes (runs made on the device above).
parl0v commented 2026-10-17 16:56:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-17T16:56:26Z.


@CnRJay thanks for the review. On the three points:

Latent, not game-level. Agreed. I have no title yet whose frames are bound by 1- or 2-byte detiles: Minecraft Dungeons II and Sword of the Sea write back other formats each frame, so they show no change. I've changed the description to say that this is a throughput fix for those paths and that it makes no frame-rate claim. The title only names what the shader does.

Compile cost and prewarm.

  • The detiler pipelines are driver-internal and have never gone through the journal/prewarm path. TextureDetiler::pipeline creates each one on first use, keyed by (tile mode, element size, retile, thick, image), through context.pipelineCache, and that is unchanged here.
  • The word variants don't add pipelines. Each key selects exactly one variant (words = elementBytes < 4 && ...), so a title that detiles a 1-byte SW_64KB_S texture still creates one pipeline for that key, compiled from the word SPIR-V instead of the old one.
  • The added runtime cost is one vkCreateShaderModule per variant on first use. The difference in pipeline compile time is that of a shader with 3 shared arrays and a barrier over the same addressing code.
  • I'll measure the cold-cache vkCreateComputePipelines time for both variants on my RTX 4060 and post it here; my test box is off for the weekend.

Shared memory and other vendors. groupWords[32], groupLanes[32] and groupDestinations[64] are 128 uints, 512 bytes per 8x8 workgroup. That's 3 % of the 16 KiB Vulkan minimum for maxComputeSharedMemorySize, about 1 % of NVIDIA's 48 KiB and 0.8 % of the 64 KiB LDS on RDNA, so shared memory doesn't limit occupancy on any of them. On the barrier path on AMD: thanks @keravyn-ops for the Radeon 780M (RDNA 3) run at 1061179c8. agc_detile_small_elements passes there, and so do agc_driver_graphics, agc_unit_shadow and the storage tests. Intel hasn't been run yet.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6237105297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6237105297). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-17T16:56:26Z. --- @CnRJay thanks for the review. On the three points: **Latent, not game-level.** Agreed. I have no title yet whose frames are bound by 1- or 2-byte detiles: Minecraft Dungeons II and Sword of the Sea write back other formats each frame, so they show no change. I've changed the description to say that this is a throughput fix for those paths and that it makes no frame-rate claim. The title only names what the shader does. **Compile cost and prewarm.** - The detiler pipelines are driver-internal and have never gone through the journal/prewarm path. `TextureDetiler::pipeline` creates each one on first use, keyed by (tile mode, element size, retile, thick, image), through `context.pipelineCache`, and that is unchanged here. - The word variants don't add pipelines. Each key selects exactly one variant (`words = elementBytes < 4 && ...`), so a title that detiles a 1-byte `SW_64KB_S` texture still creates one pipeline for that key, compiled from the word SPIR-V instead of the old one. - The added runtime cost is one `vkCreateShaderModule` per variant on first use. The difference in pipeline compile time is that of a shader with 3 shared arrays and a barrier over the same addressing code. - I'll measure the cold-cache `vkCreateComputePipelines` time for both variants on my RTX 4060 and post it here; my test box is off for the weekend. **Shared memory and other vendors.** `groupWords[32]`, `groupLanes[32]` and `groupDestinations[64]` are 128 `uint`s, **512 bytes per 8x8 workgroup**. That's 3 % of the 16 KiB Vulkan minimum for `maxComputeSharedMemorySize`, about 1 % of NVIDIA's 48 KiB and 0.8 % of the 64 KiB LDS on RDNA, so shared memory doesn't limit occupancy on any of them. On the barrier path on AMD: thanks @keravyn-ops for the Radeon 780M (RDNA 3) run at 1061179c8. `agc_detile_small_elements` passes there, and so do `agc_driver_graphics`, `agc_unit_shadow` and the storage tests. Intel hasn't been run yet. AI-assisted: yes (Claude Code)
jotitadev commented 2026-10-18 12:22:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-18T12:22:36Z.

Review: COMMENTED


Apple GPU run of the new word-group detile variants. This is a third vendor after NVIDIA and AMD, and Apple GPUs differ here in threadgroup memory and in subgroup width (32).

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 1061179c8. Method: macos-port @ b7eb6b6b + ImportWatched + PR diff, not main. The shader, TextureDetiler.cpp and the shader build rules applied cleanly. Three conflicts came from code the port doesn't have, and I resolved them by hand:

  • TextureDetiler.hpp: added the two new module handles and kept the port's image descriptor pools (the port has no DescriptorRing).

  • CMakeLists.txt: added the agc_detile_small_elements test next to the port's tests.

  • Recorder.cpp: inserted the SmallElementDetileTest namespace and the --small-element-detile-only dispatch without the other recorder tests from main.

  • agc_detile_small_elements passes on MoltenVK 1.4.2 (small element detile tests passed) and on MoltenVK main + SPIRV-Cross #2704. With --repeat until-fail:10 it passes 10/10 on each driver.

  • The word path really runs on this device: with the whole-word store in TextureDetile.comp changed to groupWords[slot] ^ 1u (local mutation, reverted afterwards), the test fails at its first case: SW_64KB_S 1B 37x21, whole mip, buffer retile: byte 0 is 10, expected 11. So the host selects the word variant on Apple, and the test catches a wrong combined word.

  • Neighbouring tests pass: agc_storage_baseline_settled, agc_storage_upload_lifetime, agc_storage_upload_failure and agc_unit_shadow.

No timing measured.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5562971105 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#pullrequestreview-5562971105). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-18T12:22:36Z. **Review:** COMMENTED --- Apple GPU run of the new word-group detile variants. This is a third vendor after NVIDIA and AMD, and Apple GPUs differ here in threadgroup memory and in subgroup width (32). Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 1061179c8. Method: macos-port @ b7eb6b6b + ImportWatched + PR diff, not main. The shader, `TextureDetiler.cpp` and the shader build rules applied cleanly. Three conflicts came from code the port doesn't have, and I resolved them by hand: - `TextureDetiler.hpp`: added the two new module handles and kept the port's image descriptor pools (the port has no `DescriptorRing`). - `CMakeLists.txt`: added the `agc_detile_small_elements` test next to the port's tests. - `Recorder.cpp`: inserted the `SmallElementDetileTest` namespace and the `--small-element-detile-only` dispatch without the other recorder tests from main. - **`agc_detile_small_elements` passes** on MoltenVK 1.4.2 (`small element detile tests passed`) and on MoltenVK main + SPIRV-Cross #2704. With `--repeat until-fail:10` it passes 10/10 on each driver. - **The word path really runs on this device:** with the whole-word store in `TextureDetile.comp` changed to `groupWords[slot] ^ 1u` (local mutation, reverted afterwards), the test fails at its first case: `SW_64KB_S 1B 37x21, whole mip, buffer retile: byte 0 is 10, expected 11`. So the host selects the word variant on Apple, and the test catches a wrong combined word. - **Neighbouring tests pass:** `agc_storage_baseline_settled`, `agc_storage_upload_lifetime`, `agc_storage_upload_failure` and `agc_unit_shadow`. No timing measured. GPUs tested: Apple M2 Max (MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704) Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
github-actions[bot] commented 2026-10-18 20:48:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T20:48:24Z.


This pull request is labeled perf, so it needs the summary line of a capture on main and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both aps5-summary.jsonl lines, attach the two traces and add the output of tools/trace_digest.py.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254967983 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6254967983). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T20:48:24Z. --- <!-- pr-labels-perf --> This pull request is labeled `perf`, so it needs the summary line of a capture on `main` and one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste both `aps5-summary.jsonl` lines, attach the two traces and add the output of `tools/trace_digest.py`.
parl0v commented 2026-10-18 22:09:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-18T22:09:10Z.


Traces of the performance capture in the description (they open in ui.perfetto.dev):

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6255758398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6255758398). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-18T22:09:10Z. --- Traces of the performance capture in the description (they open in ui.perfetto.dev): - `main` 48d61f53b: [aps5-trace-48d61f53b46f-9720.json.gz](https://github.com/parl0v/AnyPS5/releases/download/perf-traces-2026-10-18/aps5-trace-48d61f53b46f-9720.json.gz) - this PR: [aps5-trace-283b057afe16-15136.json.gz](https://github.com/parl0v/AnyPS5/releases/download/perf-traces-2026-10-18/aps5-trace-283b057afe16-15136.json.gz)
jotitadev commented 2026-10-19 00:00:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T00:00:58Z.


Follow-up to my Apple run above: the full suite, which I left out there, is now done.

Full ^agc suite with the PR on Apple M2 Max (MoltenVK 1.4.2, -j1 --timeout 30, flip/display/lds_atomics64 excluded; macos-port @ b7eb6b6b + ImportWatched + PR diff, not main): 14 failures out of 434, the same 14 as the unchanged port on this machine today (14 out of 433). The extra test is agc_detile_small_elements, which passes. No timeouts.

The new head 283b057af is a rebase: git range-diff against 1061179c8 shows only context lines from main, so this applies to it too.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6256793825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6256793825). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T00:00:58Z. --- <!-- head: 283b057af (rebase of 1061179c8; PR commit identical apart from context lines) --> Follow-up to my Apple run above: the full suite, which I left out there, is now done. Full `^agc` suite with the PR on Apple M2 Max (MoltenVK 1.4.2, `-j1 --timeout 30`, flip/display/lds_atomics64 excluded; macos-port @ b7eb6b6b + ImportWatched + PR diff, not main): 14 failures out of 434, the same 14 as the unchanged port on this machine today (14 out of 433). The extra test is `agc_detile_small_elements`, which passes. No timeouts. The new head 283b057af is a rebase: `git range-diff` against 1061179c8 shows only context lines from `main`, so this applies to it too. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
oneandonlydean commented 2026-10-20 18:11:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:11:21Z.


@parl0v this now conflicts with main in Graphics/src/TextureDetiler.cpp (around lines 171-182). #6436 merged today and routes every shader module creation through Graphics::CreateShaderModule(..., label), so modules are keyed by the pipeline-library mode. This PR still builds its word-variant modules inline with its own VkShaderModuleCreateInfo.

Could you rebase onto current main and create the word variants (words / imageWordModule) through CreateShaderModule, each with its own label? The other files merge cleanly. Once the head moves we'll re-review the delta and re-run CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297825319 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6297825319). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T18:11:21Z. --- @parl0v this now conflicts with `main` in `Graphics/src/TextureDetiler.cpp` (around lines 171-182). #6436 merged today and routes every shader module creation through `Graphics::CreateShaderModule(..., label)`, so modules are keyed by the pipeline-library mode. This PR still builds its word-variant modules inline with its own `VkShaderModuleCreateInfo`. Could you rebase onto current `main` and create the word variants (`words` / `imageWordModule`) through `CreateShaderModule`, each with its own label? The other files merge cleanly. Once the head moves we'll re-review the delta and re-run CI.
parl0v commented 2026-10-21 01:11:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-21T01:11:44Z.


@oneandonlydean rebased onto current main (f41aa9598). The word variants now go through CreateShaderModule, each with its own label: vkCreateShaderModule detile words for the buffer word module and vkCreateShaderModule detile image words for imageWordModule; the existing image module keeps its label. Nothing else changed in the PR.

RTX 4060 (NVIDIA 617.42, Windows 10 19045), with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1: agc_detile_small_elements, agc_import_watch and the other recorder/detile/retile tests pass (6 of 6), 0 VUID- lines, and the layer loaded.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305497794 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6905#issuecomment-6305497794). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-21T01:11:44Z. --- @oneandonlydean rebased onto current `main` (f41aa9598). The word variants now go through `CreateShaderModule`, each with its own label: `vkCreateShaderModule detile words` for the buffer word module and `vkCreateShaderModule detile image words` for `imageWordModule`; the existing image module keeps its label. Nothing else changed in the PR. RTX 4060 (NVIDIA 617.42, Windows 10 19045), with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1`: `agc_detile_small_elements`, `agc_import_watch` and the other recorder/detile/retile tests pass (6 of 6), 0 `VUID-` lines, and the layer loaded.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6905
No description provided.