perf(agc): defer small host imports until first GPU use #7465

Merged
Dripl1x merged 4 commits from upstream-pr/7465 into main 2026-10-24 03:11:48 +00:00
Dripl1x commented 2026-10-18 08:46:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-18T08:46:52Z.


What

ImportMappedRanges in Graphics/src/GuestBufferMemory.cpp, the observer that runs when a title maps memory for the GPU, imports every such range at map time (#1961). A title that maps and unmaps small ranges over and over pays a whole host import on the mapping thread at every map, and retires it at every unmap.

This PR leaves ranges of 64 KiB or less to their first GPU use:

  • ImportMappedRanges skips a mapped range of 64 KiB or less, and takes the registry lease only when a range in the batch still needs an eager import (five changed lines).
  • The first GPU use imports such a range through the existing on-demand path (HostImportFor, counted for the access requester), as before #1961; a small range the GPU never uses is never imported. As @oneandonlydean noted above, that path is the existing fallback, so the change moves when a small range is imported, not whether it can be.
  • Ranges over 64 KiB, including the pools mapped once while loading that #1961 was written for (PPSA36082), are still imported at map time.

Where it helps

  • Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347), measured by @JJenkx (comment above; Linux 7.2.9, Ryzen 9 7950X, RX 6650 XT, RADV Mesa 26.2.4, this PR's same five lines merged onto main b5d763770a, order main, this PR, #8622, #8622, this PR, main): on main the title attempts about 1.2 million map-time imports per run and has them refused once early INVALID_EXTERNAL_HANDLE failures lower the import budget (1,252,731 and 1,183,020 refusals). With this PR, 59 refusals; the frame rate goes from 47.86 / 53.95 FPS to 59.94 / 59.94, the title's 60 FPS cap, with p99 16.7 ms in both runs. This is the PR's standalone gain. I could not reproduce it: I do not have the title.
  • SuperTuxKart (PPSA69421), menu, measured here: the menu maps about 48 blocks of 64 KiB per frame. Alone, this PR does not change its frame rate (table below): the first GPU use of each block is a label, which imports the block at that point. #7464, which depends on this PR, stores those labels on the CPU; with both, the blocks are never imported and the menu runs at 25.87 / 25.99 FPS. Probe counters of 2026-10-21 (main 2185dbf92e against main with the eleven PRs of that series, which include this one; a local counter build with APS5_PROFILE_DRAW=1, not used for FPS): ImportMappedRanges 784 µs to 0.26 µs per call and sceKernelMapDirectMemory 869 µs to 23 µs per call, about 48 calls of each per frame.
Build Commit FPS, run 1 / run 2 frame p50 ms
main 94fbb8cea8 9.91 / 10.24 99.8 / 94.3
main + this PR a1cee90f52 10.29 / 10.19 94.7 / 95.6
main + this PR + #7464 223f2469f5 25.87 / 25.99 37.7 / 37.9

Tested

Update 2026-10-24. The head is now de24508db4: current main e2b9700a98 merged into this branch, with one conflict in tests/BdaResources.cpp (importAtMapOverBudgetTests: main's ClearHostImports(context.device) from #8622 is kept together with this PR's 128 KiB range, as in #7464's merge). On that head, Windows 11 Pro 26300, RTX 3070 Laptop GPU, NVIDIA 621.01: the 133 ctest entries of the set below pass; under the validation layer (same switches as below) 133/133 pass on main e2b9700a98 and on the head, neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS, and neither reports a VUID-. Linux (WSL Ubuntu 26.04, lavapipe): agc_driver_graphics, agc_driver_host_import_at_map and the 69 entries of agc_driver_recorder_tests (63 pass, the same 6 skip as below). The SuperTuxKart captures below were not repeated on this head. The rest of this section is about the previous head.

The previous head was a1cee90f52 on main 94fbb8cea8: the change (789a5f686f), its map-time import test update (e0764b9e14), and a test fixture fix (a1cee90f52). Windows 11 Pro 26300, Ryzen 7 5800H, WinLibs GCC 15.2.0 r7, Release.

  • The fixture fix. importMappedFailureGenerationTests in tests/BdaResources.cpp, added to main by #8802 after this PR's last rebase, maps one 64 KiB range and expects ImportMappedRanges to try its import; with this PR's previous head merged into current main, agc_driver_graphics failed with "the map failure fixture did not mutate an unrelated range during allocation". The fixture now maps 128 KiB as one window, which is still imported at map time. On plain main the updated test passes, and with #8802's fix reverted it fails at "an unrelated mapping during a failed import discarded its owner failure memo", so it still checks what #8802 added.
  • NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, ANYPS5_NO_SHADER_CACHE=1, three runs each: the 74 tests built from tests/Recorder.cpp, and agc_driver_graphics, agc_driver_host_import_windows, agc_driver_host_import_at_map, agc_driver_host_import_teardown, agc_driver_indirect_arguments_pending_producer, agc_driver_unimported_label_order, agc_driver_same_queue_label_wait, agc_driver_alias_copy_label, agc_driver_pipelined_dma, guest_sleep_wake, guest_sleep_wake_coarse, guest_nanosleep, precise_wait: 87/87 on this head and on main.
  • Validation layer, the same set once on main 94fbb8cea8 and on this head (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V, RTX 3070 Laptop GPU, NVIDIA 617.42; DISABLE_LAYER=1 turns off a third-party implicit layer installed here, FPS Monitor, whose vkDestroyInstance hook crashes later instance lookups): 87/87 on both, neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS, and both report the same VUIDs the same number of times (VUID-VkImageViewCreateInfo-usage-02275 4, VUID-vkCmdCopyBuffer-srcBuffer-00118 2). The change adds none.
  • AMD Radeon(TM) Graphics (the Ryzen 7 5800H's integrated GPU, driver 31.0.21925.1001, selected with ANYPS5_GPU=AMD), the same set once and once under the validation layer: 84/87 on this head and on main. The same three tests fail on both (agc_sample_dumps, agc_driver_vertex_target_range_copied, agc_driver_vertex_target_range_imported), so they are main's; the validation logs report the same VUIDs as on NVIDIA and none new.
  • Linux (WSL Ubuntu 26.04, GCC, lavapipe llvmpipe (LLVM 21.1.8)): 71 tests of the set are registered there; 65 pass, among them agc_driver_graphics, agc_driver_host_import_windows, agc_driver_host_import_at_map and agc_driver_host_import_teardown, and 6 skip themselves with exit 77 (agc_pipeline_cache_file, agc_storage_clear_hand_over, agc_unit_shadow, agc_shadowed_key_stores, agc_driver_unit_shadow, agc_driver_unit_shadow_budget).
  • Earlier, by @savvaniss on the head 384652a52 (the same five changed lines, merged into main 07377573f): the 56 tests built from tests/Recorder.cpp and HostImportWindows.cpp pass on an Intel UHD 770 (49 pass, 7 skip without a second queue family) and an AMD RX 9070 XT; with this PR's tests on main without its change, 9 fail on both.
  • tools/check_conventions.py passes for this range.
  • Not run: the whole CTest suite, and titles other than SuperTuxKart.

SuperTuxKart captures. RTX 3070 Laptop GPU, NVIDIA 617.42, same machine and build as above; SuperTuxKart (PPSA69421) tutorial prompt over the main menu, 1920x1080 internal rendering in a maximized 2560x1369 window, warm shader caches, audio muted, no input; APS5_TRACE_SECONDS=20:8 with APS5_TRACE_EVENTS=1048576, console output not redirected, no other APS5_* switch; 2026-10-22, one session, order main, this PR, this PR + #7464 (twice; its lines are in #7464), this PR, main; every run kept the window in the foreground, and every summary line reports dirty: false and trace_dropped: false.

Summary lines (main, this PR, this PR, main)
{"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":38,"ms":8076.426},"presents":80,"frame_ms":{"p50":99.757,"p90":110.517,"p99":128.310,"max":128.310},"gpu_busy_ms_per_present":5.610,"worker_busy_pct":{"queue worker 0x0":2.846},"top_phases_ms_per_frame":{"Graphics.Draw":7.873,"Graphics.Draw.draw_and_resource_release":7.574,"Vulkan.DrawFromRecipe":6.254,"Graphics.DrawWithRecipe":6.229,"Graphics.DrawWithRecipe.draw_and_resource_release":6.216,"Recorder.Submit":2.908,"Driver.Packet":2.834,"Driver.Packet.draw":2.260},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-424.json.gz"}
{"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":55,"ms":8065.429},"presents":83,"frame_ms":{"p50":94.730,"p90":106.217,"p99":129.954,"max":129.954},"gpu_busy_ms_per_present":5.650,"worker_busy_pct":{"queue worker 0x0":2.889},"top_phases_ms_per_frame":{"Graphics.Draw":8.166,"Graphics.Draw.draw_and_resource_release":7.877,"Vulkan.DrawFromRecipe":6.616,"Graphics.DrawWithRecipe":6.589,"Graphics.DrawWithRecipe.draw_and_resource_release":6.576,"Recorder.Submit":2.785,"Driver.Packet":2.769,"Driver.Packet.draw":2.207},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-21452.json.gz"}
{"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":60,"ms":8047.206},"presents":82,"frame_ms":{"p50":95.592,"p90":109.603,"p99":121.282,"max":121.282},"gpu_busy_ms_per_present":5.638,"worker_busy_pct":{"queue worker 0x0":2.804},"top_phases_ms_per_frame":{"Graphics.Draw":8.185,"Graphics.Draw.draw_and_resource_release":7.900,"Vulkan.DrawFromRecipe":6.988,"Graphics.DrawWithRecipe":6.962,"Graphics.DrawWithRecipe.draw_and_resource_release":6.949,"Recorder.Submit":2.777,"Driver.Packet":2.710,"Driver.Packet.draw":2.157},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-30808.json.gz"}
{"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":60,"ms":8004.322},"presents":82,"frame_ms":{"p50":94.350,"p90":108.262,"p99":142.124,"max":142.124},"gpu_busy_ms_per_present":5.714,"worker_busy_pct":{"queue worker 0x0":2.913},"top_phases_ms_per_frame":{"Graphics.Draw":7.571,"Graphics.Draw.draw_and_resource_release":7.276,"Vulkan.DrawFromRecipe":6.235,"Graphics.DrawWithRecipe":6.207,"Graphics.DrawWithRecipe.draw_and_resource_release":6.194,"Recorder.Submit":2.886,"Driver.Packet":2.803,"Driver.Packet.draw":2.235},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-36604.json.gz"}
tools/performance_compare.py (first capture of main against the first capture of this PR)

**Performance comparison
**

Capture Commit Trace Presents Window (ms)
baseline 94fbb8cea8 aps5-trace-94fbb8cea80a-424.json.gz 80 8076.426
candidate a1cee90f52 aps5-trace-a1cee90f52cc-21452.json.gz 83 8065.429
  • Compare captures from the same machine, title, content version and scene; matching recorded metadata cannot verify the physical machine or scene.
  • Changes are candidate minus baseline. A negative frame-time change means a shorter frame interval.
  • A missing top phase is unreported, not zero; its change is unavailable.
  • Recorded configuration differs; these measurements do not isolate the code change.

**Configuration differences
**

Setting Baseline Candidate
window.first_present 38 55

**Frame and GPU times (ms)
**

Metric Baseline Candidate Change Change (%)
frame_ms.p50 99.757 94.730 -5.027 -5.039
frame_ms.p90 110.517 106.217 -4.300 -3.891
frame_ms.p99 128.310 129.954 +1.644 +1.281
frame_ms.max 128.310 129.954 +1.644 +1.281
mean_frame_ms 100.955 97.174 -3.781 -3.746
gpu_busy_ms_per_present 5.610 5.650 +0.040 +0.713

**Top phases (ms per frame)
**

Metric Baseline Candidate Change Change (%)
Driver.Packet 2.834 2.769 -0.065 -2.294
Driver.Packet.draw 2.260 2.207 -0.053 -2.345
Graphics.Draw 7.873 8.166 +0.293 +3.722
Graphics.Draw.draw_and_resource_release 7.574 7.877 +0.303 +4.001
Graphics.DrawWithRecipe 6.229 6.589 +0.360 +5.779
Graphics.DrawWithRecipe.draw_and_resource_release 6.216 6.576 +0.360 +5.792
Recorder.Submit 2.908 2.785 -0.123 -4.230
Vulkan.DrawFromRecipe 6.254 6.616 +0.362 +5.788
tools/trace_digest.py (first capture of main, then of this PR; every digest is in the evidence archive)

v23-s01-main

seconds 20:8 from present 38: 80 presents, frame p50 99.8 / p90 110.5 / p99 128.3 / max 128.3 ms, GPU busy 5.6 ms per present
NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 1920x1080, commit 94fbb8cea8, dropped: no

{"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":38,"ms":8076.426},"presents":80,"frame_ms":{"p50":99.757,"p90":110.517,"p99":128.31,"max":128.31},"gpu_busy_ms_per_present":5.61,"worker_busy_pct":{"queue worker 0x0":2.846},"top_phases_ms_per_frame":{"Graphics.Draw":7.873,"Graphics.Draw.draw_and_resource_release":7.574,"Vulkan.DrawFromRecipe":6.254,"Graphics.DrawWithRecipe":6.229,"Graphics.DrawWithRecipe.draw_and_resource_release":6.216,"Recorder.Submit":2.908,"Driver.Packet":2.834,"Driver.Packet.draw":2.26},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-424.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 92: 128.3 ms at 5467 ms: Driver.WorkerWait (queue worker 0x0) 124.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 124.3, Graphics.Draw (draw committer) 10.6, Graphics.Draw.draw_and_resource_release (draw committer) 10.2
  • present 85: 114.7 ms at 4705 ms: Driver.WorkerWait (queue worker 0x0) 110.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 110.7, Graphics.Draw (draw committer) 10.1, Graphics.Draw.draw_and_resource_release (draw committer) 9.7
  • present 66: 113.7 ms at 2808 ms: Driver.WorkerWait (queue worker 0x0) 109.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 109.8, Graphics.Draw (draw committer) 10.4, Graphics.Draw.draw_and_resource_release (draw committer) 10.1

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 100.9 0.4 Recorder.Sync 0.0
queue worker 0x0 2.1 (2 %) 97.8 (97 %) 1.1 3.9 Driver.Packet 2.1
draw committer 17.0 (17 %) 0.7 (1 %) 83.2 0.2 Graphics.Draw 7.9, Vulkan.DrawFromRecipe 6.3
presenter 1.0 (1 %) 0.0 (0 %) 99.9 0.1 VideoOut.Flip 1.0, Driver.Present 0.0
gpu 5.6 (6 %) 0.0 (0 %) 95.3 0.0 batch 5.6

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 97.8, Driver.WorkerWait.idle_and_completion_poll 97.7, Graphics.Draw 7.9, Graphics.Draw.draw_and_resource_release 7.6, Vulkan.DrawFromRecipe 6.3, Graphics.DrawWithRecipe 6.2

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 15.7 ms at 5475 ms, present 92
  • Driver.WorkerWait (queue worker 0x0) 11.2 ms at 5868 ms, present 95
  • Driver.WorkerWait (queue worker 0x0) 9.6 ms at 1680 ms, present 54
  • Driver.WorkerWait (queue worker 0x0) 9.2 ms at 923 ms, present 47
  • Driver.WorkerWait (queue worker 0x0) 9.1 ms at 3076 ms, present 68
  • Driver.WorkerWait (queue worker 0x0) 8.9 ms at 6084 ms, present 97

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

  • batch 4705: 1.7 ms at 8049 ms, present 117: 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.0
  • batch 3643: 1.7 ms at 6272 ms, present 99: 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 1283: 1.7 ms at 2183 ms, present 59: 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.0

v23-s02-7465

seconds 20:8 from present 55: 83 presents, frame p50 94.7 / p90 106.2 / p99 130.0 / max 130.0 ms, GPU busy 5.7 ms per present
NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 1920x1080, commit a1cee90f52, dropped: no

{"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":55,"ms":8065.429},"presents":83,"frame_ms":{"p50":94.73,"p90":106.217,"p99":129.954,"max":129.954},"gpu_busy_ms_per_present":5.65,"worker_busy_pct":{"queue worker 0x0":2.889},"top_phases_ms_per_frame":{"Graphics.Draw":8.166,"Graphics.Draw.draw_and_resource_release":7.877,"Vulkan.DrawFromRecipe":6.616,"Graphics.DrawWithRecipe":6.589,"Graphics.DrawWithRecipe.draw_and_resource_release":6.576,"Recorder.Submit":2.785,"Driver.Packet":2.769,"Driver.Packet.draw":2.207},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-21452.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 128: 130.0 ms at 7006 ms: Driver.WorkerWait (queue worker 0x0) 125.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 125.0, Graphics.Draw (draw committer) 13.4, Graphics.Draw.draw_and_resource_release (draw committer) 13.0
  • present 127: 124.1 ms at 6882 ms: Driver.WorkerWait (queue worker 0x0) 119.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 119.3, Graphics.Draw (draw committer) 12.5, Graphics.Draw.draw_and_resource_release (draw committer) 12.1
  • present 129: 122.4 ms at 7136 ms: Driver.WorkerWait (queue worker 0x0) 117.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 117.7, Graphics.Draw (draw committer) 12.4, Graphics.Draw.draw_and_resource_release (draw committer) 12.0

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.2 (0 %) 0.0 (0 %) 97.0 0.4 Recorder.Sync 0.2
queue worker 0x0 2.0 (2 %) 94.0 (97 %) 1.1 4.0 Driver.Packet 2.0
draw committer 17.6 (18 %) 0.6 (1 %) 79.0 0.2 Graphics.Draw 8.2, Vulkan.DrawFromRecipe 6.6
presenter 0.9 (1 %) 0.0 (0 %) 96.2 0.1 VideoOut.Flip 0.9, Driver.Present 0.0
gpu 5.7 (6 %) 0.0 (0 %) 91.5 0.0 batch 5.7

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 94.0, Driver.WorkerWait.idle_and_completion_poll 94.0, Graphics.Draw 8.2, Graphics.Draw.draw_and_resource_release 7.9, Vulkan.DrawFromRecipe 6.6, Graphics.DrawWithRecipe 6.6

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 18.2 ms at 7659 ms, present 133
  • Driver.WorkerWait (queue worker 0x0) 8.3 ms at 1529 ms, present 70
  • Driver.WorkerWait (queue worker 0x0) 6.3 ms at 5616 ms, present 114
  • Driver.WorkerWait (queue worker 0x0) 6.1 ms at 5047 ms, present 108
  • Driver.WorkerWait (queue worker 0x0) 5.7 ms at 7120 ms, present 128
  • Driver.WorkerWait (queue worker 0x0) 5.7 ms at 989 ms, present 65

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

  • batch 1637: 2.5 ms at 2655 ms, present 82: 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 4174: 1.7 ms at 6737 ms, present 125: 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 1991: 1.7 ms at 3218 ms, present 88: 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

Evidence: 7465-evidence-20261022.zip (traces, summary lines, digests and comparisons, test and validation-layer logs).

Known limitations

  • The import of a small range now happens at its first GPU use, on the thread that records that use, instead of on the mapping thread. In a title whose first use is a queue-0 label (SuperTuxKart), the cost moves to that label; #7464 handles that case.
  • A title that maps a small range once and uses it every frame pays the same single import as before, only later.

Dependencies and overlap

  • Depends on: none. #7464 depends on this PR.
  • #8622 (@LeandroLP23) targets the same map-time imports with another rule: it skips the map-time import of a range mapped again at the same address and size while no import of it is left. They are different rules and can coexist: with both, ranges of 64 KiB or less are left to first use here, and larger ranges mapped again by #8622. @JJenkx compared them on Lodoss (above): this PR 59.94 / 59.94 FPS with 59 refusals, #8622 56.38 / 55.65 with about 2,580. They conflict in tests/BdaResources.cpp only (map-time import expectations). #8622 is in main since 2026-10-23, and the merge of main into this branch runs both rules together.
  • #9011 (@JJenkx) changes how ImportMappedRanges leases the registry, at the lines this PR changes; they conflict textually in GuestBufferMemory.cpp, and either order needs a small rebase. Neither depends on the other.
  • No other open PR defers small map-time imports.

Checklist

  • Based on current main (e2b9700a98 merged in); no other open PR implements the same functions (#9011 above; #8622 is in main now)
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 11 Pro 26300; AMD Radeon(TM) Graphics (Ryzen 7 5800H), 31.0.21925.1001, Windows 11 Pro 26300; lavapipe (llvmpipe, LLVM 21.1.8) on Linux
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4907699786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465). Originally posted by [Dripl1x](https://github.com/Dripl1x) on 2026-10-18T08:46:52Z. --- ### What `ImportMappedRanges` in `Graphics/src/GuestBufferMemory.cpp`, the observer that runs when a title maps memory for the GPU, imports every such range at map time (#1961). A title that maps and unmaps small ranges over and over pays a whole host import on the mapping thread at every map, and retires it at every unmap. This PR leaves ranges of 64 KiB or less to their first GPU use: - `ImportMappedRanges` skips a mapped range of 64 KiB or less, and takes the registry lease only when a range in the batch still needs an eager import (five changed lines). - The first GPU use imports such a range through the existing on-demand path (`HostImportFor`, counted for the `access` requester), as before #1961; a small range the GPU never uses is never imported. As @oneandonlydean noted above, that path is the existing fallback, so the change moves when a small range is imported, not whether it can be. - Ranges over 64 KiB, including the pools mapped once while loading that #1961 was written for (PPSA36082), are still imported at map time. ### Where it helps - **Record of Lodoss War -Deedlit in Wonder Labyrinth- (PPSA05347)**, measured by @JJenkx (comment above; Linux 7.2.9, Ryzen 9 7950X, RX 6650 XT, RADV Mesa 26.2.4, this PR's same five lines merged onto `main` `b5d763770a`, order `main`, this PR, #8622, #8622, this PR, `main`): on `main` the title attempts about 1.2 million map-time imports per run and has them refused once early `INVALID_EXTERNAL_HANDLE` failures lower the import budget (1,252,731 and 1,183,020 refusals). With this PR, 59 refusals; the frame rate goes from 47.86 / 53.95 FPS to 59.94 / 59.94, the title's 60 FPS cap, with p99 16.7 ms in both runs. This is the PR's standalone gain. I could not reproduce it: I do not have the title. - **SuperTuxKart (PPSA69421)**, menu, measured here: the menu maps about 48 blocks of 64 KiB per frame. Alone, this PR does not change its frame rate (table below): the first GPU use of each block is a label, which imports the block at that point. #7464, which depends on this PR, stores those labels on the CPU; with both, the blocks are never imported and the menu runs at 25.87 / 25.99 FPS. Probe counters of 2026-10-21 (`main` `2185dbf92e` against `main` with the eleven PRs of that series, which include this one; a local counter build with `APS5_PROFILE_DRAW=1`, not used for FPS): `ImportMappedRanges` 784 µs to 0.26 µs per call and `sceKernelMapDirectMemory` 869 µs to 23 µs per call, about 48 calls of each per frame. | Build | Commit | FPS, run 1 / run 2 | frame p50 ms | |---|---|---:|---:| | `main` | `94fbb8cea8` | 9.91 / 10.24 | 99.8 / 94.3 | | `main` + this PR | `a1cee90f52` | 10.29 / 10.19 | 94.7 / 95.6 | | `main` + this PR + #7464 | `223f2469f5` | 25.87 / 25.99 | 37.7 / 37.9 | ### Tested **Update 2026-10-24.** The head is now `de24508db4`: current `main` `e2b9700a98` merged into this branch, with one conflict in `tests/BdaResources.cpp` (`importAtMapOverBudgetTests`: `main`'s `ClearHostImports(context.device)` from #8622 is kept together with this PR's 128 KiB range, as in #7464's merge). On that head, Windows 11 Pro 26300, RTX 3070 Laptop GPU, NVIDIA 621.01: the 133 ctest entries of the set below pass; under the validation layer (same switches as below) 133/133 pass on `main` `e2b9700a98` and on the head, neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither reports a `VUID-`. Linux (WSL Ubuntu 26.04, lavapipe): `agc_driver_graphics`, `agc_driver_host_import_at_map` and the 69 entries of `agc_driver_recorder_tests` (63 pass, the same 6 skip as below). The SuperTuxKart captures below were not repeated on this head. The rest of this section is about the previous head. The previous head was `a1cee90f52` on `main` `94fbb8cea8`: the change (`789a5f686f`), its map-time import test update (`e0764b9e14`), and a test fixture fix (`a1cee90f52`). Windows 11 Pro 26300, Ryzen 7 5800H, WinLibs GCC 15.2.0 r7, Release. - **The fixture fix.** `importMappedFailureGenerationTests` in `tests/BdaResources.cpp`, added to `main` by #8802 after this PR's last rebase, maps one 64 KiB range and expects `ImportMappedRanges` to try its import; with this PR's previous head merged into current `main`, `agc_driver_graphics` failed with "the map failure fixture did not mutate an unrelated range during allocation". The fixture now maps 128 KiB as one window, which is still imported at map time. On plain `main` the updated test passes, and with #8802's fix reverted it fails at "an unrelated mapping during a failed import discarded its owner failure memo", so it still checks what #8802 added. - **NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42**, `ANYPS5_NO_SHADER_CACHE=1`, three runs each: the 74 tests built from `tests/Recorder.cpp`, and `agc_driver_graphics`, `agc_driver_host_import_windows`, `agc_driver_host_import_at_map`, `agc_driver_host_import_teardown`, `agc_driver_indirect_arguments_pending_producer`, `agc_driver_unimported_label_order`, `agc_driver_same_queue_label_wait`, `agc_driver_alias_copy_label`, `agc_driver_pipelined_dma`, `guest_sleep_wake`, `guest_sleep_wake_coarse`, `guest_nanosleep`, `precise_wait`: 87/87 on this head and on `main`. - **Validation layer**, the same set once on `main` `94fbb8cea8` and on this head (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`, RTX 3070 Laptop GPU, NVIDIA 617.42; `DISABLE_LAYER=1` turns off a third-party implicit layer installed here, FPS Monitor, whose `vkDestroyInstance` hook crashes later instance lookups): 87/87 on both, neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`, and both report the same VUIDs the same number of times (`VUID-VkImageViewCreateInfo-usage-02275` 4, `VUID-vkCmdCopyBuffer-srcBuffer-00118` 2). The change adds none. - **AMD Radeon(TM) Graphics** (the Ryzen 7 5800H's integrated GPU, driver 31.0.21925.1001, selected with `ANYPS5_GPU=AMD`), the same set once and once under the validation layer: 84/87 on this head and on `main`. The same three tests fail on both (`agc_sample_dumps`, `agc_driver_vertex_target_range_copied`, `agc_driver_vertex_target_range_imported`), so they are `main`'s; the validation logs report the same VUIDs as on NVIDIA and none new. - **Linux** (WSL Ubuntu 26.04, GCC, lavapipe `llvmpipe (LLVM 21.1.8)`): 71 tests of the set are registered there; 65 pass, among them `agc_driver_graphics`, `agc_driver_host_import_windows`, `agc_driver_host_import_at_map` and `agc_driver_host_import_teardown`, and 6 skip themselves with exit 77 (`agc_pipeline_cache_file`, `agc_storage_clear_hand_over`, `agc_unit_shadow`, `agc_shadowed_key_stores`, `agc_driver_unit_shadow`, `agc_driver_unit_shadow_budget`). - Earlier, by @savvaniss on the head `384652a52` (the same five changed lines, merged into `main` `07377573f`): the 56 tests built from `tests/Recorder.cpp` and `HostImportWindows.cpp` pass on an Intel UHD 770 (49 pass, 7 skip without a second queue family) and an AMD RX 9070 XT; with this PR's tests on `main` without its change, 9 fail on both. - `tools/check_conventions.py` passes for this range. - Not run: the whole CTest suite, and titles other than SuperTuxKart. **SuperTuxKart captures.** RTX 3070 Laptop GPU, NVIDIA 617.42, same machine and build as above; SuperTuxKart (PPSA69421) tutorial prompt over the main menu, 1920x1080 internal rendering in a maximized 2560x1369 window, warm shader caches, audio muted, no input; `APS5_TRACE_SECONDS=20:8` with `APS5_TRACE_EVENTS=1048576`, console output not redirected, no other `APS5_*` switch; 2026-10-22, one session, order `main`, this PR, this PR + #7464 (twice; its lines are in #7464), this PR, `main`; every run kept the window in the foreground, and every summary line reports `dirty: false` and `trace_dropped: false`. <details> <summary>Summary lines (main, this PR, this PR, main)</summary> ```json {"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":38,"ms":8076.426},"presents":80,"frame_ms":{"p50":99.757,"p90":110.517,"p99":128.310,"max":128.310},"gpu_busy_ms_per_present":5.610,"worker_busy_pct":{"queue worker 0x0":2.846},"top_phases_ms_per_frame":{"Graphics.Draw":7.873,"Graphics.Draw.draw_and_resource_release":7.574,"Vulkan.DrawFromRecipe":6.254,"Graphics.DrawWithRecipe":6.229,"Graphics.DrawWithRecipe.draw_and_resource_release":6.216,"Recorder.Submit":2.908,"Driver.Packet":2.834,"Driver.Packet.draw":2.260},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-424.json.gz"} {"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":55,"ms":8065.429},"presents":83,"frame_ms":{"p50":94.730,"p90":106.217,"p99":129.954,"max":129.954},"gpu_busy_ms_per_present":5.650,"worker_busy_pct":{"queue worker 0x0":2.889},"top_phases_ms_per_frame":{"Graphics.Draw":8.166,"Graphics.Draw.draw_and_resource_release":7.877,"Vulkan.DrawFromRecipe":6.616,"Graphics.DrawWithRecipe":6.589,"Graphics.DrawWithRecipe.draw_and_resource_release":6.576,"Recorder.Submit":2.785,"Driver.Packet":2.769,"Driver.Packet.draw":2.207},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-21452.json.gz"} {"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":60,"ms":8047.206},"presents":82,"frame_ms":{"p50":95.592,"p90":109.603,"p99":121.282,"max":121.282},"gpu_busy_ms_per_present":5.638,"worker_busy_pct":{"queue worker 0x0":2.804},"top_phases_ms_per_frame":{"Graphics.Draw":8.185,"Graphics.Draw.draw_and_resource_release":7.900,"Vulkan.DrawFromRecipe":6.988,"Graphics.DrawWithRecipe":6.962,"Graphics.DrawWithRecipe.draw_and_resource_release":6.949,"Recorder.Submit":2.777,"Driver.Packet":2.710,"Driver.Packet.draw":2.157},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-30808.json.gz"} {"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":60,"ms":8004.322},"presents":82,"frame_ms":{"p50":94.350,"p90":108.262,"p99":142.124,"max":142.124},"gpu_busy_ms_per_present":5.714,"worker_busy_pct":{"queue worker 0x0":2.913},"top_phases_ms_per_frame":{"Graphics.Draw":7.571,"Graphics.Draw.draw_and_resource_release":7.276,"Vulkan.DrawFromRecipe":6.235,"Graphics.DrawWithRecipe":6.207,"Graphics.DrawWithRecipe.draw_and_resource_release":6.194,"Recorder.Submit":2.886,"Driver.Packet":2.803,"Driver.Packet.draw":2.235},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-36604.json.gz"} ``` </details> <details> <summary><code>tools/performance_compare.py</code> (first capture of <code>main</code> against the first capture of this PR)</summary> **Performance comparison ** | Capture | Commit | Trace | Presents | Window (ms) | | --- | --- | --- | ---: | ---: | | baseline | 94fbb8cea80a | aps5-trace-94fbb8cea80a-424.json.gz | 80 | 8076.426 | | candidate | a1cee90f52cc | aps5-trace-a1cee90f52cc-21452.json.gz | 83 | 8065.429 | - Compare captures from the same machine, title, content version and scene; matching recorded metadata cannot verify the physical machine or scene. - Changes are candidate minus baseline. A negative frame-time change means a shorter frame interval. - A missing top phase is unreported, not zero; its change is unavailable. - Recorded configuration differs; these measurements do not isolate the code change. **Configuration differences ** | Setting | Baseline | Candidate | | --- | --- | --- | | window.first_present | 38 | 55 | **Frame and GPU times (ms) ** | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | frame_ms.p50 | 99.757 | 94.730 | -5.027 | -5.039 | | frame_ms.p90 | 110.517 | 106.217 | -4.300 | -3.891 | | frame_ms.p99 | 128.310 | 129.954 | +1.644 | +1.281 | | frame_ms.max | 128.310 | 129.954 | +1.644 | +1.281 | | mean_frame_ms | 100.955 | 97.174 | -3.781 | -3.746 | | gpu_busy_ms_per_present | 5.610 | 5.650 | +0.040 | +0.713 | **Top phases (ms per frame) ** | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | Driver.Packet | 2.834 | 2.769 | -0.065 | -2.294 | | Driver.Packet.draw | 2.260 | 2.207 | -0.053 | -2.345 | | Graphics.Draw | 7.873 | 8.166 | +0.293 | +3.722 | | Graphics.Draw.draw_and_resource_release | 7.574 | 7.877 | +0.303 | +4.001 | | Graphics.DrawWithRecipe | 6.229 | 6.589 | +0.360 | +5.779 | | Graphics.DrawWithRecipe.draw_and_resource_release | 6.216 | 6.576 | +0.360 | +5.792 | | Recorder.Submit | 2.908 | 2.785 | -0.123 | -4.230 | | Vulkan.DrawFromRecipe | 6.254 | 6.616 | +0.362 | +5.788 | </details> <details> <summary><code>tools/trace_digest.py</code> (first capture of <code>main</code>, then of this PR; every digest is in the evidence archive)</summary> `v23-s01-main` **seconds 20:8** from present 38: 80 presents, frame p50 99.8 / p90 110.5 / p99 128.3 / max 128.3 ms, GPU busy 5.6 ms per present NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 1920x1080, commit 94fbb8cea80a, dropped: no ```json {"commit":"94fbb8cea80a","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":38,"ms":8076.426},"presents":80,"frame_ms":{"p50":99.757,"p90":110.517,"p99":128.31,"max":128.31},"gpu_busy_ms_per_present":5.61,"worker_busy_pct":{"queue worker 0x0":2.846},"top_phases_ms_per_frame":{"Graphics.Draw":7.873,"Graphics.Draw.draw_and_resource_release":7.574,"Vulkan.DrawFromRecipe":6.254,"Graphics.DrawWithRecipe":6.229,"Graphics.DrawWithRecipe.draw_and_resource_release":6.216,"Recorder.Submit":2.908,"Driver.Packet":2.834,"Driver.Packet.draw":2.26},"trace_dropped":false,"trace":"aps5-trace-94fbb8cea80a-424.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 92: 128.3 ms at 5467 ms: Driver.WorkerWait (queue worker 0x0) 124.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 124.3, Graphics.Draw (draw committer) 10.6, Graphics.Draw.draw_and_resource_release (draw committer) 10.2 - present 85: 114.7 ms at 4705 ms: Driver.WorkerWait (queue worker 0x0) 110.8, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 110.7, Graphics.Draw (draw committer) 10.1, Graphics.Draw.draw_and_resource_release (draw committer) 9.7 - present 66: 113.7 ms at 2808 ms: Driver.WorkerWait (queue worker 0x0) 109.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 109.8, Graphics.Draw (draw committer) 10.4, Graphics.Draw.draw_and_resource_release (draw committer) 10.1 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 100.9 | 0.4 | Recorder.Sync 0.0 | | queue worker 0x0 | 2.1 (2 %) | 97.8 (97 %) | 1.1 | 3.9 | Driver.Packet 2.1 | | draw committer | 17.0 (17 %) | 0.7 (1 %) | 83.2 | 0.2 | Graphics.Draw 7.9, Vulkan.DrawFromRecipe 6.3 | | presenter | 1.0 (1 %) | 0.0 (0 %) | 99.9 | 0.1 | VideoOut.Flip 1.0, Driver.Present 0.0 | | gpu | 5.6 (6 %) | 0.0 (0 %) | 95.3 | 0.0 | batch 5.6 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 97.8, Driver.WorkerWait.idle_and_completion_poll 97.7, Graphics.Draw 7.9, Graphics.Draw.draw_and_resource_release 7.6, Vulkan.DrawFromRecipe 6.3, Graphics.DrawWithRecipe 6.2 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 15.7 ms at 5475 ms, present 92 - Driver.WorkerWait (queue worker 0x0) 11.2 ms at 5868 ms, present 95 - Driver.WorkerWait (queue worker 0x0) 9.6 ms at 1680 ms, present 54 - Driver.WorkerWait (queue worker 0x0) 9.2 ms at 923 ms, present 47 - Driver.WorkerWait (queue worker 0x0) 9.1 ms at 3076 ms, present 68 - Driver.WorkerWait (queue worker 0x0) 8.9 ms at 6084 ms, present 97 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 4705: 1.7 ms at 8049 ms, present 117: 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.0 - batch 3643: 1.7 ms at 6272 ms, present 99: 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 1283: 1.7 ms at 2183 ms, present 59: 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.0 `v23-s02-7465` **seconds 20:8** from present 55: 83 presents, frame p50 94.7 / p90 106.2 / p99 130.0 / max 130.0 ms, GPU busy 5.7 ms per present NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 1920x1080, commit a1cee90f52cc, dropped: no ```json {"commit":"a1cee90f52cc","dirty":false,"env":{"APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"20:8"},"gpu":"NVIDIA GeForce RTX 3070 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"AMD Ryzen 7 5800H with Radeon Graphics","cpu_threads":16,"memory_mib":64863,"title_id":"PPSA69421","title":"SuperTuxKart","content_version":"00.001.000","resolution":"1920x1080","window":{"spec":"seconds 20:8","first_present":55,"ms":8065.429},"presents":83,"frame_ms":{"p50":94.73,"p90":106.217,"p99":129.954,"max":129.954},"gpu_busy_ms_per_present":5.65,"worker_busy_pct":{"queue worker 0x0":2.889},"top_phases_ms_per_frame":{"Graphics.Draw":8.166,"Graphics.Draw.draw_and_resource_release":7.877,"Vulkan.DrawFromRecipe":6.616,"Graphics.DrawWithRecipe":6.589,"Graphics.DrawWithRecipe.draw_and_resource_release":6.576,"Recorder.Submit":2.785,"Driver.Packet":2.769,"Driver.Packet.draw":2.207},"trace_dropped":false,"trace":"aps5-trace-a1cee90f52cc-21452.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 128: 130.0 ms at 7006 ms: Driver.WorkerWait (queue worker 0x0) 125.1, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 125.0, Graphics.Draw (draw committer) 13.4, Graphics.Draw.draw_and_resource_release (draw committer) 13.0 - present 127: 124.1 ms at 6882 ms: Driver.WorkerWait (queue worker 0x0) 119.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 119.3, Graphics.Draw (draw committer) 12.5, Graphics.Draw.draw_and_resource_release (draw committer) 12.1 - present 129: 122.4 ms at 7136 ms: Driver.WorkerWait (queue worker 0x0) 117.9, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 117.7, Graphics.Draw (draw committer) 12.4, Graphics.Draw.draw_and_resource_release (draw committer) 12.0 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.2 (0 %) | 0.0 (0 %) | 97.0 | 0.4 | Recorder.Sync 0.2 | | queue worker 0x0 | 2.0 (2 %) | 94.0 (97 %) | 1.1 | 4.0 | Driver.Packet 2.0 | | draw committer | 17.6 (18 %) | 0.6 (1 %) | 79.0 | 0.2 | Graphics.Draw 8.2, Vulkan.DrawFromRecipe 6.6 | | presenter | 0.9 (1 %) | 0.0 (0 %) | 96.2 | 0.1 | VideoOut.Flip 0.9, Driver.Present 0.0 | | gpu | 5.7 (6 %) | 0.0 (0 %) | 91.5 | 0.0 | batch 5.7 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 94.0, Driver.WorkerWait.idle_and_completion_poll 94.0, Graphics.Draw 8.2, Graphics.Draw.draw_and_resource_release 7.9, Vulkan.DrawFromRecipe 6.6, Graphics.DrawWithRecipe 6.6 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 18.2 ms at 7659 ms, present 133 - Driver.WorkerWait (queue worker 0x0) 8.3 ms at 1529 ms, present 70 - Driver.WorkerWait (queue worker 0x0) 6.3 ms at 5616 ms, present 114 - Driver.WorkerWait (queue worker 0x0) 6.1 ms at 5047 ms, present 108 - Driver.WorkerWait (queue worker 0x0) 5.7 ms at 7120 ms, present 128 - Driver.WorkerWait (queue worker 0x0) 5.7 ms at 989 ms, present 65 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 1637: 2.5 ms at 2655 ms, present 82: 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 4174: 1.7 ms at 6737 ms, present 125: 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 1991: 1.7 ms at 3218 ms, present 88: 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> Evidence: [7465-evidence-20261022.zip](https://github.com/Dripl1x/AnyPS5/releases/download/review-20261022-7465/7465-evidence-20261022.zip) (traces, summary lines, digests and comparisons, test and validation-layer logs). ### Known limitations - The import of a small range now happens at its first GPU use, on the thread that records that use, instead of on the mapping thread. In a title whose first use is a queue-0 label (SuperTuxKart), the cost moves to that label; #7464 handles that case. - A title that maps a small range once and uses it every frame pays the same single import as before, only later. ### Dependencies and overlap - **Depends on: none.** #7464 depends on this PR. - **#8622** (@LeandroLP23) targets the same map-time imports with another rule: it skips the map-time import of a range mapped again at the same address and size while no import of it is left. They are different rules and can coexist: with both, ranges of 64 KiB or less are left to first use here, and larger ranges mapped again by #8622. @JJenkx compared them on Lodoss (above): this PR 59.94 / 59.94 FPS with 59 refusals, #8622 56.38 / 55.65 with about 2,580. They conflict in `tests/BdaResources.cpp` only (map-time import expectations). #8622 is in `main` since 2026-10-23, and the merge of `main` into this branch runs both rules together. - **#9011** (@JJenkx) changes how `ImportMappedRanges` leases the registry, at the lines this PR changes; they conflict textually in `GuestBufferMemory.cpp`, and either order needs a small rebase. Neither depends on the other. - No other open PR defers small map-time imports. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main` (`e2b9700a98` merged in); no other open PR implements the same functions (#9011 above; #8622 is in `main` now) - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 11 Pro 26300; AMD Radeon(TM) Graphics (Ryzen 7 5800H), 31.0.21925.1001, Windows 11 Pro 26300; lavapipe (llvmpipe, LLVM 21.1.8) on Linux - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
oneandonlydean commented 2026-10-19 04:52:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T04:52:47Z.


@Dripl1x thanks, this looks correct: first-use import is the existing fallback, so deferring only drops an optimisation. The +9% rests on one capture, though. Could you repeat it interleaved (main, PR, PR, main) in the same scene, or post the count of imports avoided? Also, together with #7464, a small GPU-mapped label page would never be imported, so every label to it would wait for all recorded GPU work. We'll measure the two together if both go in.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259945068 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6259945068). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-19T04:52:47Z. --- @Dripl1x thanks, this looks correct: first-use import is the existing fallback, so deferring only drops an optimisation. The +9% rests on one capture, though. Could you repeat it interleaved (main, PR, PR, main) in the same scene, or post the count of imports avoided? Also, together with #7464, a small GPU-mapped label page would never be imported, so every label to it would wait for all recorded GPU work. We'll measure the two together if both go in.
savvaniss commented 2026-10-19 06:35:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T06:35:57Z.


Intel and AMD Windows data: with this PR the 56 tests built from tests/Recorder.cpp and HostImportWindows.cpp pass on an Intel UHD 770 and an AMD RX 9070 XT. Without it, agc_driver_host_import_windows and 8 import-settle and host-import tests fail on both.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head 384652a52 merged into main 07377573f. "Without" means this PR's test files on main 07377573f, with none of its other changes.

Tests, ×3 UHD 770 RX 9070 XT
This head: 56 tests 49 pass, 7 import-watch and import-settle tests skip (no other queue family to settle imports on) 56 of 56 pass
Without 9 fail: agc_driver_host_import_windows (mapping did not defer exactly the small import), and with (9) a scan under a pending write was kept the 6 import-settle tests, agc_driver_host_import_lifetime and agc_driver_host_import_mutation_race 9 fail: agc_driver_host_import_windows (same message), and with a signaled batch's read still refuses (... write is not settled for settle_deferred) the same 8

This is a correctness check only; I measured no speed.

I also ran full CTest with this PR and the 13 other open AGC and shader PRs I tested in the same batch merged together (#7668, #7659, #7504, #7432, #7426, #7413, #7480, #7466, #7464, #7449, #7489, #7673, #7560). Neither GPU showed a failure beyond main's own: the five image-table tests (#6647) and agc_driver_sample_multisample_target (#6957) on the UHD 770, and agc_driver_layered_volume_vertex_no_gpl (#4768) on the RX 9070 XT.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6261244743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6261244743). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T06:35:57Z. --- Intel and AMD Windows data: with this PR the 56 tests built from `tests/Recorder.cpp` and `HostImportWindows.cpp` pass on an Intel UHD 770 and an AMD RX 9070 XT. Without it, `agc_driver_host_import_windows` and 8 import-settle and host-import tests fail on both. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. This head `384652a52` merged into `main` `07377573f`. "Without" means this PR's test files on `main` `07377573f`, with none of its other changes. | Tests, ×3 | UHD 770 | RX 9070 XT | |---|---|---| | This head: 56 tests | 49 pass, 7 import-watch and import-settle tests skip (no other queue family to settle imports on) | 56 of 56 pass | | Without | 9 fail: `agc_driver_host_import_windows` (`mapping did not defer exactly the small import`), and with `(9) a scan under a pending write was kept` the 6 import-settle tests, `agc_driver_host_import_lifetime` and `agc_driver_host_import_mutation_race` | 9 fail: `agc_driver_host_import_windows` (same message), and with `a signaled batch's read still refuses` (`... write is not settled` for `settle_deferred`) the same 8 | This is a correctness check only; I measured no speed. I also ran full CTest with this PR and the 13 other open AGC and shader PRs I tested in the same batch merged together (#7668, #7659, #7504, #7432, #7426, #7413, #7480, #7466, #7464, #7449, #7489, #7673, #7560). Neither GPU showed a failure beyond `main`'s own: the five image-table tests (#6647) and `agc_driver_sample_multisample_target` (#6957) on the UHD 770, and `agc_driver_layered_volume_vertex_no_gpl` (#4768) on the RX 9070 XT. AI-assisted: yes (Claude Code)
Dripl1x commented 2026-10-20 23:34:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-20T23:34:12Z.


@oneandonlydean, thanks. Measured together with #7464 on main 2185dbf92e, interleaved, with counters for the imports:

  • Together the two remove every per-frame host import in SuperTuxKart's menu: about 48.5 imports per frame become 0, and the frame rate goes from 9.18 / 9.03 to 20.85 / 22.02 FPS (the whole series 29.01 / 28.70).
  • The case you described is exactly what happens: the small label pages are never imported, and each label in them waits for the recorded GPU work instead, about 59 recorder syncs per frame at about 194 µs each. In this scene that wait is far cheaper than the imports it replaces.
  • This PR alone already makes mapping cheap (sceKernelMapDirectMemory 869 -> 23 µs per call), but in this title the first label then imports the block, so alone the frame rate stays at main's level (8.66 / 8.91 FPS). The earlier single capture came from a dirty build and is replaced by these runs.

Counters, summary lines of both configurations, traces and the probe patch are linked in the description.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304197801 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6304197801). Originally posted by [Dripl1x](https://github.com/Dripl1x) on 2026-10-20T23:34:12Z. --- @oneandonlydean, thanks. Measured together with #7464 on main `2185dbf92e`, interleaved, with counters for the imports: - Together the two remove every per-frame host import in SuperTuxKart's menu: about 48.5 imports per frame become 0, and the frame rate goes from 9.18 / 9.03 to 20.85 / 22.02 FPS (the whole series 29.01 / 28.70). - The case you described is exactly what happens: the small label pages are never imported, and each label in them waits for the recorded GPU work instead, about 59 recorder syncs per frame at about 194 µs each. In this scene that wait is far cheaper than the imports it replaces. - This PR alone already makes mapping cheap (`sceKernelMapDirectMemory` 869 -> 23 µs per call), but in this title the first label then imports the block, so alone the frame rate stays at main's level (8.66 / 8.91 FPS). The earlier single capture came from a dirty build and is replaced by these runs. Counters, summary lines of both configurations, traces and the probe patch are linked in the description. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-21 02:03:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T02:03:06Z.


@Dripl1x two things since the last CI run on 384652a525.

  1. agc_driver_graphics now fails on Linux and Windows (and agc_driver_graphics_maps_fallback on Linux) with "a range imported at map time was not counted for the map requester". That check is in a test main gained after this branch's base (tests/BdaResources.cpp, the import-requester test from 5f532117d3). It maps a 64 KiB piece and expects ImportMappedRanges to import it and count it as ImportRequester::Map, and this PR now defers ranges of <= 0x10000. You made the same adjustment in Recorder.cpp (UnitBytes to 2 × 64 KiB). Could you do the same there? Better still, assert the new behaviour: a range of 64 KiB or less isn't imported at map time, and is imported, under its real requester, at first GPU use. The other direct ImportMappedRanges calls in that file are worth checking for the same size.

  2. #7473 has merged, and the branch now conflicts with main in tests/execution/HostImportWindows.cpp. #7473 also wraps import validation in HostImportAccess (Windows resident runs can be read-only between collections). When you rebase, please make sure the deferred import at first GPU use goes through that same path, so it validates inside the bracket.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6306178507 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6306178507). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T02:03:06Z. --- @Dripl1x two things since the last CI run on `384652a525`. 1. `agc_driver_graphics` now fails on Linux and Windows (and `agc_driver_graphics_maps_fallback` on Linux) with "a range imported at map time was not counted for the map requester". That check is in a test `main` gained after this branch's base (`tests/BdaResources.cpp`, the import-requester test from 5f532117d3). It maps a 64 KiB piece and expects `ImportMappedRanges` to import it and count it as `ImportRequester::Map`, and this PR now defers ranges of `<= 0x10000`. You made the same adjustment in `Recorder.cpp` (`UnitBytes` to 2 × 64 KiB). Could you do the same there? Better still, assert the new behaviour: a range of 64 KiB or less isn't imported at map time, and is imported, under its real requester, at first GPU use. The other direct `ImportMappedRanges` calls in that file are worth checking for the same size. 2. #7473 has merged, and the branch now conflicts with `main` in `tests/execution/HostImportWindows.cpp`. #7473 also wraps import validation in `HostImportAccess` (Windows resident runs can be read-only between collections). When you rebase, please make sure the deferred import at first GPU use goes through that same path, so it validates inside the bracket.
Dripl1x commented 2026-10-21 02:29:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-21T02:29:42Z.


@oneandonlydean thanks, both are done in f752bb6a17, rebased onto main 6696def6e6. The source change is the same hunk as before; only tests changed.

  1. Map-time import tests. importRequesterTests now counts the map requester on a 128 KiB range (two 64 KiB pieces). It also asserts the new behaviour on a 64 KiB range: ImportMappedRanges leaves it unimported and the map count unchanged, and the first HostImportFor imports it, counted for access, with the map count still unchanged. Of the other direct ImportMappedRanges calls, importAtMapOverBudgetTests also mapped 64 KiB, so with this PR it passed without ever reaching the budget check; it now maps 128 KiB. The stale-probe fixture maps 3 × 64 KiB and is unaffected. importBlockMapTests maps 64 KiB pieces one by one and checks for one 4 MiB block at the first lookup, which still holds when the pieces are left to that lookup. agc_driver_graphics passes on Windows, and on Linux (WSL Ubuntu 26.04, mirrored build) both agc_driver_graphics and agc_driver_graphics_maps_fallback pass.

  2. Rebase over #7473. The HostImportWindows.cpp conflict kept both tests: #7473's resident import after collection, and this PR's small mapping imported at first use. The deferred import already validates inside the bracket. HostImportFor → importAccess → importAllocation, and importAllocation constructs GuestArena::HostImportAccess before it queries the pages (GuestBufferMemory.cpp:1775 at the new head). That is the same function the map-time pass calls (:3549). This PR only skips small ranges in ImportMappedRanges and adds no import path of its own. agc_driver_host_import_windows passes with both tests.

Under the Khronos validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V; RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 11), the 65 recorder tests, agc_driver_graphics and agc_driver_host_import_windows pass 67/67 on main 6696def6e6 and on f752bb6a17. Both logs report the same two VUIDs the same number of times, so the change adds none.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6306512339 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6306512339). Originally posted by [Dripl1x](https://github.com/Dripl1x) on 2026-10-21T02:29:42Z. --- @oneandonlydean thanks, both are done in `f752bb6a17`, rebased onto main `6696def6e6`. The source change is the same hunk as before; only tests changed. 1. **Map-time import tests.** `importRequesterTests` now counts the map requester on a 128 KiB range (two 64 KiB pieces). It also asserts the new behaviour on a 64 KiB range: `ImportMappedRanges` leaves it unimported and the map count unchanged, and the first `HostImportFor` imports it, counted for `access`, with the map count still unchanged. Of the other direct `ImportMappedRanges` calls, `importAtMapOverBudgetTests` also mapped 64 KiB, so with this PR it passed without ever reaching the budget check; it now maps 128 KiB. The stale-probe fixture maps 3 × 64 KiB and is unaffected. `importBlockMapTests` maps 64 KiB pieces one by one and checks for one 4 MiB block at the first lookup, which still holds when the pieces are left to that lookup. `agc_driver_graphics` passes on Windows, and on Linux (WSL Ubuntu 26.04, mirrored build) both `agc_driver_graphics` and `agc_driver_graphics_maps_fallback` pass. 2. **Rebase over #7473.** The `HostImportWindows.cpp` conflict kept both tests: #7473's resident import after collection, and this PR's small mapping imported at first use. The deferred import already validates inside the bracket. `HostImportFor` → `importAccess` → `importAllocation`, and `importAllocation` constructs `GuestArena::HostImportAccess` before it queries the pages (`GuestBufferMemory.cpp:1775` at the new head). That is the same function the map-time pass calls (`:3549`). This PR only skips small ranges in `ImportMappedRanges` and adds no import path of its own. `agc_driver_host_import_windows` passes with both tests. Under the Khronos validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`; RTX 3070 Laptop GPU, NVIDIA 617.42, Windows 11), the 65 recorder tests, `agc_driver_graphics` and `agc_driver_host_import_windows` pass 67/67 on main `6696def6e6` and on `f752bb6a17`. Both logs report the same two VUIDs the same number of times, so the change adds none. AI-assisted: yes.
JJenkx commented 2026-10-21 22:46:01 +00:00 (Migrated from github.com)

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


AMD/Linux data point on a second title, for this PR and #8622 side by side.

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.

So on this title this PR's size gate is the larger win of the two. This is one machine and one scene, three alternated pairs.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6328228766 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6328228766). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-21T22:46:01Z. --- AMD/Linux data point on a second title, for this PR and #8622 side by side. **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. So on this title this PR's size gate is the larger win of the two. This is one machine and one scene, three alternated pairs. AI-assisted: yes (Claude Code); results above were run on this machine.
Dripl1x commented 2026-10-22 02:59:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dripl1x on 2026-10-22T02:59:20Z.


Updated on 2026-10-22; the description is rewritten to match.

  • Rebased onto main 94fbb8cea8; the head is now a1cee90f52, and the empty metadata commit is gone. The source change is the same five lines as before.
  • Test fix (a1cee90f52): #8802 added importMappedFailureGenerationTests after this PR's previous rebase. It maps a 64 KiB range and expects a map-time import, so with the previous head merged into current main, agc_driver_graphics failed ("the map failure fixture did not mutate an unrelated range during allocation"). The fixture now maps 128 KiB as one window, which is still imported at map time. The test passes on main and still fails with #8802's fix reverted.
  • Re-tested on this head and on main: the label and import tests three times on an RTX 3070 Laptop GPU, once on the AMD integrated GPU and on lavapipe; the validation layer reports the same VUIDs on both.
  • New SuperTuxKart captures, one session: main 9.91 / 10.24 FPS, this PR 10.29 / 10.19, this PR with #7464 25.87 / 25.99.
  • Description: it now cites @JJenkx's Lodoss run as this PR's standalone gain, compares this rule with #8622's, and notes the overlap with #9011. Evidence: 7465-evidence-20261022.zip.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6331596730 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7465#issuecomment-6331596730). Originally posted by [Dripl1x](https://github.com/Dripl1x) on 2026-10-22T02:59:20Z. --- Updated on 2026-10-22; the description is rewritten to match. - **Rebased** onto `main` `94fbb8cea8`; the head is now `a1cee90f52`, and the empty metadata commit is gone. The source change is the same five lines as before. - **Test fix** (`a1cee90f52`): #8802 added `importMappedFailureGenerationTests` after this PR's previous rebase. It maps a 64 KiB range and expects a map-time import, so with the previous head merged into current `main`, `agc_driver_graphics` failed ("the map failure fixture did not mutate an unrelated range during allocation"). The fixture now maps 128 KiB as one window, which is still imported at map time. The test passes on `main` and still fails with #8802's fix reverted. - **Re-tested** on this head and on `main`: the label and import tests three times on an RTX 3070 Laptop GPU, once on the AMD integrated GPU and on lavapipe; the validation layer reports the same VUIDs on both. - **New SuperTuxKart captures**, one session: `main` 9.91 / 10.24 FPS, this PR 10.29 / 10.19, this PR with #7464 25.87 / 25.99. - **Description**: it now cites @JJenkx's Lodoss run as this PR's standalone gain, compares this rule with #8622's, and notes the overlap with #9011. Evidence: [7465-evidence-20261022.zip](https://github.com/Dripl1x/AnyPS5/releases/download/review-20261022-7465/7465-evidence-20261022.zip).
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!7465
No description provided.