perf(agc): import a range mapped again on first use instead of at map #8622

Merged
LeandroLP23 merged 1 commit from upstream-pr/8622 into main 2026-10-23 13:00:18 +00:00
LeandroLP23 commented 2026-10-20 18:48:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-20T18:48:16Z.


What

ImportMappedRanges (#1961) imports a GPU-mapped range whole when it is mapped. This is right for a large pool mapped once. For a buffer the guest maps and unmaps over and over at the same address, each map pays a whole-range import on the mapping thread and each unmap retires it.

SuperTuxKart (PPSA69421) maps and unmaps one 2 MiB direct-memory buffer, 0x255200000, about 48 times a frame (APS5_TRACE_MEMORY). Each time it is map direct 0x255200000+0x200000 phys=0x54e00000 prot=0x33. In a 75 s menu run, APS5_TRACE_HOST_IMPORT logged 21,697 imports by map (19,980 of them of that buffer). On Windows, a direct mapping with a single view is committed private memory, and its bytes are saved at unmap and copied back at map. The pages differ at every map, so the import cannot be kept across the unmap.

The table now remembers the ranges (address and size) it imported at map. A range mapped again with the same address and size, and no import left over it, is no longer imported at map; its first GPU use imports it, as before #1961. The first mapping of a range is still imported at map, so the PPSA36082 case #1961 describes (pools mapped once while loading) is unchanged. A range whose import still exists is still checked at map, so the stale-probe repair keeps validating it there. The set is cleared when the table moves to another device and by ClearHostImports.

agc_driver_host_import_at_map expected a range mapped again to be imported at map. It now expects that range not to be imported at map, and expects its first GPU use (a fill) to import it. #8802's replacement-owner regression now expects the replacement to retry its predecessor's failed import on first use rather than at map. importAtMapOverBudgetTests and importRequesterTests register fresh ranges at heap addresses earlier fixtures used, so they start from ClearHostImports.

Tested

Windows 11 26300, AMD Ryzen AI 7 350 / Radeon 860M (driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release.

  • agc_driver_host_import_at_map passes; with GuestBufferMemory.cpp from main it fails with "a range mapped again was imported at map instead of on first use".
  • agc_driver_graphics passes. On main's GuestBufferMemory.cpp the adapted #8802 check fails with "a replacement owner was imported again at map instead of on first use".
  • agc_driver_graphics, the host-import, import-settle, sparse-run and BDA tests and agc_buffer_pool pass with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1 (25 of 25, agc_host_import_sparse skips). The Khronos validation layer is not installed on this machine.
  • SuperTuxKart, one capture per tree, taken one after the other: main at ec7eacc62 and this PR rebased onto it, each a clean build of its commit.
Scene Tree Commit Presents FPS Frame p50 / p90 / p99 (ms)
main menu, APS5_TRACE_SECONDS=40:8 main ec7eacc62d58 83 in 8.1 s 10.26 96.6 / 102.9 / 110.2
this PR bf66eeccfdc9 94 in 8.0 s 11.72 85.1 / 90.0 / 100.8
tutorial race, APS5_TRACE_SECONDS=95:20 main ec7eacc62d58 50 in 20.3 s 2.47 397.5 / 447.6 / 476.1
this PR bf66eeccfdc9 51 in 20.4 s 2.50 392.7 / 420.0 / 465.4

The menu gains 14 %. The race on main is bound by texture copies (about 400 ms a frame), and the change is within run-to-run noise there. On main + #8538 + #6718, earlier and with window-title FPS, the race went from 7.55 to 7.8, one run each.

Summary lines (menu)
{"commit":"ec7eacc62d58","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":328,"ms":8093.236},"presents":83,"frame_ms":{"p50":96.570,"p90":102.851,"p99":110.242,"max":110.242},"gpu_busy_ms_per_present":5.585,"worker_busy_pct":{"queue worker 0x0":3.268},"top_phases_ms_per_frame":{"Graphics.Draw":5.732,"Graphics.Draw.draw_and_resource_release":4.813,"Vulkan.DrawFromRecipe":4.478,"Graphics.DrawWithRecipe":4.460,"Graphics.DrawWithRecipe.draw_and_resource_release":4.451,"Recorder.Submit":3.309,"Driver.Packet":3.136,"Driver.Packet.draw":2.479},"trace_dropped":false,"trace":"aps5-trace-ec7eacc62d58-14020.json.gz"}
{"commit":"bf66eeccfdc9","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":363,"ms":8018.855},"presents":94,"frame_ms":{"p50":85.128,"p90":90.045,"p99":100.765,"max":100.765},"gpu_busy_ms_per_present":5.846,"worker_busy_pct":{"queue worker 0x0":3.576},"top_phases_ms_per_frame":{"Graphics.Draw":6.121,"Graphics.Draw.draw_and_resource_release":5.155,"Vulkan.DrawFromRecipe":5.054,"Graphics.DrawWithRecipe":5.029,"Graphics.DrawWithRecipe.draw_and_resource_release":5.018,"Recorder.Submit":3.297,"Driver.Packet":2.998,"Driver.Packet.draw":2.338},"trace_dropped":false,"trace":"aps5-trace-bf66eeccfdc9-34928.json.gz"}

Traces: main menu, this PR menu, main race, this PR race

tools/trace_digest.py on main (menu)

seconds 40:8 from present 328: 83 presents, frame p50 96.6 / p90 102.9 / p99 110.2 / max 110.2 ms, GPU busy 5.6 ms per present
AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit ec7eacc62d, dropped: no

{"commit":"ec7eacc62d58","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":328,"ms":8093.236},"presents":83,"frame_ms":{"p50":96.57,"p90":102.851,"p99":110.242,"max":110.242},"gpu_busy_ms_per_present":5.585,"worker_busy_pct":{"queue worker 0x0":3.268},"top_phases_ms_per_frame":{"Graphics.Draw":5.732,"Graphics.Draw.draw_and_resource_release":4.813,"Vulkan.DrawFromRecipe":4.478,"Graphics.DrawWithRecipe":4.46,"Graphics.DrawWithRecipe.draw_and_resource_release":4.451,"Recorder.Submit":3.309,"Driver.Packet":3.136,"Driver.Packet.draw":2.479},"trace_dropped":false,"trace":"aps5-trace-ec7eacc62d58-14020.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 353: 110.2 ms at 2425 ms: Driver.WorkerWait (queue worker 0x0) 106.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 106.1, Graphics.Draw (draw committer) 8.0, Graphics.Draw.draw_and_resource_release (draw committer) 6.8
  • present 351: 110.1 ms at 2219 ms: Driver.WorkerWait (queue worker 0x0) 105.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 105.7, Graphics.Draw (draw committer) 8.7, Graphics.Draw.draw_and_resource_release (draw committer) 7.0
  • present 354: 108.3 ms at 2536 ms: Driver.WorkerWait (queue worker 0x0) 104.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 104.2, Graphics.Draw (draw committer) 7.4, Graphics.Draw.draw_and_resource_release (draw committer) 5.9
  • present 396: 107.0 ms at 6613 ms: Driver.WorkerWait (queue worker 0x0) 103.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 103.0, Vulkan.DrawFromRecipe (draw committer) 7.0, Graphics.DrawWithRecipe (draw committer) 7.0
  • present 406: 106.7 ms at 7587 ms: Driver.WorkerWait (queue worker 0x0) 102.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 102.8, Graphics.Draw (draw committer) 7.3, Graphics.Draw.draw_and_resource_release (draw committer) 6.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.2 (0 %) 0.0 (0 %) 97.3 0.6 Recorder.Sync 0.2
queue worker 0x0 2.5 (3 %) 93.9 (96 %) 1.1 3.8 Driver.Packet 2.5, VideoOut.Readiness 0.0
draw committer 13.6 (14 %) 0.1 (0 %) 83.8 0.1 Graphics.Draw 5.7, Vulkan.DrawFromRecipe 4.5
presenter 0.8 (1 %) 0.7 (1 %) 95.9 0.0 VideoOut.Flip 1.5, Driver.Present 0.0
gpu 1.5 (2 %) 0.0 (0 %) 96.0 0.0 batch 1.5

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 93.9, Driver.WorkerWait.idle_and_completion_poll 93.8, Graphics.Draw 5.7, Graphics.Draw.draw_and_resource_release 4.8, Vulkan.DrawFromRecipe 4.5, Graphics.DrawWithRecipe 4.5, Graphics.DrawWithRecipe.draw_and_resource_release 4.5, Recorder.Submit 3.3, Driver.Packet 2.5, Driver.Packet.draw 2.4

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 7.4 ms at 5318 ms, present 382
  • Driver.WorkerWait (queue worker 0x0) 5.4 ms at 148 ms, present 329
  • Driver.WorkerWait (queue worker 0x0) 5.1 ms at 6666 ms, present 396
  • Driver.WorkerWait (queue worker 0x0) 5.0 ms at 46 ms, present 328
  • Driver.WorkerWait (queue worker 0x0) 4.6 ms at 6692 ms, present 396
  • Driver.WorkerWait (queue worker 0x0) 4.5 ms at 3199 ms, present 360
  • Driver.WorkerWait (queue worker 0x0) 4.5 ms at 6770 ms, present 397
  • Driver.WorkerWait (queue worker 0x0) 4.4 ms at 4660 ms, present 375
  • Driver.WorkerWait (queue worker 0x0) 4.4 ms at 1892 ms, present 347
  • Driver.WorkerWait (queue worker 0x0) 4.3 ms at 2608 ms, present 354

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

  • batch 4057: 2.6 ms at 809 ms, present 336: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 4047: 2.4 ms at 784 ms, present 336: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1
  • batch 4106: 2.1 ms at 887 ms, present 337: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1
  • batch 4647: 2.1 ms at 1782 ms, present 346: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 4401: 2.1 ms at 1367 ms, present 342: GPU no ranges; recorded by Recorder.Submit (draw committer) 0.0, Vulkan.DrawFromRecipe (draw committer) 0.0, Graphics.DrawWithRecipe (draw committer) 0.0, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.0
tools/trace_digest.py with this PR (menu)

seconds 40:8 from present 363: 94 presents, frame p50 85.1 / p90 90.0 / p99 100.8 / max 100.8 ms, GPU busy 5.8 ms per present
AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit bf66eeccfd, dropped: no

{"commit":"bf66eeccfdc9","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":363,"ms":8018.855},"presents":94,"frame_ms":{"p50":85.128,"p90":90.045,"p99":100.765,"max":100.765},"gpu_busy_ms_per_present":5.846,"worker_busy_pct":{"queue worker 0x0":3.576},"top_phases_ms_per_frame":{"Graphics.Draw":6.121,"Graphics.Draw.draw_and_resource_release":5.155,"Vulkan.DrawFromRecipe":5.054,"Graphics.DrawWithRecipe":5.029,"Graphics.DrawWithRecipe.draw_and_resource_release":5.018,"Recorder.Submit":3.297,"Driver.Packet":2.998,"Driver.Packet.draw":2.338},"trace_dropped":false,"trace":"aps5-trace-bf66eeccfdc9-34928.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 451: 100.8 ms at 7477 ms: Driver.WorkerWait (queue worker 0x0) 96.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 96.4, Graphics.Draw (draw committer) 8.2, Graphics.Draw.draw_and_resource_release (draw committer) 6.9
  • present 365: 99.0 ms at 168 ms: Driver.WorkerWait (queue worker 0x0) 94.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 94.8, Graphics.Draw (draw committer) 8.2, Graphics.Draw.draw_and_resource_release (draw committer) 7.0
  • present 453: 96.7 ms at 7660 ms: Driver.WorkerWait (queue worker 0x0) 93.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 92.9, Vulkan.DrawFromRecipe (draw committer) 7.2, Graphics.DrawWithRecipe (draw committer) 7.1
  • present 376: 96.5 ms at 1118 ms: Driver.WorkerWait (queue worker 0x0) 92.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 92.5, Graphics.Draw (draw committer) 7.3, batch (gpu) 7.2
  • present 433: 93.1 ms at 5941 ms: Driver.WorkerWait (queue worker 0x0) 89.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 89.4, Graphics.Draw (draw committer) 6.3, Vulkan.DrawFromRecipe (draw committer) 5.7

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.1 (0 %) 0.0 (0 %) 85.2 0.7 Recorder.Sync 0.1
queue worker 0x0 2.3 (3 %) 81.9 (96 %) 1.1 4.0 Driver.Packet 2.3
draw committer 14.5 (17 %) 0.0 (0 %) 70.8 0.2 Graphics.Draw 6.1, Vulkan.DrawFromRecipe 5.1
presenter 0.7 (1 %) 0.5 (1 %) 84.1 0.0 VideoOut.Flip 1.2, Driver.Present 0.0
gpu 1.6 (2 %) 0.0 (0 %) 83.8 0.0 batch 1.6

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 81.9, Driver.WorkerWait.idle_and_completion_poll 81.8, Graphics.Draw 6.1, Graphics.Draw.draw_and_resource_release 5.2, Vulkan.DrawFromRecipe 5.1, Graphics.DrawWithRecipe 5.0, Graphics.DrawWithRecipe.draw_and_resource_release 5.0, Recorder.Submit 3.3, Driver.Packet 2.3, Driver.Packet.draw 2.2

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 4.6 ms at 1953 ms, present 385
  • Driver.WorkerWait (queue worker 0x0) 4.5 ms at 2975 ms, present 397
  • Driver.WorkerWait (queue worker 0x0) 4.5 ms at 996 ms, present 374
  • Driver.WorkerWait (queue worker 0x0) 4.5 ms at 749 ms, present 371
  • Driver.WorkerWait (queue worker 0x0) 4.4 ms at 7723 ms, present 453
  • Driver.WorkerWait (queue worker 0x0) 4.4 ms at 582 ms, present 369
  • Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5159 ms, present 423
  • Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5659 ms, present 429
  • Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5999 ms, present 433
  • Driver.WorkerWait (queue worker 0x0) 4.2 ms at 1615 ms, present 381

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

  • batch 5354: 2.2 ms at 1841 ms, present 384: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1
  • batch 4528: 2.1 ms at 635 ms, present 370: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 4518: 2.1 ms at 614 ms, present 370: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1
  • batch 5226: 2.1 ms at 1651 ms, present 382: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1
  • batch 4410: 2.1 ms at 467 ms, present 368: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0

Skipping every map-time import gave 8.7 FPS in the same menu. Most of the remaining gap is the ranges imported at their first map that the GPU never reads: 322 imports, 961 MiB live, against 3 imports, 130 MiB. That is the trade #1961 describes, and this PR leaves it alone.

#7465 changes the same lines: it defers map imports of ranges up to 64 KiB. The 2 MiB buffer here is not covered by it. tools/pr_overlap.py found no other overlap among the PRs it could compare.

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: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 26300
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4940706793 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-20T18:48:16Z. --- ### What `ImportMappedRanges` (#1961) imports a GPU-mapped range whole when it is mapped. This is right for a large pool mapped once. For a buffer the guest maps and unmaps over and over at the same address, each map pays a whole-range import on the mapping thread and each unmap retires it. SuperTuxKart (PPSA69421) maps and unmaps one 2 MiB direct-memory buffer, `0x255200000`, about 48 times a frame (`APS5_TRACE_MEMORY`). Each time it is `map direct 0x255200000+0x200000 phys=0x54e00000 prot=0x33`. In a 75 s menu run, `APS5_TRACE_HOST_IMPORT` logged 21,697 imports by map (19,980 of them of that buffer). On Windows, a direct mapping with a single view is committed private memory, and its bytes are saved at unmap and copied back at map. The pages differ at every map, so the import cannot be kept across the unmap. The table now remembers the ranges (address and size) it imported at map. A range mapped again with the same address and size, and no import left over it, is no longer imported at map; its first GPU use imports it, as before #1961. The first mapping of a range is still imported at map, so the PPSA36082 case #1961 describes (pools mapped once while loading) is unchanged. A range whose import still exists is still checked at map, so the stale-probe repair keeps validating it there. The set is cleared when the table moves to another device and by `ClearHostImports`. `agc_driver_host_import_at_map` expected a range mapped again to be imported at map. It now expects that range not to be imported at map, and expects its first GPU use (a fill) to import it. #8802's replacement-owner regression now expects the replacement to retry its predecessor's failed import on first use rather than at map. `importAtMapOverBudgetTests` and `importRequesterTests` register fresh ranges at heap addresses earlier fixtures used, so they start from `ClearHostImports`. ### Tested Windows 11 26300, AMD Ryzen AI 7 350 / Radeon 860M (driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release. - `agc_driver_host_import_at_map` passes; with `GuestBufferMemory.cpp` from `main` it fails with "a range mapped again was imported at map instead of on first use". - `agc_driver_graphics` passes. On `main`'s `GuestBufferMemory.cpp` the adapted #8802 check fails with "a replacement owner was imported again at map instead of on first use". - `agc_driver_graphics`, the host-import, import-settle, sparse-run and BDA tests and `agc_buffer_pool` pass with `ANYPS5_REQUIRE_VULKAN=1` and `ANYPS5_NO_SHADER_CACHE=1` (25 of 25, `agc_host_import_sparse` skips). The Khronos validation layer is not installed on this machine. - SuperTuxKart, one capture per tree, taken one after the other: `main` at `ec7eacc62` and this PR rebased onto it, each a clean build of its commit. | Scene | Tree | Commit | Presents | FPS | Frame p50 / p90 / p99 (ms) | |---|---|---|---|---|---| | main menu, `APS5_TRACE_SECONDS=40:8` | `main` | `ec7eacc62d58` | 83 in 8.1 s | 10.26 | 96.6 / 102.9 / 110.2 | | | this PR | `bf66eeccfdc9` | 94 in 8.0 s | 11.72 | 85.1 / 90.0 / 100.8 | | tutorial race, `APS5_TRACE_SECONDS=95:20` | `main` | `ec7eacc62d58` | 50 in 20.3 s | 2.47 | 397.5 / 447.6 / 476.1 | | | this PR | `bf66eeccfdc9` | 51 in 20.4 s | 2.50 | 392.7 / 420.0 / 465.4 | The menu gains 14 %. The race on `main` is bound by texture copies (about 400 ms a frame), and the change is within run-to-run noise there. On `main` + #8538 + #6718, earlier and with window-title FPS, the race went from 7.55 to 7.8, one run each. <details> <summary>Summary lines (menu)</summary> ```json {"commit":"ec7eacc62d58","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":328,"ms":8093.236},"presents":83,"frame_ms":{"p50":96.570,"p90":102.851,"p99":110.242,"max":110.242},"gpu_busy_ms_per_present":5.585,"worker_busy_pct":{"queue worker 0x0":3.268},"top_phases_ms_per_frame":{"Graphics.Draw":5.732,"Graphics.Draw.draw_and_resource_release":4.813,"Vulkan.DrawFromRecipe":4.478,"Graphics.DrawWithRecipe":4.460,"Graphics.DrawWithRecipe.draw_and_resource_release":4.451,"Recorder.Submit":3.309,"Driver.Packet":3.136,"Driver.Packet.draw":2.479},"trace_dropped":false,"trace":"aps5-trace-ec7eacc62d58-14020.json.gz"} {"commit":"bf66eeccfdc9","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":363,"ms":8018.855},"presents":94,"frame_ms":{"p50":85.128,"p90":90.045,"p99":100.765,"max":100.765},"gpu_busy_ms_per_present":5.846,"worker_busy_pct":{"queue worker 0x0":3.576},"top_phases_ms_per_frame":{"Graphics.Draw":6.121,"Graphics.Draw.draw_and_resource_release":5.155,"Vulkan.DrawFromRecipe":5.054,"Graphics.DrawWithRecipe":5.029,"Graphics.DrawWithRecipe.draw_and_resource_release":5.018,"Recorder.Submit":3.297,"Driver.Packet":2.998,"Driver.Packet.draw":2.338},"trace_dropped":false,"trace":"aps5-trace-bf66eeccfdc9-34928.json.gz"} ``` Traces: [`main` menu](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/menu-main-aps5-trace-ec7eacc62d58-14020.json.gz), [this PR menu](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/menu-pr8622-aps5-trace-bf66eeccfdc9-34928.json.gz), [`main` race](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/race-main-aps5-trace-ec7eacc62d58-25300.json.gz), [this PR race](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/race-pr8622-aps5-trace-bf66eeccfdc9-38708.json.gz) </details> <details> <summary><code>tools/trace_digest.py</code> on <code>main</code> (menu)</summary> **seconds 40:8** from present 328: 83 presents, frame p50 96.6 / p90 102.9 / p99 110.2 / max 110.2 ms, GPU busy 5.6 ms per present AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit ec7eacc62d58, dropped: no ```json {"commit":"ec7eacc62d58","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":328,"ms":8093.236},"presents":83,"frame_ms":{"p50":96.57,"p90":102.851,"p99":110.242,"max":110.242},"gpu_busy_ms_per_present":5.585,"worker_busy_pct":{"queue worker 0x0":3.268},"top_phases_ms_per_frame":{"Graphics.Draw":5.732,"Graphics.Draw.draw_and_resource_release":4.813,"Vulkan.DrawFromRecipe":4.478,"Graphics.DrawWithRecipe":4.46,"Graphics.DrawWithRecipe.draw_and_resource_release":4.451,"Recorder.Submit":3.309,"Driver.Packet":3.136,"Driver.Packet.draw":2.479},"trace_dropped":false,"trace":"aps5-trace-ec7eacc62d58-14020.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 353: 110.2 ms at 2425 ms: Driver.WorkerWait (queue worker 0x0) 106.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 106.1, Graphics.Draw (draw committer) 8.0, Graphics.Draw.draw_and_resource_release (draw committer) 6.8 - present 351: 110.1 ms at 2219 ms: Driver.WorkerWait (queue worker 0x0) 105.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 105.7, Graphics.Draw (draw committer) 8.7, Graphics.Draw.draw_and_resource_release (draw committer) 7.0 - present 354: 108.3 ms at 2536 ms: Driver.WorkerWait (queue worker 0x0) 104.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 104.2, Graphics.Draw (draw committer) 7.4, Graphics.Draw.draw_and_resource_release (draw committer) 5.9 - present 396: 107.0 ms at 6613 ms: Driver.WorkerWait (queue worker 0x0) 103.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 103.0, Vulkan.DrawFromRecipe (draw committer) 7.0, Graphics.DrawWithRecipe (draw committer) 7.0 - present 406: 106.7 ms at 7587 ms: Driver.WorkerWait (queue worker 0x0) 102.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 102.8, Graphics.Draw (draw committer) 7.3, Graphics.Draw.draw_and_resource_release (draw committer) 6.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.2 (0 %) | 0.0 (0 %) | 97.3 | 0.6 | Recorder.Sync 0.2 | | queue worker 0x0 | 2.5 (3 %) | 93.9 (96 %) | 1.1 | 3.8 | Driver.Packet 2.5, VideoOut.Readiness 0.0 | | draw committer | 13.6 (14 %) | 0.1 (0 %) | 83.8 | 0.1 | Graphics.Draw 5.7, Vulkan.DrawFromRecipe 4.5 | | presenter | 0.8 (1 %) | 0.7 (1 %) | 95.9 | 0.0 | VideoOut.Flip 1.5, Driver.Present 0.0 | | gpu | 1.5 (2 %) | 0.0 (0 %) | 96.0 | 0.0 | batch 1.5 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 93.9, Driver.WorkerWait.idle_and_completion_poll 93.8, Graphics.Draw 5.7, Graphics.Draw.draw_and_resource_release 4.8, Vulkan.DrawFromRecipe 4.5, Graphics.DrawWithRecipe 4.5, Graphics.DrawWithRecipe.draw_and_resource_release 4.5, Recorder.Submit 3.3, Driver.Packet 2.5, Driver.Packet.draw 2.4 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 7.4 ms at 5318 ms, present 382 - Driver.WorkerWait (queue worker 0x0) 5.4 ms at 148 ms, present 329 - Driver.WorkerWait (queue worker 0x0) 5.1 ms at 6666 ms, present 396 - Driver.WorkerWait (queue worker 0x0) 5.0 ms at 46 ms, present 328 - Driver.WorkerWait (queue worker 0x0) 4.6 ms at 6692 ms, present 396 - Driver.WorkerWait (queue worker 0x0) 4.5 ms at 3199 ms, present 360 - Driver.WorkerWait (queue worker 0x0) 4.5 ms at 6770 ms, present 397 - Driver.WorkerWait (queue worker 0x0) 4.4 ms at 4660 ms, present 375 - Driver.WorkerWait (queue worker 0x0) 4.4 ms at 1892 ms, present 347 - Driver.WorkerWait (queue worker 0x0) 4.3 ms at 2608 ms, present 354 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4057: 2.6 ms at 809 ms, present 336: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1 - batch 4047: 2.4 ms at 784 ms, present 336: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 - batch 4106: 2.1 ms at 887 ms, present 337: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1 - batch 4647: 2.1 ms at 1782 ms, present 346: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1 - batch 4401: 2.1 ms at 1367 ms, present 342: GPU no ranges; recorded by Recorder.Submit (draw committer) 0.0, Vulkan.DrawFromRecipe (draw committer) 0.0, Graphics.DrawWithRecipe (draw committer) 0.0, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.0 </details> <details> <summary><code>tools/trace_digest.py</code> with this PR (menu)</summary> **seconds 40:8** from present 363: 94 presents, frame p50 85.1 / p90 90.0 / p99 100.8 / max 100.8 ms, GPU busy 5.8 ms per present AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit bf66eeccfdc9, dropped: no ```json {"commit":"bf66eeccfdc9","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":363,"ms":8018.855},"presents":94,"frame_ms":{"p50":85.128,"p90":90.045,"p99":100.765,"max":100.765},"gpu_busy_ms_per_present":5.846,"worker_busy_pct":{"queue worker 0x0":3.576},"top_phases_ms_per_frame":{"Graphics.Draw":6.121,"Graphics.Draw.draw_and_resource_release":5.155,"Vulkan.DrawFromRecipe":5.054,"Graphics.DrawWithRecipe":5.029,"Graphics.DrawWithRecipe.draw_and_resource_release":5.018,"Recorder.Submit":3.297,"Driver.Packet":2.998,"Driver.Packet.draw":2.338},"trace_dropped":false,"trace":"aps5-trace-bf66eeccfdc9-34928.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 451: 100.8 ms at 7477 ms: Driver.WorkerWait (queue worker 0x0) 96.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 96.4, Graphics.Draw (draw committer) 8.2, Graphics.Draw.draw_and_resource_release (draw committer) 6.9 - present 365: 99.0 ms at 168 ms: Driver.WorkerWait (queue worker 0x0) 94.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 94.8, Graphics.Draw (draw committer) 8.2, Graphics.Draw.draw_and_resource_release (draw committer) 7.0 - present 453: 96.7 ms at 7660 ms: Driver.WorkerWait (queue worker 0x0) 93.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 92.9, Vulkan.DrawFromRecipe (draw committer) 7.2, Graphics.DrawWithRecipe (draw committer) 7.1 - present 376: 96.5 ms at 1118 ms: Driver.WorkerWait (queue worker 0x0) 92.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 92.5, Graphics.Draw (draw committer) 7.3, batch (gpu) 7.2 - present 433: 93.1 ms at 5941 ms: Driver.WorkerWait (queue worker 0x0) 89.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 89.4, Graphics.Draw (draw committer) 6.3, Vulkan.DrawFromRecipe (draw committer) 5.7 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.1 (0 %) | 0.0 (0 %) | 85.2 | 0.7 | Recorder.Sync 0.1 | | queue worker 0x0 | 2.3 (3 %) | 81.9 (96 %) | 1.1 | 4.0 | Driver.Packet 2.3 | | draw committer | 14.5 (17 %) | 0.0 (0 %) | 70.8 | 0.2 | Graphics.Draw 6.1, Vulkan.DrawFromRecipe 5.1 | | presenter | 0.7 (1 %) | 0.5 (1 %) | 84.1 | 0.0 | VideoOut.Flip 1.2, Driver.Present 0.0 | | gpu | 1.6 (2 %) | 0.0 (0 %) | 83.8 | 0.0 | batch 1.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 81.9, Driver.WorkerWait.idle_and_completion_poll 81.8, Graphics.Draw 6.1, Graphics.Draw.draw_and_resource_release 5.2, Vulkan.DrawFromRecipe 5.1, Graphics.DrawWithRecipe 5.0, Graphics.DrawWithRecipe.draw_and_resource_release 5.0, Recorder.Submit 3.3, Driver.Packet 2.3, Driver.Packet.draw 2.2 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 4.6 ms at 1953 ms, present 385 - Driver.WorkerWait (queue worker 0x0) 4.5 ms at 2975 ms, present 397 - Driver.WorkerWait (queue worker 0x0) 4.5 ms at 996 ms, present 374 - Driver.WorkerWait (queue worker 0x0) 4.5 ms at 749 ms, present 371 - Driver.WorkerWait (queue worker 0x0) 4.4 ms at 7723 ms, present 453 - Driver.WorkerWait (queue worker 0x0) 4.4 ms at 582 ms, present 369 - Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5159 ms, present 423 - Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5659 ms, present 429 - Driver.WorkerWait (queue worker 0x0) 4.3 ms at 5999 ms, present 433 - Driver.WorkerWait (queue worker 0x0) 4.2 ms at 1615 ms, present 381 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 5354: 2.2 ms at 1841 ms, present 384: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 - batch 4528: 2.1 ms at 635 ms, present 370: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 4518: 2.1 ms at 614 ms, present 370: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1 - batch 5226: 2.1 ms at 1651 ms, present 382: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1 - batch 4410: 2.1 ms at 467 ms, present 368: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 </details> Skipping every map-time import gave 8.7 FPS in the same menu. Most of the remaining gap is the ranges imported at their first map that the GPU never reads: 322 imports, 961 MiB live, against 3 imports, 130 MiB. That is the trade #1961 describes, and this PR leaves it alone. #7465 changes the same lines: it defers map imports of ranges up to 64 KiB. The 2 MiB buffer here is not covered by it. `tools/pr_overlap.py` found no other overlap among the PRs it could compare. ### 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: none - [x] GPUs tested: AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 26300 - [x] AI-assisted: yes (Claude Code)
github-actions[bot] commented 2026-10-20 18:48:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T18:48:31Z.


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

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

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:33:49Z.

Code review location: core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp; line 241

@@ -238,6 +238,7 @@ struct HostImports {
     std::map<std::uint64_t, ImportFailure> failedJoins;
     std::map<std::uint64_t, std::uint64_t> sparseRunEnds;
     std::map<std::uint64_t, std::uint32_t> sparseRunJoins;
+    std::set<std::uint64_t> importedAtMap;

importedAtMap is a process-lifetime history: this inserts every distinct mapped range address, and the only clear in the diff is on device change. A workload that repeatedly maps fresh addresses and unmaps them can leave one std::set node per address after the corresponding imports are gone. Could this history be bounded (for example, evict older addresses at a fixed cap)? If an evicted address is seen again, eagerly importing it is the existing behavior, so the cap should affect only this optimization, not correctness.

<!-- greyfinch-sync:boykopovar/AnyPS5:review-comment:4329393991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622#discussion_r4329393991). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T19:33:49Z. **Code review location:** `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp`; line 241 ~~~~diff @@ -238,6 +238,7 @@ struct HostImports { std::map<std::uint64_t, ImportFailure> failedJoins; std::map<std::uint64_t, std::uint64_t> sparseRunEnds; std::map<std::uint64_t, std::uint32_t> sparseRunJoins; + std::set<std::uint64_t> importedAtMap; ~~~~ --- `importedAtMap` is a process-lifetime history: this inserts every distinct mapped range address, and the only clear in the diff is on device change. A workload that repeatedly maps fresh addresses and unmaps them can leave one `std::set` node per address after the corresponding imports are gone. Could this history be bounded (for example, evict older addresses at a fixed cap)? If an evicted address is seen again, eagerly importing it is the existing behavior, so the cap should affect only this optimization, not correctness.
LeandroLP23 commented 2026-10-20 20:05:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-20T20:05:57Z.


These are the traces behind the two summary lines in the description. Both are SuperTuxKart main-menu captures with APS5_TRACE_SECONDS=40:8, Radeon 860M, Windows 11 26300, taken one after the other:

The import and the retirement this PR moves run on the title thread, which is untraced (143 ms of the frame). That is why the digests show the change in frame time and presents, not in a named slice: 56 → 67 presents in 8.1 s, p50 144.2 → 120.8 ms.

tools/trace_digest.py on main

seconds 40:8 from present 220: 56 presents, frame p50 144.2 / p90 148.2 / p99 151.4 / max 151.4 ms, GPU busy 6.1 ms per present
AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit 976583da31c3 (dirty), dropped: no

{"commit":"976583da31c3","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":220,"ms":8100.241},"presents":56,"frame_ms":{"p50":144.167,"p90":148.188,"p99":151.417,"max":151.417},"gpu_busy_ms_per_present":6.082,"worker_busy_pct":{"queue worker 0x0":2.548},"top_phases_ms_per_frame":{"Graphics.Draw":10.188,"Vulkan.DrawFromRecipe":9.028,"Graphics.DrawWithRecipe":9.0,"Graphics.DrawWithRecipe.draw_and_resource_release":8.985,"Graphics.Draw.draw_and_resource_release":8.675,"Recorder.Submit":3.88,"Driver.Packet":3.627,"Driver.Packet.draw":2.861},"trace_dropped":false,"trace":"aps5-trace-976583da31c3-37108.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 263: 151.4 ms at 6202 ms: Driver.WorkerWait (queue worker 0x0) 146.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.8, Graphics.Draw (draw committer) 10.9, Vulkan.DrawFromRecipe (draw committer) 9.8
  • present 266: 150.5 ms at 6645 ms: Driver.WorkerWait (queue worker 0x0) 146.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.0, Graphics.Draw (draw committer) 10.4, Vulkan.DrawFromRecipe (draw committer) 10.1
  • present 264: 150.4 ms at 6354 ms: Driver.WorkerWait (queue worker 0x0) 146.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.0, Vulkan.DrawFromRecipe (draw committer) 10.0, Graphics.DrawWithRecipe (draw committer) 10.0
  • present 268: 149.6 ms at 6939 ms: Driver.WorkerWait (queue worker 0x0) 145.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 145.3, Graphics.Draw (draw committer) 10.6, Vulkan.DrawFromRecipe (draw committer) 9.1
  • present 236: 148.7 ms at 2300 ms: Driver.WorkerWait (queue worker 0x0) 144.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 144.2, Graphics.Draw (draw committer) 10.9, Vulkan.DrawFromRecipe (draw committer) 9.8

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 1.5 (1 %) 0.0 (0 %) 143.1 0.0 Recorder.Sync 1.5
queue worker 0x0 2.9 (2 %) 140.5 (97 %) 1.2 4.1 Driver.Packet 2.9, Driver.Completion 0.0
draw committer 23.2 (16 %) 0.3 (0 %) 121.2 0.1 Graphics.Draw 10.2, Vulkan.DrawFromRecipe 9.0
presenter 0.9 (1 %) 1.0 (1 %) 142.8 0.0 VideoOut.Flip 1.8, Driver.Present 0.0
gpu 1.6 (1 %) 0.0 (0 %) 143.0 0.0 batch 1.6

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 140.5, Driver.WorkerWait.idle_and_completion_poll 140.4, Graphics.Draw 10.2, Vulkan.DrawFromRecipe 9.0, Graphics.DrawWithRecipe 9.0

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 6.2 ms at 4251 ms, present 249
  • Driver.WorkerWait (queue worker 0x0) 5.4 ms at 6434 ms, present 264
  • Driver.WorkerWait (queue worker 0x0) 5.2 ms at 7018 ms, present 268
  • Driver.WorkerWait (queue worker 0x0) 5.1 ms at 6463 ms, present 264
  • Driver.WorkerWait (queue worker 0x0) 5.1 ms at 3424 ms, present 243

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

  • batch 2874: 2.1 ms at 1135 ms, present 227: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1
  • batch 3063: 2.1 ms at 1601 ms, present 231: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1
  • batch 2635: 2.1 ms at 551 ms, present 223: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Reap (draw committer) 0.0
  • batch 3183: 2.1 ms at 1888 ms, present 233: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0
  • batch 3003: 2.1 ms at 1454 ms, present 230: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1
tools/trace_digest.py with this PR

seconds 40:8 from present 262: 67 presents, frame p50 120.8 / p90 126.9 / p99 134.2 / max 134.2 ms, GPU busy 6.0 ms per present
AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit 976583da31c3, dropped: no

{"commit":"976583da31c3","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":262,"ms":8076.091},"presents":67,"frame_ms":{"p50":120.842,"p90":126.906,"p99":134.245,"max":134.245},"gpu_busy_ms_per_present":5.994,"worker_busy_pct":{"queue worker 0x0":3.094},"top_phases_ms_per_frame":{"Graphics.Draw":9.564,"Graphics.Draw.draw_and_resource_release":8.314,"Vulkan.DrawFromRecipe":8.032,"Graphics.DrawWithRecipe":8.004,"Graphics.DrawWithRecipe.draw_and_resource_release":7.988,"Recorder.Submit":4.267,"Driver.Packet":3.665,"Driver.Packet.draw":2.896},"trace_dropped":false,"trace":"aps5-trace-976583da31c3-9616.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 266: 134.2 ms at 485 ms: Driver.WorkerWait (queue worker 0x0) 129.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 129.7, Graphics.Draw (draw committer) 10.9, Graphics.Draw.draw_and_resource_release (draw committer) 9.5
  • present 287: 129.7 ms at 2998 ms: Driver.WorkerWait (queue worker 0x0) 125.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 125.2, Graphics.Draw (draw committer) 10.8, Graphics.Draw.draw_and_resource_release (draw committer) 9.5
  • present 279: 129.1 ms at 2033 ms: Driver.WorkerWait (queue worker 0x0) 124.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 124.8, Vulkan.DrawFromRecipe (draw committer) 9.7, Graphics.DrawWithRecipe (draw committer) 9.7
  • present 296: 127.4 ms at 4075 ms: Driver.WorkerWait (queue worker 0x0) 123.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 123.0, Graphics.Draw (draw committer) 9.7, Graphics.Draw.draw_and_resource_release (draw committer) 8.5
  • present 285: 127.3 ms at 2751 ms: Driver.WorkerWait (queue worker 0x0) 122.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 122.7, Graphics.Draw (draw committer) 10.0, Vulkan.DrawFromRecipe (draw committer) 8.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 1.4 (1 %) 0.0 (0 %) 119.2 0.1 Recorder.Sync 1.4
queue worker 0x0 3.0 (2 %) 116.4 (97 %) 1.2 4.1 Driver.Packet 3.0, Driver.EndSubmission 0.0
draw committer 22.0 (18 %) 0.1 (0 %) 98.4 0.1 Graphics.Draw 9.6, Vulkan.DrawFromRecipe 8.0
presenter 0.9 (1 %) 0.5 (0 %) 119.1 0.0 VideoOut.Flip 1.4, Driver.Present 0.0
gpu 1.6 (1 %) 0.0 (0 %) 118.9 0.0 batch 1.6

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 116.4, Driver.WorkerWait.idle_and_completion_poll 116.3, Graphics.Draw 9.6, Graphics.Draw.draw_and_resource_release 8.3, Vulkan.DrawFromRecipe 8.0

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 6.0 ms at 6226 ms, present 313
  • Driver.WorkerWait (queue worker 0x0) 5.3 ms at 2120 ms, present 279
  • Driver.WorkerWait (queue worker 0x0) 5.0 ms at 6059 ms, present 312
  • Driver.WorkerWait (queue worker 0x0) 4.9 ms at 92 ms, present 262
  • Driver.WorkerWait (queue worker 0x0) 4.9 ms at 5496 ms, present 307

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

  • batch 3645: 2.1 ms at 1561 ms, present 275: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 3055: 2.1 ms at 345 ms, present 264: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.5, Graphics.DrawWithRecipe (draw committer) 0.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.5, Recorder.Submit (draw committer) 0.1
  • batch 2996: 2.1 ms at 227 ms, present 263: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1
  • batch 3104: 2.1 ms at 440 ms, present 265: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1
  • batch 3704: 2.1 ms at 1674 ms, present 276: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300332899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622#issuecomment-6300332899). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-20T20:05:57Z. --- These are the traces behind the two summary lines in the description. Both are SuperTuxKart main-menu captures with `APS5_TRACE_SECONDS=40:8`, Radeon 860M, Windows 11 26300, taken one after the other: - `main`: [main-aps5-trace-976583da31c3-37108.json.gz](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/main-aps5-trace-976583da31c3-37108.json.gz). This is this branch built with `GuestBufferMemory.cpp` from `main` 892a4f132, so its summary says `"dirty":true`. - this PR: [pr8622-aps5-trace-976583da31c3-9616.json.gz](https://github.com/LeandroLP23/AnyPS5/releases/download/pr8622-traces/pr8622-aps5-trace-976583da31c3-9616.json.gz). The import and the retirement this PR moves run on the title thread, which is untraced (143 ms of the frame). That is why the digests show the change in frame time and presents, not in a named slice: 56 → 67 presents in 8.1 s, p50 144.2 → 120.8 ms. <details> <summary><code>tools/trace_digest.py</code> on <code>main</code></summary> **seconds 40:8** from present 220: 56 presents, frame p50 144.2 / p90 148.2 / p99 151.4 / max 151.4 ms, GPU busy 6.1 ms per present AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit 976583da31c3 (dirty), dropped: no ```json {"commit":"976583da31c3","dirty":true,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":220,"ms":8100.241},"presents":56,"frame_ms":{"p50":144.167,"p90":148.188,"p99":151.417,"max":151.417},"gpu_busy_ms_per_present":6.082,"worker_busy_pct":{"queue worker 0x0":2.548},"top_phases_ms_per_frame":{"Graphics.Draw":10.188,"Vulkan.DrawFromRecipe":9.028,"Graphics.DrawWithRecipe":9.0,"Graphics.DrawWithRecipe.draw_and_resource_release":8.985,"Graphics.Draw.draw_and_resource_release":8.675,"Recorder.Submit":3.88,"Driver.Packet":3.627,"Driver.Packet.draw":2.861},"trace_dropped":false,"trace":"aps5-trace-976583da31c3-37108.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 263: 151.4 ms at 6202 ms: Driver.WorkerWait (queue worker 0x0) 146.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.8, Graphics.Draw (draw committer) 10.9, Vulkan.DrawFromRecipe (draw committer) 9.8 - present 266: 150.5 ms at 6645 ms: Driver.WorkerWait (queue worker 0x0) 146.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.0, Graphics.Draw (draw committer) 10.4, Vulkan.DrawFromRecipe (draw committer) 10.1 - present 264: 150.4 ms at 6354 ms: Driver.WorkerWait (queue worker 0x0) 146.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 146.0, Vulkan.DrawFromRecipe (draw committer) 10.0, Graphics.DrawWithRecipe (draw committer) 10.0 - present 268: 149.6 ms at 6939 ms: Driver.WorkerWait (queue worker 0x0) 145.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 145.3, Graphics.Draw (draw committer) 10.6, Vulkan.DrawFromRecipe (draw committer) 9.1 - present 236: 148.7 ms at 2300 ms: Driver.WorkerWait (queue worker 0x0) 144.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 144.2, Graphics.Draw (draw committer) 10.9, Vulkan.DrawFromRecipe (draw committer) 9.8 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 1.5 (1 %) | 0.0 (0 %) | 143.1 | 0.0 | Recorder.Sync 1.5 | | queue worker 0x0 | 2.9 (2 %) | 140.5 (97 %) | 1.2 | 4.1 | Driver.Packet 2.9, Driver.Completion 0.0 | | draw committer | 23.2 (16 %) | 0.3 (0 %) | 121.2 | 0.1 | Graphics.Draw 10.2, Vulkan.DrawFromRecipe 9.0 | | presenter | 0.9 (1 %) | 1.0 (1 %) | 142.8 | 0.0 | VideoOut.Flip 1.8, Driver.Present 0.0 | | gpu | 1.6 (1 %) | 0.0 (0 %) | 143.0 | 0.0 | batch 1.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 140.5, Driver.WorkerWait.idle_and_completion_poll 140.4, Graphics.Draw 10.2, Vulkan.DrawFromRecipe 9.0, Graphics.DrawWithRecipe 9.0 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 6.2 ms at 4251 ms, present 249 - Driver.WorkerWait (queue worker 0x0) 5.4 ms at 6434 ms, present 264 - Driver.WorkerWait (queue worker 0x0) 5.2 ms at 7018 ms, present 268 - Driver.WorkerWait (queue worker 0x0) 5.1 ms at 6463 ms, present 264 - Driver.WorkerWait (queue worker 0x0) 5.1 ms at 3424 ms, present 243 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 2874: 2.1 ms at 1135 ms, present 227: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Submit (draw committer) 0.1 - batch 3063: 2.1 ms at 1601 ms, present 231: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 - batch 2635: 2.1 ms at 551 ms, present 223: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.1, Graphics.DrawWithRecipe (draw committer) 0.1, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.1, Recorder.Reap (draw committer) 0.0 - batch 3183: 2.1 ms at 1888 ms, present 233: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.0 - batch 3003: 2.1 ms at 1454 ms, present 230: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 </details> <details> <summary><code>tools/trace_digest.py</code> with this PR</summary> **seconds 40:8** from present 262: 67 presents, frame p50 120.8 / p90 126.9 / p99 134.2 / max 134.2 ms, GPU busy 6.0 ms per present AMD Radeon(TM) 860M Graphics, AMD proprietary driver 24.30.58.08 (LLPC), Windows 10.0.26300, 1920x1080, commit 976583da31c3, dropped: no ```json {"commit":"976583da31c3","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"40:8"},"gpu":"AMD Radeon(TM) 860M Graphics","driver":"AMD proprietary driver 24.30.58.08 (LLPC)","os":"Windows 10.0.26300","cpu":"AMD Ryzen AI 7 350 w/ Radeon 860M","cpu_threads":16,"memory_mib":31866,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 40:8","first_present":262,"ms":8076.091},"presents":67,"frame_ms":{"p50":120.842,"p90":126.906,"p99":134.245,"max":134.245},"gpu_busy_ms_per_present":5.994,"worker_busy_pct":{"queue worker 0x0":3.094},"top_phases_ms_per_frame":{"Graphics.Draw":9.564,"Graphics.Draw.draw_and_resource_release":8.314,"Vulkan.DrawFromRecipe":8.032,"Graphics.DrawWithRecipe":8.004,"Graphics.DrawWithRecipe.draw_and_resource_release":7.988,"Recorder.Submit":4.267,"Driver.Packet":3.665,"Driver.Packet.draw":2.896},"trace_dropped":false,"trace":"aps5-trace-976583da31c3-9616.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 266: 134.2 ms at 485 ms: Driver.WorkerWait (queue worker 0x0) 129.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 129.7, Graphics.Draw (draw committer) 10.9, Graphics.Draw.draw_and_resource_release (draw committer) 9.5 - present 287: 129.7 ms at 2998 ms: Driver.WorkerWait (queue worker 0x0) 125.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 125.2, Graphics.Draw (draw committer) 10.8, Graphics.Draw.draw_and_resource_release (draw committer) 9.5 - present 279: 129.1 ms at 2033 ms: Driver.WorkerWait (queue worker 0x0) 124.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 124.8, Vulkan.DrawFromRecipe (draw committer) 9.7, Graphics.DrawWithRecipe (draw committer) 9.7 - present 296: 127.4 ms at 4075 ms: Driver.WorkerWait (queue worker 0x0) 123.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 123.0, Graphics.Draw (draw committer) 9.7, Graphics.Draw.draw_and_resource_release (draw committer) 8.5 - present 285: 127.3 ms at 2751 ms: Driver.WorkerWait (queue worker 0x0) 122.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 122.7, Graphics.Draw (draw committer) 10.0, Vulkan.DrawFromRecipe (draw committer) 8.4 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 1.4 (1 %) | 0.0 (0 %) | 119.2 | 0.1 | Recorder.Sync 1.4 | | queue worker 0x0 | 3.0 (2 %) | 116.4 (97 %) | 1.2 | 4.1 | Driver.Packet 3.0, Driver.EndSubmission 0.0 | | draw committer | 22.0 (18 %) | 0.1 (0 %) | 98.4 | 0.1 | Graphics.Draw 9.6, Vulkan.DrawFromRecipe 8.0 | | presenter | 0.9 (1 %) | 0.5 (0 %) | 119.1 | 0.0 | VideoOut.Flip 1.4, Driver.Present 0.0 | | gpu | 1.6 (1 %) | 0.0 (0 %) | 118.9 | 0.0 | batch 1.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 116.4, Driver.WorkerWait.idle_and_completion_poll 116.3, Graphics.Draw 9.6, Graphics.Draw.draw_and_resource_release 8.3, Vulkan.DrawFromRecipe 8.0 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 6.0 ms at 6226 ms, present 313 - Driver.WorkerWait (queue worker 0x0) 5.3 ms at 2120 ms, present 279 - Driver.WorkerWait (queue worker 0x0) 5.0 ms at 6059 ms, present 312 - Driver.WorkerWait (queue worker 0x0) 4.9 ms at 92 ms, present 262 - Driver.WorkerWait (queue worker 0x0) 4.9 ms at 5496 ms, present 307 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 3645: 2.1 ms at 1561 ms, present 275: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1 - batch 3055: 2.1 ms at 345 ms, present 264: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.5, Graphics.DrawWithRecipe (draw committer) 0.5, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.5, Recorder.Submit (draw committer) 0.1 - batch 2996: 2.1 ms at 227 ms, present 263: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 - batch 3104: 2.1 ms at 440 ms, present 265: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.2, Graphics.DrawWithRecipe (draw committer) 0.2, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.2, Recorder.Submit (draw committer) 0.1 - batch 3704: 2.1 ms at 1674 ms, present 276: GPU no ranges; recorded by Vulkan.DrawFromRecipe (draw committer) 0.3, Graphics.DrawWithRecipe (draw committer) 0.3, Graphics.DrawWithRecipe.draw_and_resource_release (draw committer) 0.3, Recorder.Submit (draw committer) 0.1 </details> AI-assisted: yes (Claude Code)
JJenkx commented 2026-10-21 01:27:11 +00:00 (Migrated from github.com)

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


Related: #8802 fixes failure-memo lifetime in ImportMappedRanges. It removes the blanket failure-cache clear when an unrelated mapping changes the registry generation during an import. Its regression checks both unrelated mappings and retry after replacement of the actual mapping owner.

Your repeated-address deferral addresses a different case, but the nearby map-import code overlaps. #8802 does not depend on the deferral; I can rebase it and adapt its replacement-owner regression to first-use import if #8622 lands first. Please let me know your preferred order.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6305724614 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622#issuecomment-6305724614). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T01:27:11Z. --- Related: #8802 fixes failure-memo lifetime in `ImportMappedRanges`. It removes the blanket failure-cache clear when an unrelated mapping changes the registry generation during an import. Its regression checks both unrelated mappings and retry after replacement of the actual mapping owner. Your repeated-address deferral addresses a different case, but the nearby map-import code overlaps. #8802 does not depend on the deferral; I can rebase it and adapt its replacement-owner regression to first-use import if #8622 lands first. Please let me know your preferred order.
LeandroLP23 commented 2026-10-21 06:37:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T06:37:15Z.


@JJenkx #8802 landed first, so I rebased this onto it (bf66eeccf) and adapted its replacement-owner regression to the first-use import, as you suggested:

  • After the owner is replaced, the map pass no longer imports the range: probe.calls stays at 1. The first use (HostImportFor over the whole range) then retries the predecessor's failed import, and probe.calls reaches 2. On main's GuestBufferMemory.cpp the new map-time assertion fails, as expected.
  • Running the whole BDA suite exposed two problems in my change, both fixed:
    • The deferral was keyed by address alone. Fixtures that allocate a new range at an address an earlier fixture had used were treated as remaps. The key is now the registered address and size.
    • A range whose import still exists is no longer skipped at map, so the stale-probe repair still validates it there (importStaleProbeTests exact-whole case).
  • ClearHostImports now forgets the deferred ranges too. importAtMapOverBudgetTests and importRequesterTests, which register fresh ranges at reused heap addresses, start from a cleared state.

Tested on a Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0, Release, with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1: agc_driver_graphics, the host-import, import-settle, sparse-run and BDA tests, agc_driver_host_import_at_map and agc_buffer_pool all pass (25 of 25, agc_host_import_sparse skips).

Edit: an earlier version of this comment said agc_driver_graphics (PA_CL_CLIP_CNTL) and agc_driver_host_import_failure_handles failed on main on this machine. That came from an incomplete build: ninja stopped at an unrelated compile error and left stale test binaries. With a full build both pass on main and on this branch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309743250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622#issuecomment-6309743250). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-21T06:37:15Z. --- @JJenkx #8802 landed first, so I rebased this onto it (bf66eeccf) and adapted its replacement-owner regression to the first-use import, as you suggested: - After the owner is replaced, the map pass no longer imports the range: `probe.calls` stays at 1. The first use (`HostImportFor` over the whole range) then retries the predecessor's failed import, and `probe.calls` reaches 2. On `main`'s `GuestBufferMemory.cpp` the new map-time assertion fails, as expected. - Running the whole BDA suite exposed two problems in my change, both fixed: - The deferral was keyed by address alone. Fixtures that allocate a new range at an address an earlier fixture had used were treated as remaps. The key is now the registered address and size. - A range whose import still exists is no longer skipped at map, so the stale-probe repair still validates it there (`importStaleProbeTests` exact-whole case). - `ClearHostImports` now forgets the deferred ranges too. `importAtMapOverBudgetTests` and `importRequesterTests`, which register fresh ranges at reused heap addresses, start from a cleared state. Tested on a Radeon 860M, Windows 11 26300, WinLibs GCC 15.2.0, Release, with `ANYPS5_REQUIRE_VULKAN=1` and `ANYPS5_NO_SHADER_CACHE=1`: `agc_driver_graphics`, the host-import, import-settle, sparse-run and BDA tests, `agc_driver_host_import_at_map` and `agc_buffer_pool` all pass (25 of 25, `agc_host_import_sparse` skips). Edit: an earlier version of this comment said `agc_driver_graphics` (`PA_CL_CLIP_CNTL`) and `agc_driver_host_import_failure_handles` failed on `main` on this machine. That came from an incomplete build: ninja stopped at an unrelated compile error and left stale test binaries. With a full build both pass on `main` and on this branch.
JJenkx commented 2026-10-21 22:46:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-21T22:46:02Z.


AMD/Linux data point on a second title, measured next to #7465 (which defers small imports by size).

Setup

  • Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347), tutorial scene, Linux 7.2.9, Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.4).
  • Each PR is merged onto main b5d763770a, both merge cleanly: #7465 at bc14a64eb0, #8622 at aba29494bd. Plain main is the base.
  • Every run starts from the same shader-cache and save seed, with the same scripted inputs, 280 s per run, APS5_TRACE_SECONDS=200:30 with 2097152 events.
  • Order: main, #7465, #8622, #8622, #7465, main.
  • Every trace reports dirty false and dropped false. A 3 s sampler watched for host compilers in each trace window.
Run FPS (presents/window) frame p50 / p99 ms host imports made / refused at shutdown compilers in window
main 47.86 20.6 / 28.5 5,057 / 1,252,731 up to 7
#7465 59.94 16.7 / 16.7 133 / 59 0
#8622 56.38 17.6 / 21.5 248 / 2,575 0
#8622 55.65 17.8 / 21.2 225 / 2,580 0
#7465 59.94 16.7 / 16.7 133 / 59 up to 6
main 53.95 18.1 / 24.7 5,318 / 1,183,020 0

On main this title maps and unmaps small direct-memory ranges continuously. About 1.2 million map-time imports are attempted per run and refused, and the refusals start once early INVALID_EXTERNAL_HANDLE failures have lowered the import budget.

  • #7465 removes almost all of that work: 59 refusals. Both runs hold the title's 60 FPS cap with a flat frame time (p99 16.7 ms), including the run that had compilers in its window.
  • #8622 removes most of it (about 2,600 refusals) and gains ~3–8 FPS over the clean main run, but does not reach the cap here.

This PR helps here, and the result looks consistent with what it targets: a range mapped again at the same address and size. The ~2,600 remaining refusals suggest some of this title's ranges come back at a different size, which a size gate like #7465's also covers. This is one machine and one scene.

AI-assisted: yes (Claude Code); results above were run on this machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6328229023 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8622#issuecomment-6328229023). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T22:46:02Z. --- AMD/Linux data point on a second title, measured next to #7465 (which defers small imports by size). **Setup** - Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347), tutorial scene, Linux 7.2.9, Ryzen 9 7950X, RX 6650 XT, RADV (Mesa 26.2.4). - Each PR is merged onto `main` b5d763770a, both merge cleanly: #7465 at bc14a64eb0, #8622 at aba29494bd. Plain `main` is the base. - Every run starts from the same shader-cache and save seed, with the same scripted inputs, 280 s per run, `APS5_TRACE_SECONDS=200:30` with 2097152 events. - Order: `main`, #7465, #8622, #8622, #7465, `main`. - Every trace reports dirty false and dropped false. A 3 s sampler watched for host compilers in each trace window. | Run | FPS (presents/window) | frame p50 / p99 ms | host imports made / refused at shutdown | compilers in window | |---|---|---|---|---| | `main` | 47.86 | 20.6 / 28.5 | 5,057 / 1,252,731 | up to 7 | | #7465 | **59.94** | 16.7 / 16.7 | 133 / 59 | 0 | | #8622 | 56.38 | 17.6 / 21.5 | 248 / 2,575 | 0 | | #8622 | 55.65 | 17.8 / 21.2 | 225 / 2,580 | 0 | | #7465 | **59.94** | 16.7 / 16.7 | 133 / 59 | up to 6 | | `main` | 53.95 | 18.1 / 24.7 | 5,318 / 1,183,020 | 0 | On `main` this title maps and unmaps small direct-memory ranges continuously. About 1.2 million map-time imports are attempted per run and refused, and the refusals start once early `INVALID_EXTERNAL_HANDLE` failures have lowered the import budget. - **#7465** removes almost all of that work: 59 refusals. Both runs hold the title's 60 FPS cap with a flat frame time (p99 16.7 ms), including the run that had compilers in its window. - **#8622** removes most of it (about 2,600 refusals) and gains ~3–8 FPS over the clean `main` run, but does not reach the cap here. This PR helps here, and the result looks consistent with what it targets: a range mapped again at the same address and size. The ~2,600 remaining refusals suggest some of this title's ranges come back at a different size, which a size gate like #7465's also covers. This is one machine and one scene. AI-assisted: yes (Claude Code); results above were run on this machine.
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!8622
No description provided.