perf(agc): reuse a storage image's import segments while the mapping and import table are unchanged #18075

Merged
klosixgaming-arch merged 7 commits from upstream-pr/18075 into main 2026-11-16 05:44:20 +00:00
klosixgaming-arch commented 2026-11-10 09:52:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-11-10T09:52:03Z.


What

StorageTexture::importSegments walked the registered allocations and looked up a host import for every piece at each refresh of a storage image. A storage image now keeps its last result, with the guest mapping generation and the host-import table identity it was computed under. It reuses that result while both are unchanged, and touches the reused imports so their eviction order stays as before. The check and the touch happen under the imports lock, and the memo has its own mutex. APS5_NO_IMPORT_SEGMENT_MEMO turns it off, and APS5_AB can toggle it.

Tested

Summary lines of main and of this PR (2026-11-10, same machine and session)

Cyberpunk 2077 (PPSA03974), the intro movie, 3200x1800, warm caches; Windows 11, RTX 5090 (driver 617.42), Ryzen 9 9950X3D. Each line is its own run with no switches but the capture ones (APS5_TRACE_SECONDS=60:10, APS5_TRACE_SUMMARY_EVERY=10, APS5_TRACE_EVENTS=1048576) and, where the line shows it, an in-run A/B that starts after the trace window. Traces and all summary lines: https://github.com/klosixgaming-arch/AnyPS5/releases/tag/perf-captures-2026-11-10

main 3339e01f59:

{"commit":"3339e01f5961","dirty":false,"env":{"APS5_LOG_TIMESTAMPS":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"60:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 9950X3D 16-Core Processor","cpu_threads":32,"memory_mib":194197,"title_id":"PPSA03974","title":"Cyberpunk 2077","content_version":"02.120.000","resolution":"3200x1800","window":{"spec":"seconds 60:10","first_present":357,"ms":10024.712},"presents":43,"frame_ms":{"p50":231.356,"p90":246.036,"p99":261.798,"max":261.798},"gpu_busy_ms_per_present":42.981,"worker_busy_pct":{"queue worker 0x0":99.533,"queue worker 0x23":99.965},"top_phases_ms_per_frame":{"Driver.Packet":453.350,"Driver.Packet.dispatch":218.773,"Driver.Packet.memory_wait":205.130,"Driver.Dispatch":153.578,"Vulkan.Dispatch":102.389,"Vulkan.Dispatch.shader_resources":97.225,"Graphics.Draw":67.192,"Graphics.Draw.draw_and_resource_release":65.999},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-3339e01f5961-53448.json.gz"}

this PR merged with main, 5d9aaf02dc (now the PR head):

{"commit":"5d9aaf02dc29","dirty":false,"env":{"APS5_LOG_TIMESTAMPS":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"60:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 9950X3D 16-Core Processor","cpu_threads":32,"memory_mib":194197,"title_id":"PPSA03974","title":"Cyberpunk 2077","content_version":"02.120.000","resolution":"3200x1800","window":{"spec":"seconds 60:10","first_present":359,"ms":10028.497},"presents":44,"frame_ms":{"p50":227.204,"p90":241.407,"p99":244.378,"max":244.378},"gpu_busy_ms_per_present":44.796,"worker_busy_pct":{"queue worker 0x0":99.500,"queue worker 0x23":99.828},"top_phases_ms_per_frame":{"Driver.Packet":442.884,"Driver.Packet.dispatch":216.596,"Driver.Packet.memory_wait":198.662,"Driver.Dispatch":151.964,"Vulkan.Dispatch":101.300,"Vulkan.Dispatch.shader_resources":95.980,"Graphics.Draw":64.412,"Graphics.Draw.draw_and_resource_release":63.114},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-5d9aaf02dc29-67524.json.gz"}

Steady 10 s windows 3 to 7 of the movie: main 43.6 presents, this PR 44.4. The PR side is the PR merged with main e95cc604e2, six commits after the main capture (libSceNpWebApi, macOS and freetype build files, one RunReport.cpp line); none of them touches the AGC driver or guest memory. Separate runs differ here by more than these changes. For example, #18078's switch makes no difference in its own in-run A/B, yet its run and #17786's run differ by 8% in the same windows. main itself ran 43.0 and 43.6 (3339e01f59) and 47.0 (e95cc604e2, the main merged into this PR, a run at 22:20 that is also in the release) in the same windows. So the in-run A/B on the PR's commit is the measure. On 5d9aaf02dc, APS5_AB=10:APS5_NO_IMPORT_SEGMENT_MEMO from 40 s, 11 B phases inside the movie: no difference in this scene (+0.24 +- 0.69). The gain is on the Body Type screen with the series (below), where storage images are refreshed at every draw. Recorder.Sync slices per present in the trace windows: main 44.0, this PR 41.6.

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        42.39      42.70      +0.31    +0.7%   +0.24 +- 0.69 (SD 2.28, n 11)
frame ms                           236.56     235.10      -1.46    -0.6%   -1.03 +- 4.01 (SD 13.31, n 11)
trace_digest.py, main 3339e01f59

seconds 60:10 from present 357: 43 presents, frame p50 231.4 / p90 246.0 / p99 261.8 / max 261.8 ms, GPU busy 43.0 ms per present
NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit 3339e01f59, dropped: no

Slowest frames (largest slices inside each, inclusive)

  • present 395: 261.8 ms at 8861 ms: Driver.Packet (queue worker 0x23) 254.4, Driver.Packet (queue worker 0x0) 248.9, Driver.Packet.memory_wait (queue worker 0x23) 220.7, Driver.Packet.dispatch (queue worker 0x0) 214.1
  • present 387: 256.8 ms at 7022 ms: Driver.Packet (queue worker 0x23) 250.7, Driver.Packet (queue worker 0x0) 244.5, Driver.Packet.memory_wait (queue worker 0x23) 218.0, Driver.Packet.dispatch (queue worker 0x0) 210.5
  • present 371: 250.5 ms at 3260 ms: Driver.Packet (queue worker 0x23) 245.9, Driver.Packet (queue worker 0x0) 237.9, Driver.Packet.memory_wait (queue worker 0x23) 211.7, Driver.Packet.dispatch (queue worker 0x0) 204.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 202.8 (87 %) 25.7 (11 %) 4.6 12.9 Driver.Packet 221.4, Driver.EndSubmission 7.1
draw committer 74.4 (32 %) 12.1 (5 %) 146.7 1.5 Graphics.Draw 67.2, Vulkan.DrawFromRecipe 11.1
presenter 1.4 (1 %) 0.0 (0 %) 231.7 0.1 VideoOut.Flip 1.4
title 0.1 (0 %) 0.1 (0 %) 233.0 0.0 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
title 0.1 (0 %) 0.1 (0 %) 233.0 0.0 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsAbi 0.0
queue worker 0x23 21.4 (9 %) 208.4 (89 %) 3.3 2.3 Driver.Packet 225.3, Driver.EndSubmission 4.5
gpu 43.0 (18 %) 0.0 (0 %) 190.1 0.0 batch 43.0

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 446.7, Driver.Packet.dispatch 218.6, Driver.Packet.memory_wait 202.4, Driver.Dispatch 153.2, Vulkan.Dispatch 102.0

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x23) 139.7 ms at 7147 ms, present 387
  • Driver.Packet.memory_wait (queue worker 0x23) 135.9 ms at 3136 ms, present 370
  • Driver.Packet.memory_wait (queue worker 0x23) 133.5 ms at 6901 ms, present 386
  • Driver.Packet.memory_wait (queue worker 0x23) 132.5 ms at 5035 ms, present 378
  • Driver.Packet.memory_wait (queue worker 0x23) 131.7 ms at 1485 ms, present 363

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

  • batch 29422: 11.4 ms at 7188 ms, present 387: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 13.4, Driver.Packet.dispatch (queue worker 0x0) 13.4, Driver.Dispatch (queue worker 0x0) 13.3, Vulkan.Dispatch (queue worker 0x0) 12.6
  • batch 29162: 10.6 ms at 6703 ms, present 385: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 12.7, Driver.Packet.dispatch (queue worker 0x0) 12.7, Driver.Dispatch (queue worker 0x0) 12.6, Vulkan.Dispatch (queue worker 0x0) 12.1
  • batch 30700: 10.4 ms at 9499 ms, present 397: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.7, Driver.Packet.dispatch (queue worker 0x0) 11.7, Driver.Dispatch (queue worker 0x0) 11.6, Vulkan.Dispatch (queue worker 0x0) 11.2
trace_digest.py, this PR 5d9aaf02dc

seconds 60:10 from present 359: 44 presents, frame p50 227.2 / p90 241.4 / p99 244.4 / max 244.4 ms, GPU busy 44.8 ms per present
NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit 5d9aaf02dc, dropped: no

Slowest frames (largest slices inside each, inclusive)

  • present 387: 244.4 ms at 6262 ms: Driver.Packet (queue worker 0x23) 238.3, Driver.Packet (queue worker 0x0) 234.7, Driver.Packet.memory_wait (queue worker 0x23) 204.2, Driver.Packet.dispatch (queue worker 0x0) 201.6
  • present 397: 244.1 ms at 8627 ms: Driver.Packet (queue worker 0x23) 239.2, Driver.Packet (queue worker 0x0) 230.0, Driver.Packet.memory_wait (queue worker 0x23) 204.6, Driver.Packet.dispatch (queue worker 0x0) 196.1
  • present 394: 242.6 ms at 7910 ms: Driver.Packet (queue worker 0x23) 240.6, Driver.Packet (queue worker 0x0) 228.9, Driver.Packet.memory_wait (queue worker 0x23) 203.4, Driver.Packet.dispatch (queue worker 0x0) 195.8

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 198.3 (87 %) 24.9 (11 %) 4.8 13.1 Driver.Packet 216.3, Driver.EndSubmission 6.8
draw committer 71.8 (32 %) 12.9 (6 %) 143.3 1.5 Graphics.Draw 64.4, Vulkan.DrawFromRecipe 11.0
presenter 1.9 (1 %) 0.0 (0 %) 226.0 0.1 VideoOut.Flip 1.9
queue worker 0x23 21.9 (10 %) 202.5 (89 %) 3.5 2.4 Driver.Packet 219.9, Driver.EndSubmission 4.5
gpu 44.8 (20 %) 0.0 (0 %) 183.1 0.0 batch 44.8

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 436.2, Driver.Packet.dispatch 216.4, Driver.Packet.memory_wait 196.0, Driver.Dispatch 151.5, Vulkan.Dispatch 100.9

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x23) 136.7 ms at 8025 ms, present 394
  • Driver.Packet.memory_wait (queue worker 0x23) 134.8 ms at 6378 ms, present 387
  • Driver.Packet.memory_wait (queue worker 0x23) 133.8 ms at 9424 ms, present 400
  • Driver.Packet.memory_wait (queue worker 0x23) 131.6 ms at 6622 ms, present 388
  • Driver.Packet.memory_wait (queue worker 0x23) 131.5 ms at 540 ms, present 361

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

  • batch 28058: 12.4 ms at 6417 ms, present 387: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.9, Driver.Packet.dispatch (queue worker 0x0) 11.9, Driver.Dispatch (queue worker 0x0) 11.8, Vulkan.Dispatch (queue worker 0x0) 11.3
  • batch 27419: 11.1 ms at 5277 ms, present 382: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.4, Driver.Packet.dispatch (queue worker 0x0) 11.4, Driver.Dispatch (queue worker 0x0) 11.3, Vulkan.Dispatch (queue worker 0x0) 10.8
  • batch 25149: 11.1 ms at 1271 ms, present 364: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.8, Driver.Packet.dispatch (queue worker 0x0) 11.8, Driver.Dispatch (queue worker 0x0) 11.7, Vulkan.Dispatch (queue worker 0x0) 11.2

Windows 11, NVIDIA GeForce RTX 5090, Ryzen 9 9950X3D. Cyberpunk 2077 (PPSA03974), character creator, Body Type screen, warm caches, APS5_PROFILE_DRAW=1.

All numbers are in-run A/B: one run flips the PR's switch every 30 s (APS5_AB=30:<switch>, APS5_AB_START=170s or 200s), and tools/ab_split.py compares each B phase (switch set, the old behaviour) with its neighbouring A phases (this PR). Both sides use the same build, settings and scene.

"The series" below is my Cyberpunk tree: f5fe807353 with #11485, #10443 (APS5_SETTLE_FLOOR_KIB=64), the APS5_CAPTURE_UNPROVEN_PENDING capture experiment, #17786, per-block walk reuse (#17766's model), dispatch items for dispatch-cache misses (local, with APS5_PIPELINE_DISPATCH=1), and the earlier PRs of the series. main cannot reach this screen without the capture experiment (the storage write-back abort), so the main runs below carry that one commit too.

On the series (APS5_AB=30:APS5_NO_IMPORT_SEGMENT_MEMO, 8 B phases):

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        36.95      35.67      -1.28    -3.5%   -1.30 +- 0.18 (SD 0.51, n 8)
frame ms                           270.68     280.39      +9.71    +3.6%   +9.90 +- 1.39 (SD 3.94, n 8)

On main (c51f4560c5 with this PR and the capture experiment, 11 B phases):

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        22.40      22.39      -0.01    -0.0%   -0.00 +- 0.05 (SD 0.17, n 11)
frame ms                           446.42     446.62      +0.20    +0.0%   +0.11 +- 1.09 (SD 3.62, n 11)

So the change is 3.6% on the series (7 SE) and nothing on main alone. On main the screen runs at 2.2 fps and is limited elsewhere.

Tests (Windows, RTX 5090): built agc_driver_recorder_tests and agc_runtime_switches_tests on main c51f4560c5 with this PR and ran ctest -R '^(agc_import_.*|agc_storage_.*|agc_.*_import_.*|agc_copied_write_back|agc_runtime_switches.*)$'. 48 tests pass, including all agc_storage_* and agc_import_* tests. 12 did not run here: their binaries belong to targets I didn't build, or fail to start on this machine with 0xc0000139, a DLL entry point not found. The PR is now rebased on current main.

Series

These PRs come from the same work on Cyberpunk 2077's character creator, Body Type screen, where the draw committer and queue worker 0 are the limit. They go together:

PR change gain on the series (in-run A/B)
#17786 share collect walks between threads after the caller's ordering point +11.9%
#17766 (chitters2004) per-64 KiB block observation table; I measured this reuse model on top of #17786 +2.6%
#18078 reuse an equal untracked compare made after the caller's ordering point (needs #17786) +3.2%
#18075 reuse a storage image's import segments while the mapping and import table are unchanged +3.6%
#18076 prove an untracked storage image unchanged from an equal compare +2.7% on its first head; now a draft, because its fix for compared host imports removes the gain
#18102 reuse a walk after the ordering point when storage results become pending +4.2% (intro movie)

Each gain was measured with the earlier rows already in place, so the rows add up. The last row was measured on the intro movie, the others on Body Type; both scenes are limited by the same draw committer. Most of them are small or zero on main alone, because main is limited elsewhere on this screen; each PR says what it measured there. Not a PR: ANYPS5_PRESENT_MODE=mailbox gave +12 to 14% and immediate +18 to 21% on the same screen, because FIFO holds the flip that the next frame's rendering wait waits for.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5239252586 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18075). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-11-10T09:52:03Z. --- ### What `StorageTexture::importSegments` walked the registered allocations and looked up a host import for every piece at each refresh of a storage image. A storage image now keeps its last result, with the guest mapping generation and the host-import table identity it was computed under. It reuses that result while both are unchanged, and touches the reused imports so their eviction order stays as before. The check and the touch happen under the imports lock, and the memo has its own mutex. `APS5_NO_IMPORT_SEGMENT_MEMO` turns it off, and `APS5_AB` can toggle it. ### Tested **Summary lines of `main` and of this PR** (2026-11-10, same machine and session) Cyberpunk 2077 (PPSA03974), the intro movie, 3200x1800, warm caches; Windows 11, RTX 5090 (driver 617.42), Ryzen 9 9950X3D. Each line is its own run with no switches but the capture ones (`APS5_TRACE_SECONDS=60:10`, `APS5_TRACE_SUMMARY_EVERY=10`, `APS5_TRACE_EVENTS=1048576`) and, where the line shows it, an in-run A/B that starts after the trace window. Traces and all summary lines: https://github.com/klosixgaming-arch/AnyPS5/releases/tag/perf-captures-2026-11-10 `main` `3339e01f59`: ```json {"commit":"3339e01f5961","dirty":false,"env":{"APS5_LOG_TIMESTAMPS":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"60:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 9950X3D 16-Core Processor","cpu_threads":32,"memory_mib":194197,"title_id":"PPSA03974","title":"Cyberpunk 2077","content_version":"02.120.000","resolution":"3200x1800","window":{"spec":"seconds 60:10","first_present":357,"ms":10024.712},"presents":43,"frame_ms":{"p50":231.356,"p90":246.036,"p99":261.798,"max":261.798},"gpu_busy_ms_per_present":42.981,"worker_busy_pct":{"queue worker 0x0":99.533,"queue worker 0x23":99.965},"top_phases_ms_per_frame":{"Driver.Packet":453.350,"Driver.Packet.dispatch":218.773,"Driver.Packet.memory_wait":205.130,"Driver.Dispatch":153.578,"Vulkan.Dispatch":102.389,"Vulkan.Dispatch.shader_resources":97.225,"Graphics.Draw":67.192,"Graphics.Draw.draw_and_resource_release":65.999},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-3339e01f5961-53448.json.gz"} ``` this PR merged with `main`, `5d9aaf02dc` (now the PR head): ```json {"commit":"5d9aaf02dc29","dirty":false,"env":{"APS5_LOG_TIMESTAMPS":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"60:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 9 9950X3D 16-Core Processor","cpu_threads":32,"memory_mib":194197,"title_id":"PPSA03974","title":"Cyberpunk 2077","content_version":"02.120.000","resolution":"3200x1800","window":{"spec":"seconds 60:10","first_present":359,"ms":10028.497},"presents":44,"frame_ms":{"p50":227.204,"p90":241.407,"p99":244.378,"max":244.378},"gpu_busy_ms_per_present":44.796,"worker_busy_pct":{"queue worker 0x0":99.500,"queue worker 0x23":99.828},"top_phases_ms_per_frame":{"Driver.Packet":442.884,"Driver.Packet.dispatch":216.596,"Driver.Packet.memory_wait":198.662,"Driver.Dispatch":151.964,"Vulkan.Dispatch":101.300,"Vulkan.Dispatch.shader_resources":95.980,"Graphics.Draw":64.412,"Graphics.Draw.draw_and_resource_release":63.114},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-5d9aaf02dc29-67524.json.gz"} ``` Steady 10 s windows 3 to 7 of the movie: `main` 43.6 presents, this PR 44.4. The PR side is the PR merged with `main` `e95cc604e2`, six commits after the `main` capture (libSceNpWebApi, macOS and freetype build files, one `RunReport.cpp` line); none of them touches the AGC driver or guest memory. Separate runs differ here by more than these changes. For example, #18078's switch makes no difference in its own in-run A/B, yet its run and #17786's run differ by 8% in the same windows. `main` itself ran 43.0 and 43.6 (`3339e01f59`) and 47.0 (`e95cc604e2`, the `main` merged into this PR, a run at 22:20 that is also in the release) in the same windows. So the in-run A/B on the PR's commit is the measure. On `5d9aaf02dc`, `APS5_AB=10:APS5_NO_IMPORT_SEGMENT_MEMO` from 40 s, 11 B phases inside the movie: no difference in this scene (+0.24 +- 0.69). The gain is on the Body Type screen with the series (below), where storage images are refreshed at every draw. `Recorder.Sync` slices per present in the trace windows: `main` 44.0, this PR 41.6. ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 42.39 42.70 +0.31 +0.7% +0.24 +- 0.69 (SD 2.28, n 11) frame ms 236.56 235.10 -1.46 -0.6% -1.03 +- 4.01 (SD 13.31, n 11) ``` <details><summary>trace_digest.py, main 3339e01f59</summary> **seconds 60:10** from present 357: 43 presents, frame p50 231.4 / p90 246.0 / p99 261.8 / max 261.8 ms, GPU busy 43.0 ms per present NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit 3339e01f5961, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 395: 261.8 ms at 8861 ms: Driver.Packet (queue worker 0x23) 254.4, Driver.Packet (queue worker 0x0) 248.9, Driver.Packet.memory_wait (queue worker 0x23) 220.7, Driver.Packet.dispatch (queue worker 0x0) 214.1 - present 387: 256.8 ms at 7022 ms: Driver.Packet (queue worker 0x23) 250.7, Driver.Packet (queue worker 0x0) 244.5, Driver.Packet.memory_wait (queue worker 0x23) 218.0, Driver.Packet.dispatch (queue worker 0x0) 210.5 - present 371: 250.5 ms at 3260 ms: Driver.Packet (queue worker 0x23) 245.9, Driver.Packet (queue worker 0x0) 237.9, Driver.Packet.memory_wait (queue worker 0x23) 211.7, Driver.Packet.dispatch (queue worker 0x0) 204.1 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 202.8 (87 %) | 25.7 (11 %) | 4.6 | 12.9 | Driver.Packet 221.4, Driver.EndSubmission 7.1 | | draw committer | 74.4 (32 %) | 12.1 (5 %) | 146.7 | 1.5 | Graphics.Draw 67.2, Vulkan.DrawFromRecipe 11.1 | | presenter | 1.4 (1 %) | 0.0 (0 %) | 231.7 | 0.1 | VideoOut.Flip 1.4 | | title | 0.1 (0 %) | 0.1 (0 %) | 233.0 | 0.0 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | title | 0.1 (0 %) | 0.1 (0 %) | 233.0 | 0.0 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsAbi 0.0 | | queue worker 0x23 | 21.4 (9 %) | 208.4 (89 %) | 3.3 | 2.3 | Driver.Packet 225.3, Driver.EndSubmission 4.5 | | gpu | 43.0 (18 %) | 0.0 (0 %) | 190.1 | 0.0 | batch 43.0 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 446.7, Driver.Packet.dispatch 218.6, Driver.Packet.memory_wait 202.4, Driver.Dispatch 153.2, Vulkan.Dispatch 102.0 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x23) 139.7 ms at 7147 ms, present 387 - Driver.Packet.memory_wait (queue worker 0x23) 135.9 ms at 3136 ms, present 370 - Driver.Packet.memory_wait (queue worker 0x23) 133.5 ms at 6901 ms, present 386 - Driver.Packet.memory_wait (queue worker 0x23) 132.5 ms at 5035 ms, present 378 - Driver.Packet.memory_wait (queue worker 0x23) 131.7 ms at 1485 ms, present 363 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 29422: 11.4 ms at 7188 ms, present 387: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 13.4, Driver.Packet.dispatch (queue worker 0x0) 13.4, Driver.Dispatch (queue worker 0x0) 13.3, Vulkan.Dispatch (queue worker 0x0) 12.6 - batch 29162: 10.6 ms at 6703 ms, present 385: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 12.7, Driver.Packet.dispatch (queue worker 0x0) 12.7, Driver.Dispatch (queue worker 0x0) 12.6, Vulkan.Dispatch (queue worker 0x0) 12.1 - batch 30700: 10.4 ms at 9499 ms, present 397: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.7, Driver.Packet.dispatch (queue worker 0x0) 11.7, Driver.Dispatch (queue worker 0x0) 11.6, Vulkan.Dispatch (queue worker 0x0) 11.2 </details> <details><summary>trace_digest.py, this PR 5d9aaf02dc</summary> **seconds 60:10** from present 359: 44 presents, frame p50 227.2 / p90 241.4 / p99 244.4 / max 244.4 ms, GPU busy 44.8 ms per present NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit 5d9aaf02dc29, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 387: 244.4 ms at 6262 ms: Driver.Packet (queue worker 0x23) 238.3, Driver.Packet (queue worker 0x0) 234.7, Driver.Packet.memory_wait (queue worker 0x23) 204.2, Driver.Packet.dispatch (queue worker 0x0) 201.6 - present 397: 244.1 ms at 8627 ms: Driver.Packet (queue worker 0x23) 239.2, Driver.Packet (queue worker 0x0) 230.0, Driver.Packet.memory_wait (queue worker 0x23) 204.6, Driver.Packet.dispatch (queue worker 0x0) 196.1 - present 394: 242.6 ms at 7910 ms: Driver.Packet (queue worker 0x23) 240.6, Driver.Packet (queue worker 0x0) 228.9, Driver.Packet.memory_wait (queue worker 0x23) 203.4, Driver.Packet.dispatch (queue worker 0x0) 195.8 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 198.3 (87 %) | 24.9 (11 %) | 4.8 | 13.1 | Driver.Packet 216.3, Driver.EndSubmission 6.8 | | draw committer | 71.8 (32 %) | 12.9 (6 %) | 143.3 | 1.5 | Graphics.Draw 64.4, Vulkan.DrawFromRecipe 11.0 | | presenter | 1.9 (1 %) | 0.0 (0 %) | 226.0 | 0.1 | VideoOut.Flip 1.9 | | queue worker 0x23 | 21.9 (10 %) | 202.5 (89 %) | 3.5 | 2.4 | Driver.Packet 219.9, Driver.EndSubmission 4.5 | | gpu | 44.8 (20 %) | 0.0 (0 %) | 183.1 | 0.0 | batch 44.8 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 436.2, Driver.Packet.dispatch 216.4, Driver.Packet.memory_wait 196.0, Driver.Dispatch 151.5, Vulkan.Dispatch 100.9 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x23) 136.7 ms at 8025 ms, present 394 - Driver.Packet.memory_wait (queue worker 0x23) 134.8 ms at 6378 ms, present 387 - Driver.Packet.memory_wait (queue worker 0x23) 133.8 ms at 9424 ms, present 400 - Driver.Packet.memory_wait (queue worker 0x23) 131.6 ms at 6622 ms, present 388 - Driver.Packet.memory_wait (queue worker 0x23) 131.5 ms at 540 ms, present 361 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 28058: 12.4 ms at 6417 ms, present 387: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.9, Driver.Packet.dispatch (queue worker 0x0) 11.9, Driver.Dispatch (queue worker 0x0) 11.8, Vulkan.Dispatch (queue worker 0x0) 11.3 - batch 27419: 11.1 ms at 5277 ms, present 382: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.4, Driver.Packet.dispatch (queue worker 0x0) 11.4, Driver.Dispatch (queue worker 0x0) 11.3, Vulkan.Dispatch (queue worker 0x0) 10.8 - batch 25149: 11.1 ms at 1271 ms, present 364: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.8, Driver.Packet.dispatch (queue worker 0x0) 11.8, Driver.Dispatch (queue worker 0x0) 11.7, Vulkan.Dispatch (queue worker 0x0) 11.2 </details> Windows 11, NVIDIA GeForce RTX 5090, Ryzen 9 9950X3D. Cyberpunk 2077 (PPSA03974), character creator, Body Type screen, warm caches, `APS5_PROFILE_DRAW=1`. All numbers are in-run A/B: one run flips the PR's switch every 30 s (`APS5_AB=30:<switch>`, `APS5_AB_START=170s` or `200s`), and `tools/ab_split.py` compares each B phase (switch set, the old behaviour) with its neighbouring A phases (this PR). Both sides use the same build, settings and scene. "The series" below is my Cyberpunk tree: `f5fe807353` with #11485, #10443 (`APS5_SETTLE_FLOOR_KIB=64`), the `APS5_CAPTURE_UNPROVEN_PENDING` capture experiment, #17786, per-block walk reuse (#17766's model), dispatch items for dispatch-cache misses (local, with `APS5_PIPELINE_DISPATCH=1`), and the earlier PRs of the series. `main` cannot reach this screen without the capture experiment (the storage write-back abort), so the `main` runs below carry that one commit too. **On the series** (`APS5_AB=30:APS5_NO_IMPORT_SEGMENT_MEMO`, 8 B phases): ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 36.95 35.67 -1.28 -3.5% -1.30 +- 0.18 (SD 0.51, n 8) frame ms 270.68 280.39 +9.71 +3.6% +9.90 +- 1.39 (SD 3.94, n 8) ``` **On `main`** (`c51f4560c5` with this PR and the capture experiment, 11 B phases): ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 22.40 22.39 -0.01 -0.0% -0.00 +- 0.05 (SD 0.17, n 11) frame ms 446.42 446.62 +0.20 +0.0% +0.11 +- 1.09 (SD 3.62, n 11) ``` So the change is 3.6% on the series (7 SE) and nothing on `main` alone. On `main` the screen runs at 2.2 fps and is limited elsewhere. **Tests** (Windows, RTX 5090): built `agc_driver_recorder_tests` and `agc_runtime_switches_tests` on `main` `c51f4560c5` with this PR and ran `ctest -R '^(agc_import_.*|agc_storage_.*|agc_.*_import_.*|agc_copied_write_back|agc_runtime_switches.*)$'`. 48 tests pass, including all `agc_storage_*` and `agc_import_*` tests. 12 did not run here: their binaries belong to targets I didn't build, or fail to start on this machine with 0xc0000139, a DLL entry point not found. The PR is now rebased on current `main`. ### Series These PRs come from the same work on Cyberpunk 2077's character creator, Body Type screen, where the draw committer and queue worker 0 are the limit. They go together: | PR | change | gain on the series (in-run A/B) | |---|---|---| | #17786 | share collect walks between threads after the caller's ordering point | +11.9% | | #17766 (chitters2004) | per-64 KiB block observation table; I measured this reuse model on top of #17786 | +2.6% | | #18078 | reuse an equal untracked compare made after the caller's ordering point (needs #17786) | +3.2% | | #18075 | reuse a storage image's import segments while the mapping and import table are unchanged | +3.6% | | #18076 | prove an untracked storage image unchanged from an equal compare | +2.7% on its first head; now a draft, because its fix for compared host imports removes the gain | | #18102 | reuse a walk after the ordering point when storage results become pending | +4.2% (intro movie) | Each gain was measured with the earlier rows already in place, so the rows add up. The last row was measured on the intro movie, the others on Body Type; both scenes are limited by the same draw committer. Most of them are small or zero on `main` alone, because `main` is limited elsewhere on this screen; each PR says what it measured there. Not a PR: `ANYPS5_PRESENT_MODE=mailbox` gave +12 to 14% and `immediate` +18 to 21% on the same screen, because FIFO holds the flip that the next frame's rendering wait waits for. ### 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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11 - [x] AI-assisted: yes
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!18075
No description provided.