perf(agc): skip heap mirror blocks whose bytes already match guest memory #16188

Merged
sktharunbalaji13-cmd merged 2 commits from upstream-pr/16188 into main 2026-11-07 11:50:02 +00:00
sktharunbalaji13-cmd commented 2026-11-05 20:24:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sktharunbalaji13-cmd on 2026-11-05T20:24:52Z.


What

An address-based build refreshes every 64 KiB block of a heap mirror whose tracker stamp is newer than the mirror's generation. Blocks that the driver itself stamped after writing GPU results back to guest memory are flagged the same way as blocks the title wrote, so a resident or plain heap mirror copied them again although it already held those bytes, then staged them and transferred them to the GPU. In Ghost of Tsushima about 1340 to 1370 of the roughly 2040 blocks flagged per build were byte-identical re-copies.

compareBlock now compares the guest bytes with the mirror before copying. When they match it advances the block's generation without copying and compareBlocks does not mark the resident block changed, so no staging copy or GPU transfer follows. A block whose bytes differ is copied exactly as before. Sparse fill blocks, unbound resident blocks and mirrors without write watching (generation 0) keep their previous behaviour: an unwatched mirror has no record of which bytes changed, every one of its blocks is flagged on every build, and agc_heap_mirror_unwatch* require all of them to be copied. The first commit compared those blocks too and failed agc_heap_mirror_unwatch and agc_heap_mirror_unwatch_no_space_cache in the Windows check; the second commit restricts the comparison to blocks with a nonzero generation.

New regression tests a block stamped without a byte change in BdaResources.cpp (heapMirrorTests) and in ResidentHeapMirror.cpp (ResidentTests) stamp a block with MarkWritten and require that the next build compares it without copying it.

tools/pr_overlap.py could not compare the 26 open PRs that conflict with main and touch these files, so I read their patches: none skips a copy by comparing first. #15296 (needs rebase) rewrites the resident branch of compareBlock to drop the host copy; it does not change the plain heap path or the stamped-block case.

Tested

Windows 11 26200, AMD Ryzen 7 7840HS, 16 GB RAM, NVIDIA GeForce RTX 4060 Laptop GPU (8 GB), driver 617.42.

Focused tests, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -R "agc_(heap_mirror|sparse_heap_mirror|address_copy_cap|address_space_unwatched|sparse_buffer|driver_graphics|graphics_profile|driver_address_space_teardown|driver_resident_heap_mirror|driver_address_draw_space_reuse|driver_host_import_windows)" -V:

  • with both commits: 22/22 pass, including agc_heap_mirror_unwatch*, agc_sparse_heap_mirror_* and agc_address_copy_cap*
  • with only the GuestBufferMemory.cpp change reverted (same new tests, run with the nine-test pattern agc_driver_(address_draw_space_reuse|host_import_windows|resident_heap_mirror|graphics|address_space_teardown) before the second commit): agc_driver_resident_heap_mirror and agc_driver_graphics fail, the other seven pass
  • neither log contains a VUID- line or was not found but was requested by env var VK_INSTANCE_LAYERS

Ghost of Tsushima Director's Cut (PPSA02225), same launch and scene, APS5_TRACE_SECONDS=60:25, APS5_PROFILE_DRAW=1, four 145 s runs back to back, alternating without and with this change. The two builds are local scratch builds of one tree that differ only in this change: d842941d04e3 without it, f3222bb7c416 with both commits of this PR. That tree also holds the known-zero scan fix from #15967 that this title needs on 16 GB RAM, the joined-import fix from #16130, trace counters and unmerged depth-surface experiments that are not part of this PR (a read touch before a depth range takes its write generation, APS5_SOFT_DEPTH_CHECKS=1, last-writer-wins publication over colour targets); the scratch commits are local. This branch is rebased on c4469b60da and the change applies there without edits.

run commit presents in window frame p50 / p90 / p99 ms GPU busy ms per present address builds per 10 s flagged blocks per build copied blocks per build mirror prepare ms per build compare ms per build
without this change (C1a) d842941d04e3 89 187.0 / 503.9 / 5466.6 67.0 62 2042 1338 55.6 14.5
without this change (C1b) d842941d04e3 93 184.1 / 386.4 / 5395.1 70.8 75 2037 1371 48.7 12.3
with this change (C3a) f3222bb7c416 101 156.2 / 414.9 / 694.3 51.5 84 2010 135 61.7 12.3
with this change (C3b) f3222bb7c416 105 171.4 / 334.9 / 799.9 56.6 72 2056 132 46.2 11.1

Per build, the change takes the copied blocks from about 1340 to 1370 of the roughly 2040 flagged blocks down to about 130, which is what it is meant to do. The effect on the frame rate of this title is modest and noisy with two runs per build: presents in the 25 s window 89 and 93 without, 101 and 105 with (+13 % on average), frame time p50 187 and 184 ms without, 156 and 171 ms with, GPU busy per present 67.0 and 70.8 ms without, 51.5 and 56.6 ms with. Every run also contains one frame of 5.3 to 6.4 s, with and without the change, and with about 100 frames in a window the p99 column is just the second slowest frame, so it does not separate the builds. Mirror prepare per build (46 to 62 ms) did not change beyond the spread between the two runs of one build; compare per build is 1 to 2 ms shorter. The window still averages only 3.6 to 4.2 fps: this PR removes wasted copies, and the rest of the frame time is the per-build work left under the GPU mutex.

An earlier A B A B pair on the same machine, from one build with the change compiled out for A and in for B (memcmp-2026-11-06), agrees: copied blocks per build 1127 and 1135 become 144 and 125, and presents in the window go from 102 and 85 to 144 and 135.

trace_digest.py summary lines (without this change C1a, C1b, then with it C3a, C3b)
{"commit":"d842941d04e3","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":739,"ms":25975.822},"presents":89,"frame_ms":{"p50":186.961,"p90":503.914,"p99":5466.559,"max":5466.559},"gpu_busy_ms_per_present":67.029,"worker_busy_pct":{"queue worker 0x0":59.163,"queue worker 0x40":40.121,"queue worker 0x20":62.298,"queue worker 0x48":78.312,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":691.637,"Driver.Packet.dispatch":485.227,"Driver.Dispatch":461.227,"Vulkan.Dispatch":227.449,"Vulkan.Dispatch.shader_resources":222.288,"GpuMutex.wait.dispatch":198.7,"Driver.Packet.pipeline_drain":87.161,"GpuMutex.wait.end":62.32},"trace_dropped":false,"trace":"C1a-60-25-aps5-trace.json.gz"}
{"commit":"d842941d04e3","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":408,"ms":25142.192},"presents":93,"frame_ms":{"p50":184.116,"p90":386.367,"p99":5395.127,"max":5395.127},"gpu_busy_ms_per_present":70.753,"worker_busy_pct":{"queue worker 0x0":61.271,"queue worker 0x40":57.32,"queue worker 0x20":92.401,"queue worker 0x48":83.254,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":787.066,"Driver.Packet.dispatch":491.284,"Driver.Dispatch":458.983,"Vulkan.Dispatch":225.65,"Vulkan.Dispatch.shader_resources":221.506,"GpuMutex.wait.dispatch":218.671,"Driver.Packet.memory_wait":142.291,"Driver.Packet.pipeline_drain":91.348},"trace_dropped":false,"trace":"C1b-60-25-aps5-trace.json.gz"}
{"commit":"f3222bb7c416","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":754,"ms":25248.374},"presents":101,"frame_ms":{"p50":156.209,"p90":414.904,"p99":694.305,"max":6420.211},"gpu_busy_ms_per_present":51.492,"worker_busy_pct":{"queue worker 0x0":38.28,"queue worker 0x40":42.371,"queue worker 0x20":81.522,"queue worker 0x48":78.891,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":589.463,"Driver.Packet.dispatch":408.703,"Driver.Dispatch":387.756,"Vulkan.Dispatch":194.072,"Vulkan.Dispatch.shader_resources":189.457,"GpuMutex.wait.dispatch":164.964,"Driver.Packet.memory_wait":99.298,"VideoOut.Flip":83.948},"trace_dropped":false,"trace":"C3a-60-25-aps5-trace.json.gz"}
{"commit":"f3222bb7c416","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":410,"ms":25083.217},"presents":105,"frame_ms":{"p50":171.424,"p90":334.875,"p99":799.943,"max":5300.815},"gpu_busy_ms_per_present":56.56,"worker_busy_pct":{"queue worker 0x0":62.028,"queue worker 0x40":57.834,"queue worker 0x20":89.569,"queue worker 0x48":81.892,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":686.847,"Driver.Packet.dispatch":422.555,"Driver.Dispatch":395.098,"Vulkan.Dispatch":196.354,"Vulkan.Dispatch.shader_resources":191.891,"GpuMutex.wait.dispatch":182.028,"Driver.Packet.memory_wait":130.595,"GpuMutex.wait.flush":70.036},"trace_dropped":false,"trace":"C3b-60-25-aps5-trace.json.gz"}
trace_digest.py output (first lines of each run)

C1a

**seconds 60:25** from present 739: 89 presents, frame p50 187.0 / p90 503.9 / p99 5466.6 / max 5466.6 ms, GPU busy 67.0 ms per present
NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit d842941d04e3, dropped: no


**Slowest frames** (largest slices inside each, inclusive)

- present 827: 5466.6 ms at 20509 ms: Driver.Packet (queue worker 0x40) 5425.5, Driver.Packet.dispatch (queue worker 0x40) 5425.5, Driver.Dispatch (queue worker 0x40) 5424.8, Driver.Packet (queue worker 0x0) 5361.7
- present 765: 985.2 ms at 5487 ms: Driver.WorkerWait (queue worker 0x40) 985.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 985.2, Driver.Packet (queue worker 0x20) 958.4, Driver.WorkerWait (queue worker 0x48) 
- present 825: 696.4 ms at 19583 ms: Driver.Packet (queue worker 0x20) 661.4, Driver.Packet (queue worker 0x40) 642.4, Driver.Packet.dispatch (queue worker 0x40) 642.3, Driver.Dispatch (queue worker 0x40) 641.7
- present 773: 618.2 ms at 8751 ms: Driver.WorkerWait (queue worker 0x40) 618.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 618.2, Driver.Packet (queue worker 0x48) 581.2, Driver.Packet.dispatch (queue worker 0
- present 787: 580.8 ms at 11669 ms: Driver.WorkerWait (queue worker 0x40) 580.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 580.8, Driver.Packet (queue worker 0x20) 547.7, Driver.Packet.dispatch (queue worker 

C1b

**seconds 60:25** from present 408: 93 presents, frame p50 184.1 / p90 386.4 / p99 5395.1 / max 5395.1 ms, GPU busy 70.8 ms per present
NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit d842941d04e3, dropped: no


**Slowest frames** (largest slices inside each, inclusive)

- present 467: 5395.1 ms at 12482 ms: Driver.Packet (queue worker 0x20) 5382.4, Driver.Packet (queue worker 0x0) 5357.0, Driver.Packet (queue worker 0x40) 5356.1, Driver.Packet.dispatch (queue worker 0x40) 5356.1
- present 468: 830.2 ms at 17877 ms: Driver.Packet (queue worker 0x20) 808.6, Driver.Packet (queue worker 0x40) 701.8, Driver.Packet.dispatch (queue worker 0x40) 701.7, Driver.Dispatch (queue worker 0x40) 701.1
- present 437: 660.1 ms at 5976 ms: Driver.Packet (queue worker 0x48) 557.2, Driver.Packet.dispatch (queue worker 0x48) 556.8, Driver.Dispatch (queue worker 0x48) 556.7, Driver.Packet (queue worker 0x20) 547.8
- present 439: 602.5 ms at 6678 ms: Driver.Packet (queue worker 0x20) 586.7, Driver.Packet (queue worker 0x48) 572.4, Driver.Packet.dispatch (queue worker 0x48) 572.0, Driver.Dispatch (queue worker 0x48) 571.8
- present 428: 531.6 ms at 4013 ms: Driver.Packet (queue worker 0x20) 507.3, Driver.Packet (queue worker 0x40) 496.6, Driver.Packet.dispatch (queue worker 0x40) 496.6, Driver.Dispatch (queue worker 0x40) 496.4

C3a

**seconds 60:25** from present 754: 101 presents, frame p50 156.2 / p90 414.9 / p99 694.3 / max 6420.2 ms, GPU busy 51.5 ms per present
NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit f3222bb7c416, dropped: no


**Slowest frames** (largest slices inside each, inclusive)

- present 842: 6420.2 ms at 16946 ms: Driver.Packet (queue worker 0x48) 6213.6, Driver.Packet.dispatch (queue worker 0x48) 6211.2, Driver.Dispatch (queue worker 0x48) 6208.4, Vulkan.Dispatch (queue worker 0x48) 6165.2
- present 778: 694.3 ms at 4299 ms: Driver.WorkerWait (queue worker 0x40) 694.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 694.3, Driver.WorkerWait (queue worker 0x0) 665.5, Driver.WorkerWait.idle_and_completi
- present 777: 673.5 ms at 3626 ms: Driver.WorkerWait (queue worker 0x40) 673.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 673.5, Driver.WorkerWait (queue worker 0x0) 663.7, Driver.WorkerWait.idle_and_completi
- present 770: 620.5 ms at 2010 ms: Driver.WorkerWait (queue worker 0x40) 620.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 620.5, Driver.Packet (queue worker 0x48) 617.7, Driver.Packet.dispatch (queue worker 0
- present 840: 509.5 ms at 16328 ms: Driver.Packet (queue worker 0x20) 489.3, Driver.Packet (queue worker 0x40) 473.2, Driver.Packet.dispatch (queue worker 0x40) 473.2, Driver.Dispatch (queue worker 0x40) 472.1

C3b

**seconds 60:25** from present 410: 105 presents, frame p50 171.4 / p90 334.9 / p99 799.9 / max 5300.8 ms, GPU busy 56.6 ms per present
NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit f3222bb7c416, dropped: no


**Slowest frames** (largest slices inside each, inclusive)

- present 481: 5300.8 ms at 12980 ms: Driver.Packet (queue worker 0x20) 5286.9, Driver.Packet (queue worker 0x40) 5262.7, Driver.Packet.dispatch (queue worker 0x40) 5262.6, Driver.Dispatch (queue worker 0x40) 5262.4
- present 483: 799.9 ms at 18860 ms: Driver.Packet (queue worker 0x48) 766.6, Driver.Packet.dispatch (queue worker 0x48) 765.8, Driver.Dispatch (queue worker 0x48) 765.6, Vulkan.Dispatch (queue worker 0x48) 756.7
- present 482: 579.3 ms at 18281 ms: Driver.WorkerWait (queue worker 0x0) 567.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 566.8, Driver.Packet (queue worker 0x20) 505.5, VideoOut.Flip (presenter) 408.2
- present 486: 506.0 ms at 19970 ms: Driver.Packet (queue worker 0x20) 473.4, Driver.Packet (queue worker 0x40) 454.8, Driver.Packet.dispatch (queue worker 0x40) 454.5, Driver.Dispatch (queue worker 0x40) 454.2
- present 463: 453.0 ms at 9048 ms: Driver.Packet (queue worker 0x0) 416.5, Driver.Packet.dispatch (queue worker 0x0) 410.7, Driver.Packet (queue worker 0x20) 361.6, Driver.Packet (queue worker 0x40) 340.5

Traces, digests, the fps and [address] lines of all four runs and the ctest logs: https://github.com/sktharunbalaji13-cmd/AnyPS5/tree/evidence/got-ram-logo/ghost-of-tsushima/commits-2026-11-06

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: PPSA02225 #4461
  • GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU, driver 617.42, Windows 11 (26200)
  • AI-assisted: yes

🤖 Generated with Claude Code, OpenCode, Command Code and Gemini

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5178178552 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16188). Originally posted by [sktharunbalaji13-cmd](https://github.com/sktharunbalaji13-cmd) on 2026-11-05T20:24:52Z. --- ### What An address-based build refreshes every 64 KiB block of a heap mirror whose tracker stamp is newer than the mirror's generation. Blocks that the driver itself stamped after writing GPU results back to guest memory are flagged the same way as blocks the title wrote, so a resident or plain heap mirror copied them again although it already held those bytes, then staged them and transferred them to the GPU. In Ghost of Tsushima about 1340 to 1370 of the roughly 2040 blocks flagged per build were byte-identical re-copies. `compareBlock` now compares the guest bytes with the mirror before copying. When they match it advances the block's generation without copying and `compareBlocks` does not mark the resident block changed, so no staging copy or GPU transfer follows. A block whose bytes differ is copied exactly as before. Sparse fill blocks, unbound resident blocks and mirrors without write watching (generation 0) keep their previous behaviour: an unwatched mirror has no record of which bytes changed, every one of its blocks is flagged on every build, and `agc_heap_mirror_unwatch*` require all of them to be copied. The first commit compared those blocks too and failed `agc_heap_mirror_unwatch` and `agc_heap_mirror_unwatch_no_space_cache` in the Windows check; the second commit restricts the comparison to blocks with a nonzero generation. New regression tests `a block stamped without a byte change` in `BdaResources.cpp` (`heapMirrorTests`) and in `ResidentHeapMirror.cpp` (`ResidentTests`) stamp a block with `MarkWritten` and require that the next build compares it without copying it. `tools/pr_overlap.py` could not compare the 26 open PRs that conflict with `main` and touch these files, so I read their patches: none skips a copy by comparing first. #15296 (needs rebase) rewrites the resident branch of `compareBlock` to drop the host copy; it does not change the plain heap path or the stamped-block case. ### Tested Windows 11 26200, AMD Ryzen 7 7840HS, 16 GB RAM, NVIDIA GeForce RTX 4060 Laptop GPU (8 GB), driver 617.42. **Focused tests**, `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -R "agc_(heap_mirror|sparse_heap_mirror|address_copy_cap|address_space_unwatched|sparse_buffer|driver_graphics|graphics_profile|driver_address_space_teardown|driver_resident_heap_mirror|driver_address_draw_space_reuse|driver_host_import_windows)" -V`: - with both commits: 22/22 pass, including `agc_heap_mirror_unwatch*`, `agc_sparse_heap_mirror_*` and `agc_address_copy_cap*` - with only the `GuestBufferMemory.cpp` change reverted (same new tests, run with the nine-test pattern `agc_driver_(address_draw_space_reuse|host_import_windows|resident_heap_mirror|graphics|address_space_teardown)` before the second commit): `agc_driver_resident_heap_mirror` and `agc_driver_graphics` fail, the other seven pass - neither log contains a `VUID-` line or `was not found but was requested by env var VK_INSTANCE_LAYERS` **Ghost of Tsushima Director's Cut (PPSA02225)**, same launch and scene, `APS5_TRACE_SECONDS=60:25`, `APS5_PROFILE_DRAW=1`, four 145 s runs back to back, alternating without and with this change. The two builds are local scratch builds of one tree that differ only in this change: `d842941d04e3` without it, `f3222bb7c416` with both commits of this PR. That tree also holds the known-zero scan fix from #15967 that this title needs on 16 GB RAM, the joined-import fix from #16130, trace counters and unmerged depth-surface experiments that are not part of this PR (a read touch before a depth range takes its write generation, `APS5_SOFT_DEPTH_CHECKS=1`, last-writer-wins publication over colour targets); the scratch commits are local. This branch is rebased on `c4469b60da` and the change applies there without edits. | run | commit | presents in window | frame p50 / p90 / p99 ms | GPU busy ms per present | address builds per 10 s | flagged blocks per build | copied blocks per build | mirror prepare ms per build | compare ms per build | |---|---|---|---|---|---|---|---|---|---| | without this change (C1a) | `d842941d04e3` | 89 | 187.0 / 503.9 / 5466.6 | 67.0 | 62 | 2042 | 1338 | 55.6 | 14.5 | | without this change (C1b) | `d842941d04e3` | 93 | 184.1 / 386.4 / 5395.1 | 70.8 | 75 | 2037 | 1371 | 48.7 | 12.3 | | with this change (C3a) | `f3222bb7c416` | 101 | 156.2 / 414.9 / 694.3 | 51.5 | 84 | 2010 | 135 | 61.7 | 12.3 | | with this change (C3b) | `f3222bb7c416` | 105 | 171.4 / 334.9 / 799.9 | 56.6 | 72 | 2056 | 132 | 46.2 | 11.1 | Per build, the change takes the copied blocks from about 1340 to 1370 of the roughly 2040 flagged blocks down to about 130, which is what it is meant to do. The effect on the frame rate of this title is modest and noisy with two runs per build: presents in the 25 s window 89 and 93 without, 101 and 105 with (+13 % on average), frame time p50 187 and 184 ms without, 156 and 171 ms with, GPU busy per present 67.0 and 70.8 ms without, 51.5 and 56.6 ms with. Every run also contains one frame of 5.3 to 6.4 s, with and without the change, and with about 100 frames in a window the p99 column is just the second slowest frame, so it does not separate the builds. Mirror prepare per build (46 to 62 ms) did not change beyond the spread between the two runs of one build; compare per build is 1 to 2 ms shorter. The window still averages only 3.6 to 4.2 fps: this PR removes wasted copies, and the rest of the frame time is the per-build work left under the GPU mutex. An earlier A B A B pair on the same machine, from one build with the change compiled out for A and in for B ([memcmp-2026-11-06](https://github.com/sktharunbalaji13-cmd/AnyPS5/tree/evidence/got-ram-logo/ghost-of-tsushima/memcmp-2026-11-06)), agrees: copied blocks per build 1127 and 1135 become 144 and 125, and presents in the window go from 102 and 85 to 144 and 135. <details><summary>trace_digest.py summary lines (without this change C1a, C1b, then with it C3a, C3b)</summary> ``` {"commit":"d842941d04e3","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":739,"ms":25975.822},"presents":89,"frame_ms":{"p50":186.961,"p90":503.914,"p99":5466.559,"max":5466.559},"gpu_busy_ms_per_present":67.029,"worker_busy_pct":{"queue worker 0x0":59.163,"queue worker 0x40":40.121,"queue worker 0x20":62.298,"queue worker 0x48":78.312,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":691.637,"Driver.Packet.dispatch":485.227,"Driver.Dispatch":461.227,"Vulkan.Dispatch":227.449,"Vulkan.Dispatch.shader_resources":222.288,"GpuMutex.wait.dispatch":198.7,"Driver.Packet.pipeline_drain":87.161,"GpuMutex.wait.end":62.32},"trace_dropped":false,"trace":"C1a-60-25-aps5-trace.json.gz"} {"commit":"d842941d04e3","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":408,"ms":25142.192},"presents":93,"frame_ms":{"p50":184.116,"p90":386.367,"p99":5395.127,"max":5395.127},"gpu_busy_ms_per_present":70.753,"worker_busy_pct":{"queue worker 0x0":61.271,"queue worker 0x40":57.32,"queue worker 0x20":92.401,"queue worker 0x48":83.254,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":787.066,"Driver.Packet.dispatch":491.284,"Driver.Dispatch":458.983,"Vulkan.Dispatch":225.65,"Vulkan.Dispatch.shader_resources":221.506,"GpuMutex.wait.dispatch":218.671,"Driver.Packet.memory_wait":142.291,"Driver.Packet.pipeline_drain":91.348},"trace_dropped":false,"trace":"C1b-60-25-aps5-trace.json.gz"} {"commit":"f3222bb7c416","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":754,"ms":25248.374},"presents":101,"frame_ms":{"p50":156.209,"p90":414.904,"p99":694.305,"max":6420.211},"gpu_busy_ms_per_present":51.492,"worker_busy_pct":{"queue worker 0x0":38.28,"queue worker 0x40":42.371,"queue worker 0x20":81.522,"queue worker 0x48":78.891,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":589.463,"Driver.Packet.dispatch":408.703,"Driver.Dispatch":387.756,"Vulkan.Dispatch":194.072,"Vulkan.Dispatch.shader_resources":189.457,"GpuMutex.wait.dispatch":164.964,"Driver.Packet.memory_wait":99.298,"VideoOut.Flip":83.948},"trace_dropped":false,"trace":"C3a-60-25-aps5-trace.json.gz"} {"commit":"f3222bb7c416","dirty":false,"env":{"APS5_PROFILE_DRAW":"1","APS5_SKIP_REFUSED_DRAWS":"1","APS5_SOFT_DEPTH_CHECKS":"1","APS5_TRACE_SECONDS":"60:25"},"gpu":"NVIDIA GeForce RTX 4060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","cpu":"AMD Ryzen 7 7840HS w/ Radeon 780M Graphics","cpu_threads":16,"memory_mib":15654,"title_id":"PPSA02225","title":"Ghost of Tsushima","content_version":"02.024.000","resolution":"3840x2160","window":{"spec":"seconds 60:25","first_present":410,"ms":25083.217},"presents":105,"frame_ms":{"p50":171.424,"p90":334.875,"p99":799.943,"max":5300.815},"gpu_busy_ms_per_present":56.56,"worker_busy_pct":{"queue worker 0x0":62.028,"queue worker 0x40":57.834,"queue worker 0x20":89.569,"queue worker 0x48":81.892,"queue worker 0x38":0.0,"queue worker 0x52":0.0,"queue worker 0x30":0.0},"top_phases_ms_per_frame":{"Driver.Packet":686.847,"Driver.Packet.dispatch":422.555,"Driver.Dispatch":395.098,"Vulkan.Dispatch":196.354,"Vulkan.Dispatch.shader_resources":191.891,"GpuMutex.wait.dispatch":182.028,"Driver.Packet.memory_wait":130.595,"GpuMutex.wait.flush":70.036},"trace_dropped":false,"trace":"C3b-60-25-aps5-trace.json.gz"} ``` <details><summary>trace_digest.py output (first lines of each run)</summary> **C1a** ``` **seconds 60:25** from present 739: 89 presents, frame p50 187.0 / p90 503.9 / p99 5466.6 / max 5466.6 ms, GPU busy 67.0 ms per present NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit d842941d04e3, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 827: 5466.6 ms at 20509 ms: Driver.Packet (queue worker 0x40) 5425.5, Driver.Packet.dispatch (queue worker 0x40) 5425.5, Driver.Dispatch (queue worker 0x40) 5424.8, Driver.Packet (queue worker 0x0) 5361.7 - present 765: 985.2 ms at 5487 ms: Driver.WorkerWait (queue worker 0x40) 985.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 985.2, Driver.Packet (queue worker 0x20) 958.4, Driver.WorkerWait (queue worker 0x48) - present 825: 696.4 ms at 19583 ms: Driver.Packet (queue worker 0x20) 661.4, Driver.Packet (queue worker 0x40) 642.4, Driver.Packet.dispatch (queue worker 0x40) 642.3, Driver.Dispatch (queue worker 0x40) 641.7 - present 773: 618.2 ms at 8751 ms: Driver.WorkerWait (queue worker 0x40) 618.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 618.2, Driver.Packet (queue worker 0x48) 581.2, Driver.Packet.dispatch (queue worker 0 - present 787: 580.8 ms at 11669 ms: Driver.WorkerWait (queue worker 0x40) 580.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 580.8, Driver.Packet (queue worker 0x20) 547.7, Driver.Packet.dispatch (queue worker ``` **C1b** ``` **seconds 60:25** from present 408: 93 presents, frame p50 184.1 / p90 386.4 / p99 5395.1 / max 5395.1 ms, GPU busy 70.8 ms per present NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit d842941d04e3, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 467: 5395.1 ms at 12482 ms: Driver.Packet (queue worker 0x20) 5382.4, Driver.Packet (queue worker 0x0) 5357.0, Driver.Packet (queue worker 0x40) 5356.1, Driver.Packet.dispatch (queue worker 0x40) 5356.1 - present 468: 830.2 ms at 17877 ms: Driver.Packet (queue worker 0x20) 808.6, Driver.Packet (queue worker 0x40) 701.8, Driver.Packet.dispatch (queue worker 0x40) 701.7, Driver.Dispatch (queue worker 0x40) 701.1 - present 437: 660.1 ms at 5976 ms: Driver.Packet (queue worker 0x48) 557.2, Driver.Packet.dispatch (queue worker 0x48) 556.8, Driver.Dispatch (queue worker 0x48) 556.7, Driver.Packet (queue worker 0x20) 547.8 - present 439: 602.5 ms at 6678 ms: Driver.Packet (queue worker 0x20) 586.7, Driver.Packet (queue worker 0x48) 572.4, Driver.Packet.dispatch (queue worker 0x48) 572.0, Driver.Dispatch (queue worker 0x48) 571.8 - present 428: 531.6 ms at 4013 ms: Driver.Packet (queue worker 0x20) 507.3, Driver.Packet (queue worker 0x40) 496.6, Driver.Packet.dispatch (queue worker 0x40) 496.6, Driver.Dispatch (queue worker 0x40) 496.4 ``` **C3a** ``` **seconds 60:25** from present 754: 101 presents, frame p50 156.2 / p90 414.9 / p99 694.3 / max 6420.2 ms, GPU busy 51.5 ms per present NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit f3222bb7c416, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 842: 6420.2 ms at 16946 ms: Driver.Packet (queue worker 0x48) 6213.6, Driver.Packet.dispatch (queue worker 0x48) 6211.2, Driver.Dispatch (queue worker 0x48) 6208.4, Vulkan.Dispatch (queue worker 0x48) 6165.2 - present 778: 694.3 ms at 4299 ms: Driver.WorkerWait (queue worker 0x40) 694.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 694.3, Driver.WorkerWait (queue worker 0x0) 665.5, Driver.WorkerWait.idle_and_completi - present 777: 673.5 ms at 3626 ms: Driver.WorkerWait (queue worker 0x40) 673.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 673.5, Driver.WorkerWait (queue worker 0x0) 663.7, Driver.WorkerWait.idle_and_completi - present 770: 620.5 ms at 2010 ms: Driver.WorkerWait (queue worker 0x40) 620.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x40) 620.5, Driver.Packet (queue worker 0x48) 617.7, Driver.Packet.dispatch (queue worker 0 - present 840: 509.5 ms at 16328 ms: Driver.Packet (queue worker 0x20) 489.3, Driver.Packet (queue worker 0x40) 473.2, Driver.Packet.dispatch (queue worker 0x40) 473.2, Driver.Dispatch (queue worker 0x40) 472.1 ``` **C3b** ``` **seconds 60:25** from present 410: 105 presents, frame p50 171.4 / p90 334.9 / p99 799.9 / max 5300.8 ms, GPU busy 56.6 ms per present NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26200, 3840x2160, commit f3222bb7c416, dropped: no **Slowest frames** (largest slices inside each, inclusive) - present 481: 5300.8 ms at 12980 ms: Driver.Packet (queue worker 0x20) 5286.9, Driver.Packet (queue worker 0x40) 5262.7, Driver.Packet.dispatch (queue worker 0x40) 5262.6, Driver.Dispatch (queue worker 0x40) 5262.4 - present 483: 799.9 ms at 18860 ms: Driver.Packet (queue worker 0x48) 766.6, Driver.Packet.dispatch (queue worker 0x48) 765.8, Driver.Dispatch (queue worker 0x48) 765.6, Vulkan.Dispatch (queue worker 0x48) 756.7 - present 482: 579.3 ms at 18281 ms: Driver.WorkerWait (queue worker 0x0) 567.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 566.8, Driver.Packet (queue worker 0x20) 505.5, VideoOut.Flip (presenter) 408.2 - present 486: 506.0 ms at 19970 ms: Driver.Packet (queue worker 0x20) 473.4, Driver.Packet (queue worker 0x40) 454.8, Driver.Packet.dispatch (queue worker 0x40) 454.5, Driver.Dispatch (queue worker 0x40) 454.2 - present 463: 453.0 ms at 9048 ms: Driver.Packet (queue worker 0x0) 416.5, Driver.Packet.dispatch (queue worker 0x0) 410.7, Driver.Packet (queue worker 0x20) 361.6, Driver.Packet (queue worker 0x40) 340.5 ``` </details> </details> Traces, digests, the fps and `[address]` lines of all four runs and the ctest logs: https://github.com/sktharunbalaji13-cmd/AnyPS5/tree/evidence/got-ram-logo/ghost-of-tsushima/commits-2026-11-06 ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: PPSA02225 #4461 - [x] GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU, driver 617.42, Windows 11 (26200) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code), [OpenCode](https://opencode.ai), [Command Code](https://commandcode.ai) and [Gemini](https://gemini.google.com)
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!16188
No description provided.