perf(agc): prove an untracked storage image unchanged from an equal compare #18076

Closed
klosixgaming-arch wants to merge 5 commits from upstream-pr/18076 into main
klosixgaming-arch commented 2026-11-10 09:52:05 +00:00 (Migrated from github.com)

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


What

A storage image whose memory is outside the write watch had no refresh proof, so every refresh took the full path even when nothing had changed: flush checks, import segments, keys and saved write-back waits. On Cyberpunk 2077's Body Type screen that is about 2,500 full refreshes per second.

Such an image, if it has no DCC metadata, now takes a proof like a tracked one. A later refresh accepts the proof when all of these hold:

  • A compare of the whole guest range against the bytes the image was uploaded from finds no difference. This is usually a hit in the existing compare memo, and a much more frequent one with #18078.
  • No saved write-back and no kept-at-unwatch unit is outstanding.
  • Its keys are unchanged.
  • No other image's pending results overlap it.

APS5_NO_UNTRACKED_REFRESH_PROOF 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, b1e916a7de (now the PR head):

{"commit":"b1e916a7de88","dirty":false,"env":{"APS5_AB":"10:APS5_NO_UNTRACKED_REFRESH_PROOF","APS5_AB_START":"80s","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":10045.167},"presents":45,"frame_ms":{"p50":220.969,"p90":235.376,"p99":240.999,"max":240.999},"gpu_busy_ms_per_present":43.508,"worker_busy_pct":{"queue worker 0x0":99.489,"queue worker 0x23":99.911},"top_phases_ms_per_frame":{"Driver.Packet":434.489,"Driver.Packet.dispatch":207.557,"Driver.Packet.memory_wait":200.358,"Driver.Dispatch":143.767,"Vulkan.Dispatch":97.090,"Vulkan.Dispatch.shader_resources":91.669,"Graphics.Draw":64.181,"Graphics.Draw.draw_and_resource_release":62.799},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-b1e916a7de88-60108.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. In the run of the second line, APS5_AB=10:APS5_NO_UNTRACKED_REFRESH_PROOF from 80 s, 9 B phases inside the movie: this PR gives 3.0% more frames on main alone in this scene (2.7 SE). Recorder.Sync slices per present in the trace windows: main 44.0, this PR 35.2.

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        44.29      42.96      -1.33    -3.0%   -1.44 +- 0.54 (SD 1.63, n 9)
frame ms                           226.25     232.98      +6.73    +3.0%   +7.27 +- 2.83 (SD 8.49, n 9)
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 b1e916a7de

seconds 60:10 from present 357: 45 presents, frame p50 221.0 / p90 235.4 / p99 241.0 / max 241.0 ms, GPU busy 43.5 ms per present
NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit b1e916a7de, dropped: no

Slowest frames (largest slices inside each, inclusive)

  • present 357: 241.0 ms at 0 ms: Driver.Packet (queue worker 0x23) 235.9, Driver.Packet (queue worker 0x0) 225.9, Driver.Packet.memory_wait (queue worker 0x23) 208.8, Driver.Packet.dispatch (queue worker 0x0) 196.5
  • present 400: 240.2 ms at 9570 ms: Driver.Packet (queue worker 0x23) 238.4, Driver.Packet (queue worker 0x0) 224.6, Driver.Packet.memory_wait (queue worker 0x23) 204.1, Driver.Packet.dispatch (queue worker 0x0) 186.9
  • present 383: 239.5 ms at 5770 ms: Driver.Packet (queue worker 0x23) 234.9, Driver.Packet (queue worker 0x0) 226.0, Driver.Packet.memory_wait (queue worker 0x23) 206.0, Driver.Packet.dispatch (queue worker 0x0) 194.8

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 196.3 (88 %) 22.1 (10 %) 4.8 13.2 Driver.Packet 211.2, Driver.EndSubmission 7.2
draw committer 72.7 (33 %) 11.0 (5 %) 139.5 1.6 Graphics.Draw 64.2, Vulkan.DrawFromRecipe 11.6
presenter 1.4 (1 %) 0.1 (0 %) 221.8 0.1 VideoOut.Flip 1.5
queue worker 0x23 18.7 (8 %) 201.1 (90 %) 3.4 2.3 Driver.Packet 216.4, Driver.EndSubmission 3.4
gpu 43.5 (19 %) 0.0 (0 %) 179.8 0.0 batch 43.5

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 427.6, Driver.Packet.dispatch 207.4, Driver.Packet.memory_wait 197.6, Driver.Dispatch 143.3, Vulkan.Dispatch 96.7

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x23) 137.4 ms at 7222 ms, present 389
  • Driver.Packet.memory_wait (queue worker 0x23) 133.6 ms at 5882 ms, present 383
  • Driver.Packet.memory_wait (queue worker 0x23) 130.3 ms at 1240 ms, present 362
  • Driver.Packet.memory_wait (queue worker 0x23) 128.2 ms at 125 ms, present 357
  • Driver.Packet.memory_wait (queue worker 0x23) 128.0 ms at 3900 ms, present 374

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

  • batch 26115: 11.4 ms at 4600 ms, present 377: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 13.3, Driver.Packet.dispatch (queue worker 0x0) 13.3, Driver.Dispatch (queue worker 0x0) 13.2, Vulkan.Dispatch (queue worker 0x0) 12.8
  • batch 24652: 11.4 ms at 1948 ms, present 365: 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 25381: 11.3 ms at 3274 ms, present 371: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.5, Driver.Packet.dispatch (queue worker 0x0) 11.5, Driver.Dispatch (queue worker 0x0) 11.5, Vulkan.Dispatch (queue worker 0x0) 11.0

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_UNTRACKED_REFRESH_PROOF, 9 B phases; this run was of the first version, without the kept-at-unwatch condition):

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        37.92      36.91      -1.02    -2.7%   -1.00 +- 0.30 (SD 0.90, n 9)
frame ms                           263.84     271.29      +7.46    +2.8%   +7.30 +- 2.35 (SD 7.04, n 9)

On main (dd4da52a88 with this PR as it is here and the capture experiment, 10 B phases):

metric                                  A          B        B-A    B/A-1   B vs neighbouring A: mean +- SE (SD, n)
presents/10s                        21.51      21.42      -0.09    -0.4%   -0.08 +- 0.18 (SD 0.56, n 10)
frame ms                           465.46     467.21      +1.75    +0.4%   +1.52 +- 4.01 (SD 12.67, n 10)

So it is 2.7% on the series and within noise (+0.4% ± 0.8%) on main alone. A run of the first version on main c51f4560c5 gave +2.0% (4.5 SE). I have not separated whether the newer main or the added condition explains the difference.

Tests (Windows, RTX 5090): built agc_driver_recorder_tests, agc_runtime_switches_tests, agc_driver_bda_device_tests, agc_driver_host_import_windows_tests and agc_host_import_retire_tests on main dd4da52a88 with this PR and ran ctest -R '^(agc_import_.*|agc_storage_.*|agc_.*_import_.*|agc_copied_write_back|agc_runtime_switches.*)$'. 52 tests pass, including all agc_storage_* and agc_import_* tests. 8 did not run here: 5 binaries were not built by these targets, and 3 agc_driver_msaa_dcc_compared_import_* tests fail to start on this machine with 0xc0000139, a DLL entry point not found.

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%
#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 (goes with #18078, see Series)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5239253025 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18076). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-11-10T09:52:05Z. --- ### What A storage image whose memory is outside the write watch had no refresh proof, so every refresh took the full path even when nothing had changed: flush checks, import segments, keys and saved write-back waits. On Cyberpunk 2077's Body Type screen that is about 2,500 full refreshes per second. Such an image, if it has no DCC metadata, now takes a proof like a tracked one. A later refresh accepts the proof when all of these hold: - A compare of the whole guest range against the bytes the image was uploaded from finds no difference. This is usually a hit in the existing compare memo, and a much more frequent one with #18078. - No saved write-back and no kept-at-unwatch unit is outstanding. - Its keys are unchanged. - No other image's pending results overlap it. `APS5_NO_UNTRACKED_REFRESH_PROOF` 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`, `b1e916a7de` (now the PR head): ```json {"commit":"b1e916a7de88","dirty":false,"env":{"APS5_AB":"10:APS5_NO_UNTRACKED_REFRESH_PROOF","APS5_AB_START":"80s","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":10045.167},"presents":45,"frame_ms":{"p50":220.969,"p90":235.376,"p99":240.999,"max":240.999},"gpu_busy_ms_per_present":43.508,"worker_busy_pct":{"queue worker 0x0":99.489,"queue worker 0x23":99.911},"top_phases_ms_per_frame":{"Driver.Packet":434.489,"Driver.Packet.dispatch":207.557,"Driver.Packet.memory_wait":200.358,"Driver.Dispatch":143.767,"Vulkan.Dispatch":97.090,"Vulkan.Dispatch.shader_resources":91.669,"Graphics.Draw":64.181,"Graphics.Draw.draw_and_resource_release":62.799},"owned_draw_counts":{},"trace_dropped":false,"trace":"aps5-trace-b1e916a7de88-60108.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. In the run of the second line, `APS5_AB=10:APS5_NO_UNTRACKED_REFRESH_PROOF` from 80 s, 9 B phases inside the movie: this PR gives 3.0% more frames on `main` alone in this scene (2.7 SE). `Recorder.Sync` slices per present in the trace windows: `main` 44.0, this PR 35.2. ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 44.29 42.96 -1.33 -3.0% -1.44 +- 0.54 (SD 1.63, n 9) frame ms 226.25 232.98 +6.73 +3.0% +7.27 +- 2.83 (SD 8.49, n 9) ``` <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 b1e916a7de</summary> **seconds 60:10** from present 357: 45 presents, frame p50 221.0 / p90 235.4 / p99 241.0 / max 241.0 ms, GPU busy 43.5 ms per present NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26200, 3200x1800, commit b1e916a7de88, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 357: 241.0 ms at 0 ms: Driver.Packet (queue worker 0x23) 235.9, Driver.Packet (queue worker 0x0) 225.9, Driver.Packet.memory_wait (queue worker 0x23) 208.8, Driver.Packet.dispatch (queue worker 0x0) 196.5 - present 400: 240.2 ms at 9570 ms: Driver.Packet (queue worker 0x23) 238.4, Driver.Packet (queue worker 0x0) 224.6, Driver.Packet.memory_wait (queue worker 0x23) 204.1, Driver.Packet.dispatch (queue worker 0x0) 186.9 - present 383: 239.5 ms at 5770 ms: Driver.Packet (queue worker 0x23) 234.9, Driver.Packet (queue worker 0x0) 226.0, Driver.Packet.memory_wait (queue worker 0x23) 206.0, Driver.Packet.dispatch (queue worker 0x0) 194.8 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 196.3 (88 %) | 22.1 (10 %) | 4.8 | 13.2 | Driver.Packet 211.2, Driver.EndSubmission 7.2 | | draw committer | 72.7 (33 %) | 11.0 (5 %) | 139.5 | 1.6 | Graphics.Draw 64.2, Vulkan.DrawFromRecipe 11.6 | | presenter | 1.4 (1 %) | 0.1 (0 %) | 221.8 | 0.1 | VideoOut.Flip 1.5 | | queue worker 0x23 | 18.7 (8 %) | 201.1 (90 %) | 3.4 | 2.3 | Driver.Packet 216.4, Driver.EndSubmission 3.4 | | gpu | 43.5 (19 %) | 0.0 (0 %) | 179.8 | 0.0 | batch 43.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 427.6, Driver.Packet.dispatch 207.4, Driver.Packet.memory_wait 197.6, Driver.Dispatch 143.3, Vulkan.Dispatch 96.7 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x23) 137.4 ms at 7222 ms, present 389 - Driver.Packet.memory_wait (queue worker 0x23) 133.6 ms at 5882 ms, present 383 - Driver.Packet.memory_wait (queue worker 0x23) 130.3 ms at 1240 ms, present 362 - Driver.Packet.memory_wait (queue worker 0x23) 128.2 ms at 125 ms, present 357 - Driver.Packet.memory_wait (queue worker 0x23) 128.0 ms at 3900 ms, present 374 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 26115: 11.4 ms at 4600 ms, present 377: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 13.3, Driver.Packet.dispatch (queue worker 0x0) 13.3, Driver.Dispatch (queue worker 0x0) 13.2, Vulkan.Dispatch (queue worker 0x0) 12.8 - batch 24652: 11.4 ms at 1948 ms, present 365: 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 25381: 11.3 ms at 3274 ms, present 371: GPU no ranges; recorded by Driver.Packet (queue worker 0x0) 11.5, Driver.Packet.dispatch (queue worker 0x0) 11.5, Driver.Dispatch (queue worker 0x0) 11.5, Vulkan.Dispatch (queue worker 0x0) 11.0 </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_UNTRACKED_REFRESH_PROOF`, 9 B phases; this run was of the first version, without the kept-at-unwatch condition): ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 37.92 36.91 -1.02 -2.7% -1.00 +- 0.30 (SD 0.90, n 9) frame ms 263.84 271.29 +7.46 +2.8% +7.30 +- 2.35 (SD 7.04, n 9) ``` **On `main`** (`dd4da52a88` with this PR as it is here and the capture experiment, 10 B phases): ``` metric A B B-A B/A-1 B vs neighbouring A: mean +- SE (SD, n) presents/10s 21.51 21.42 -0.09 -0.4% -0.08 +- 0.18 (SD 0.56, n 10) frame ms 465.46 467.21 +1.75 +0.4% +1.52 +- 4.01 (SD 12.67, n 10) ``` So it is 2.7% on the series and within noise (+0.4% ± 0.8%) on `main` alone. A run of the first version on `main` `c51f4560c5` gave +2.0% (4.5 SE). I have not separated whether the newer `main` or the added condition explains the difference. **Tests** (Windows, RTX 5090): built `agc_driver_recorder_tests`, `agc_runtime_switches_tests`, `agc_driver_bda_device_tests`, `agc_driver_host_import_windows_tests` and `agc_host_import_retire_tests` on `main` `dd4da52a88` with this PR and ran `ctest -R '^(agc_import_.*|agc_storage_.*|agc_.*_import_.*|agc_copied_write_back|agc_runtime_switches.*)$'`. 52 tests pass, including all `agc_storage_*` and `agc_import_*` tests. 8 did not run here: 5 binaries were not built by these targets, and 3 `agc_driver_msaa_dcc_compared_import_*` tests fail to start on this machine with 0xc0000139, a DLL entry point not found. ### 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% | | #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 (goes with #18078, see Series) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11 - [x] AI-assisted: yes

Pull request closed

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!18076
No description provided.