perf(agc): reclaim idle device buffers under storage cache pressure #8672

Merged
eliasbruno124-dev merged 4 commits from upstream-pr/8672 into main 2026-10-23 21:22:06 +00:00
eliasbruno124-dev commented 2026-10-20 20:42:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliasbruno124-dev on 2026-10-20T20:42:22Z.


What

The storage-image cache can repeatedly evict surfaces while the device-buffer pool retains allocations the title has stopped using. GTA III reproduces this below the reported heap budget, where over-budget trimming does not apply.

On storage admission pressure, reclaim independently allocated device buffers unused during a complete one-second observation interval, oldest first and bounded by the admission shortfall. Reread the driver's budget after an actual release; the existing storage-budget formula, reserve, caps and forced-budget override remain in charge. Active buffers, host tiers, slabs, retained image allocations and recently reused buffers are protected. No fixed small pool cap is introduced.

Reclamation requires one device-local heap because retained buffers do not record their heap. The one-second retention choice and unmeasured effects on intermittent reuse are documented in technical debt.

Scope/order agreed with #4472 and #7833: cold-buffer release first; those branches rebase around it. This does not implement #6194's budget growth or #7833's in-flight image retention.

Tested

Current rebase validation

Head b996e31d8c11956df72031e42d286e4682ebe1fe is rebased linearly onto 777bdbb4f80bcc03e870dfda0d292c0c6410fd6a, including the updated #8527 review correction (equivalent patches to its a0ecec3d3 head). The header conflict retains upstream AgcDriver::Mutex and the idle-clock fields. The reclaim policy and retained-image exclusion are unchanged.

On the Windows/NVIDIA system below, complete runtimes were built for that main and this head. The same 26 focused tests passed on both with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, real Khronos synchronization validation and ctest -V -j1 --timeout 30. Neither run skipped a case or missed the layer. Main nevertheless logged 26 synchronization errors in four tests: agc_import_settle_first_use, agc_import_settle_earlier_import, agc_storage_split_writeback and agc_driver_storage_write_back_overhang. This head logged none. These ordering corrections come from #8527, not the cold-buffer policy. Longest cases: 14.4429s on main and 12.9777s on this head.

The three additional #8527 cases (write_order, write_order_other_family and wait_failure) also passed on this head without skips or validation errors. Conventions and whitespace checks pass. Pre-push main 8eb8e3920 was inspected and merges cleanly; it was not the tested runtime. Linux and AMD/Intel were not tested locally.

The earlier mixed-pool regression fails without the retained-image exclusion and passes with it; image reuse, an image-only pool, repeated empty scans and exact cleanup remain covered. The title measurements below remain evidence for their explicitly named earlier commits. No new gameplay or performance measurement is claimed for this rebase.

Original title measurements

Windows 10.0.26300, i5-11400H, 32 GiB RAM, NVIDIA RTX 3060 Laptop GPU (6 GiB), driver 617.42. Original GTA III PPSA03527/01.003.000, 3840x2160, stationary first-mission spawn at Callahan Bridge with Claude, Kuruma, HUD and radar.

Pinned main 434e965d4620c48e315b25fb869a2d84b39cfb2d plus the unchanged #8527 dependency gives baseline 9552b5e2ccbb297dccd3aba7d8df631bfa9094de; candidate a6c415f7ad63de979e16e39c898c0846ab34465c adds only this policy. Both use the same warmed cache/private-save seed and automatic navigation, default pools, complete runtimes and 61 verified loaded PRXs. Original metadata remained unchanged. No storage error occurred.

APS5_TRACE_FRAMES=4440:10 captures ten presents per side. Startup-only image exports ended at present 4410; navigation ended before that. No readbacks or input during capture, no additional TRACE/PROFILE options, no redirected game logs. Both traces are complete with no dropped events. The short window is corroborated by longer profiled diagnostics below; it is not a claim of steady gameplay or a general FPS gain.

Metric Baseline Candidate
Frame p50 587.394 ms 374.071 ms
Frame p90/p99/max 705.173 ms 400.796 ms
GPU busy per present 298.705 ms 293.601 ms
Capture duration / presents 5988.938 ms / 10 3739.319 ms / 10

Median frame time fell 36.3%; p90 fell 43.2%. The scene remains slow (about 1.67 vs 2.67 presents/s across these short captures). Driver.Packet.memory_wait fell from 517.818 to 166.197 ms/frame, inclusive; overlapping phases must not be added. GPU work remains substantial.

Earlier paired 98.9/113.6-second diagnostic windows used profiling/readbacks: median logical storage-cache eviction writeback 10272.9 MiB/interval -> 0, retained device pool 586 ->298 MiB. Candidate released 348.875 MiB before and 111.5 MiB within the window; neither side acquired new device-pool allocations between the window's first/last counter rows. These are mechanism observations, not additional clean FPS measurements.

Both pinned runtimes pass the same 28 focused native cases using ctest -V, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and the real VK_LAYER_KHRONOS_validation with synchronization validation. No missing-layer warning, VUID error or skipped case; longest cases 14.8167s baseline / 13.9844s candidate. Candidate regressions cover bounded release, repeated 384 MiB reuse, active/host/slab protection, allocation failure while collecting releases, backwards time, unsupported heaps and avoiding repeated empty scans. Conventions pass. Linux and AMD/Intel remain untested locally.

Both complete trace_digest.py outputs, including the raw aps5-summary.jsonl records, follow. The archive contains both raw traces, summary files and digests: gta3-cold-buffer-traces.zip

Baseline: complete trace digest and summary

frames 4440:10 from present 4440: 10 presents, frame p50 587.4 / p90 705.2 / p99 705.2 / max 705.2 ms, GPU busy 298.7 ms per present
NVIDIA GeForce RTX 3060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit 9552b5e2ccbb, dropped: no

{"commit":"9552b5e2ccbb","dirty":false,"env":{"APS5_DUMP_FRAMES":"147","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_TRACE_FRAMES":"4440:10"},"gpu":"NVIDIA GeForce RTX 3060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz","cpu_threads":12,"memory_mib":32509,"title_id":"PPSA03527","title":"Grand Theft Auto III \u00e2\u0080\u0093 The Definitive Edition","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"frames 4440:10","first_present":4440,"ms":5988.938},"presents":10,"frame_ms":{"p50":587.394,"p90":705.173,"p99":705.173,"max":705.173},"gpu_busy_ms_per_present":298.705,"worker_busy_pct":{"queue worker 0x0":99.262,"queue worker 0x20":89.756},"top_phases_ms_per_frame":{"Driver.Packet":1129.534,"Driver.Packet.memory_wait":517.818,"Graphics.Draw":321.549,"Graphics.Draw.draw_and_resource_release":302.126,"Driver.Packet.device_lock":249.122,"Driver.Packet.dispatch":216.385,"Resources.Complete":212.253,"Driver.Dispatch":204.801},"trace_dropped":false,"trace":"aps5-trace-9552b5e2ccbb-22520.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 4449: 705.2 ms at 5284 ms: Driver.Packet (queue worker 0x0) 681.5, Driver.Packet (queue worker 0x20) 405.2, Graphics.Draw (draw committer) 388.0, Driver.Packet.memory_wait (queue worker 0x20) 387.0
  • present 4448: 648.7 ms at 4635 ms: Driver.Packet (queue worker 0x20) 646.1, Driver.Packet (queue worker 0x0) 626.7, Driver.Packet.memory_wait (queue worker 0x20) 626.6, batch (gpu) 382.2
  • present 4442: 636.9 ms at 1150 ms: Driver.Packet (queue worker 0x20) 634.2, Driver.Packet (queue worker 0x0) 619.7, Driver.Packet.memory_wait (queue worker 0x20) 599.1, Graphics.Draw (draw committer) 342.5
  • present 4447: 633.6 ms at 4001 ms: Driver.Packet (queue worker 0x20) 630.3, Driver.Packet (queue worker 0x0) 616.5, Driver.Packet.memory_wait (queue worker 0x20) 613.3, Graphics.Draw (draw committer) 317.9
  • present 4440: 587.4 ms at 0 ms: Driver.Packet (queue worker 0x0) 571.0, batch (gpu) 305.9, Graphics.Draw (draw committer) 288.8, Driver.Packet (queue worker 0x20) 271.6

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 577.6 (96 %) 4.6 (1 %) 16.7 69.8 Driver.Packet 581.1, Driver.EndSubmission 1.1
draw committer 344.9 (58 %) 21.5 (4 %) 232.4 13.4 Graphics.Draw 318.6, Recorder.Sync 30.2
presenter 1.9 (0 %) 0.2 (0 %) 596.8 0.1 VideoOut.Flip 2.0, Driver.Present 0.1
queue worker 0x20 14.3 (2 %) 523.2 (87 %) 61.3 0.1 Driver.Packet 536.1, Driver.EndSubmission 1.4
gpu 315.4 (53 %) 0.0 (0 %) 283.5 0.0 batch 315.4

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 1117.2, Driver.Packet.memory_wait 517.8, Graphics.Draw 319.0, batch 315.4, Graphics.Draw.draw_and_resource_release 297.2, Driver.Packet.device_lock 245.2, Driver.Packet.dispatch 216.3, Resources.Complete 212.1, Driver.Dispatch 204.7, Vulkan.Dispatch 158.2

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x20) 670.4 ms at 4341 ms, present 4447
  • Driver.Packet.memory_wait (queue worker 0x20) 637.4 ms at 5033 ms, present 4448
  • Driver.Packet.memory_wait (queue worker 0x20) 568.1 ms at 327 ms, present 4440
  • Driver.Packet.memory_wait (queue worker 0x20) 559.7 ms at 3761 ms, present 4446
  • Driver.Packet.memory_wait (queue worker 0x20) 552.5 ms at 3197 ms, present 4445
  • Driver.Packet.memory_wait (queue worker 0x20) 536.3 ms at 1548 ms, present 4442
  • Driver.Packet.memory_wait (queue worker 0x20) 535.9 ms at 2646 ms, present 4444
  • Driver.Packet.memory_wait (queue worker 0x20) 513.9 ms at 2097 ms, present 4443
  • Driver.Packet.memory_wait (queue worker 0x20) 322.0 ms at 907 ms, present 4441
  • Driver.Packet.memory_wait (queue worker 0x20) 281.4 ms at 1241 ms, present 4442

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

  • batch 902: 47.5 ms at 4242 ms, present 4447: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 2.6, Graphics.Draw.validate (draw committer) 0.5, Resources.Complete (draw committer) 0.3
  • batch 780: 45.3 ms at 3670 ms, present 4446: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.5, Graphics.Draw.draw_and_resource_release (draw committer) 2.4, Resources.Complete (draw committer) 0.4, Graphics.Draw.validate (draw committer) 0.3
  • batch 539: 44.4 ms at 2565 ms, present 4444: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.6, Graphics.Draw.draw_and_resource_release (draw committer) 2.5, Graphics.Draw.validate (draw committer) 0.4, Resources.Complete (draw committer) 0.3
  • batch 49: 43.7 ms at 240 ms, present 4440: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.1, Graphics.Draw.draw_and_resource_release (draw committer) 2.7, Graphics.Draw.validate (draw committer) 0.7, Resources.Complete (draw committer) 0.3
  • batch 168: 42.8 ms at 816 ms, present 4441: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.2, Graphics.Draw.draw_and_resource_release (draw committer) 2.8, Graphics.Draw.validate (draw committer) 0.7, Resources.Complete (draw committer) 0.4
Candidate: complete trace digest and summary

frames 4440:10 from present 4440: 10 presents, frame p50 374.1 / p90 400.8 / p99 400.8 / max 400.8 ms, GPU busy 293.6 ms per present
NVIDIA GeForce RTX 3060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit a6c415f7ad63, dropped: no

{"commit":"a6c415f7ad63","dirty":false,"env":{"APS5_DUMP_FRAMES":"147","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_TRACE_FRAMES":"4440:10"},"gpu":"NVIDIA GeForce RTX 3060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz","cpu_threads":12,"memory_mib":32509,"title_id":"PPSA03527","title":"Grand Theft Auto III \u00e2\u0080\u0093 The Definitive Edition","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"frames 4440:10","first_present":4440,"ms":3739.319},"presents":10,"frame_ms":{"p50":374.071,"p90":400.796,"p99":400.796,"max":400.796},"gpu_busy_ms_per_present":293.601,"worker_busy_pct":{"queue worker 0x0":98.964,"queue worker 0x20":94.925},"top_phases_ms_per_frame":{"Driver.Packet":723.913,"Driver.Packet.dispatch":263.692,"Recorder.Sync":201.478,"Driver.Packet.device_lock":193.149,"Driver.Packet.memory_wait":166.197,"Graphics.Draw":85.945,"Driver.Packet.draw":76.704,"Driver.Draw":75.787},"trace_dropped":false,"trace":"aps5-trace-a6c415f7ad63-32836.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 4447: 400.8 ms at 2590 ms: Driver.Packet (queue worker 0x20) 400.5, Driver.Packet (queue worker 0x0) 382.4, batch (gpu) 348.8, Recorder.Sync (draw committer) 216.5
  • present 4445: 385.4 ms at 1823 ms: Driver.Packet (queue worker 0x20) 385.0, Driver.Packet (queue worker 0x0) 366.1, batch (gpu) 333.4, Recorder.Sync (draw committer) 203.0
  • present 4446: 381.8 ms at 2209 ms: Driver.Packet (queue worker 0x20) 381.5, Driver.Packet (queue worker 0x0) 363.3, batch (gpu) 328.9, Recorder.Sync (draw committer) 197.3

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 356.1 (95 %) 0.1 (0 %) 17.7 78.6 Driver.Packet 355.4, Driver.EndSubmission 0.9
draw committer 286.5 (77 %) 1.1 (0 %) 86.3 18.0 Recorder.Sync 199.2, Graphics.Draw 81.4
presenter 1.2 (0 %) 0.7 (0 %) 372.1 0.1 VideoOut.Flip 1.7, Driver.Present 0.1
queue worker 0x20 180.2 (48 %) 174.7 (47 %) 18.9 0.1 Driver.Packet 354.7, Driver.EndSubmission 0.2
gpu 324.8 (87 %) 0.0 (0 %) 49.1 0.0 batch 324.8

Largest slices (ms per frame, inclusive, all threads): Driver.Packet 710.1, batch 324.8, Driver.Packet.dispatch 263.6, Recorder.Sync 201.5, Driver.Packet.device_lock 189.2, Driver.Packet.memory_wait 166.1

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x20) 199.5 ms at 2149 ms, present 4445
  • Driver.Packet.memory_wait (queue worker 0x20) 194.4 ms at 2535 ms, present 4446
  • Driver.Packet.memory_wait (queue worker 0x20) 183.3 ms at 1405 ms, present 4443
  • Driver.Packet.memory_wait (queue worker 0x20) 181.9 ms at 2937 ms, present 4447
  • Driver.Packet.memory_wait (queue worker 0x20) 181.7 ms at 1770 ms, present 4444
  • Driver.Packet.memory_wait (queue worker 0x20) 181.6 ms at 681 ms, present 4441

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

  • batch 499: 71.1 ms at 2060 ms, present 4445: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.0, Graphics.Draw.draw_and_resource_release (draw committer) 2.0, Graphics.Draw.validate (draw committer) 1.4, Recorder.Submit (draw committer) 0.1
  • batch 688: 67.6 ms at 2852 ms, present 4447: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.4, Graphics.Draw.draw_and_resource_release (draw committer) 2.1, Graphics.Draw.validate (draw committer) 0.6, Recorder.Submit (draw committer) 0.1
  • batch 595: 65.8 ms at 2452 ms, present 4446: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 2.2, Graphics.Draw.validate (draw committer) 0.8, Recorder.Submit (draw committer) 0.1

Fresh pre-publication main 50e0624d7a902d1083368fafee4a019a10296e1e is checked separately for conflicts and changed inputs; it is not the commit measured above.

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: #8527
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA RTX 3060 Laptop GPU, driver 617.42, Windows 10.0.26300
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4942217728 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8672). Originally posted by [eliasbruno124-dev](https://github.com/eliasbruno124-dev) on 2026-10-20T20:42:22Z. --- ### What The storage-image cache can repeatedly evict surfaces while the device-buffer pool retains allocations the title has stopped using. GTA III reproduces this below the reported heap budget, where over-budget trimming does not apply. On storage admission pressure, reclaim independently allocated device buffers unused during a complete one-second observation interval, oldest first and bounded by the admission shortfall. Reread the driver's budget after an actual release; the existing storage-budget formula, reserve, caps and forced-budget override remain in charge. Active buffers, host tiers, slabs, retained image allocations and recently reused buffers are protected. No fixed small pool cap is introduced. Reclamation requires one device-local heap because retained buffers do not record their heap. The one-second retention choice and unmeasured effects on intermittent reuse are documented in technical debt. Scope/order agreed with [#4472](https://github.com/boykopovar/AnyPS5/pull/4472#issuecomment-6298307877) and [#7833](https://github.com/boykopovar/AnyPS5/pull/7833#issuecomment-6300824318): cold-buffer release first; those branches rebase around it. This does not implement #6194's budget growth or #7833's in-flight image retention. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> #### Current rebase validation Head `b996e31d8c11956df72031e42d286e4682ebe1fe` is rebased linearly onto `777bdbb4f80bcc03e870dfda0d292c0c6410fd6a`, including the updated #8527 review correction (equivalent patches to its `a0ecec3d3` head). The header conflict retains upstream `AgcDriver::Mutex` and the idle-clock fields. The reclaim policy and retained-image exclusion are unchanged. On the Windows/NVIDIA system below, complete runtimes were built for that main and this head. The same 26 focused tests passed on both with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, real Khronos synchronization validation and `ctest -V -j1 --timeout 30`. Neither run skipped a case or missed the layer. Main nevertheless logged 26 synchronization errors in four tests: `agc_import_settle_first_use`, `agc_import_settle_earlier_import`, `agc_storage_split_writeback` and `agc_driver_storage_write_back_overhang`. This head logged none. These ordering corrections come from #8527, not the cold-buffer policy. Longest cases: 14.4429s on main and 12.9777s on this head. The three additional #8527 cases (`write_order`, `write_order_other_family` and `wait_failure`) also passed on this head without skips or validation errors. Conventions and whitespace checks pass. Pre-push main `8eb8e3920` was inspected and merges cleanly; it was not the tested runtime. Linux and AMD/Intel were not tested locally. The earlier mixed-pool regression fails without the retained-image exclusion and passes with it; image reuse, an image-only pool, repeated empty scans and exact cleanup remain covered. The title measurements below remain evidence for their explicitly named earlier commits. No new gameplay or performance measurement is claimed for this rebase. #### Original title measurements Windows 10.0.26300, i5-11400H, 32 GiB RAM, NVIDIA RTX 3060 Laptop GPU (6 GiB), driver 617.42. Original GTA III PPSA03527/01.003.000, 3840x2160, stationary first-mission spawn at Callahan Bridge with Claude, Kuruma, HUD and radar. Pinned main `434e965d4620c48e315b25fb869a2d84b39cfb2d` plus the unchanged #8527 dependency gives baseline `9552b5e2ccbb297dccd3aba7d8df631bfa9094de`; candidate `a6c415f7ad63de979e16e39c898c0846ab34465c` adds only this policy. Both use the same warmed cache/private-save seed and automatic navigation, default pools, complete runtimes and 61 verified loaded PRXs. Original metadata remained unchanged. No storage error occurred. `APS5_TRACE_FRAMES=4440:10` captures ten presents per side. Startup-only image exports ended at present 4410; navigation ended before that. No readbacks or input during capture, no additional TRACE/PROFILE options, no redirected game logs. Both traces are complete with no dropped events. The short window is corroborated by longer profiled diagnostics below; it is not a claim of steady gameplay or a general FPS gain. | Metric | Baseline | Candidate | |---|---:|---:| | Frame p50 | 587.394 ms | 374.071 ms | | Frame p90/p99/max | 705.173 ms | 400.796 ms | | GPU busy per present | 298.705 ms | 293.601 ms | | Capture duration / presents | 5988.938 ms / 10 | 3739.319 ms / 10 | Median frame time fell 36.3%; p90 fell 43.2%. The scene remains slow (about 1.67 vs 2.67 presents/s across these short captures). `Driver.Packet.memory_wait` fell from 517.818 to 166.197 ms/frame, inclusive; overlapping phases must not be added. GPU work remains substantial. Earlier paired 98.9/113.6-second diagnostic windows used profiling/readbacks: median logical storage-cache eviction writeback 10272.9 MiB/interval -> 0, retained device pool 586 ->298 MiB. Candidate released 348.875 MiB before and 111.5 MiB within the window; neither side acquired new device-pool allocations between the window's first/last counter rows. These are mechanism observations, not additional clean FPS measurements. Both pinned runtimes pass the same 28 focused native cases using `ctest -V`, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, and the real `VK_LAYER_KHRONOS_validation` with synchronization validation. No missing-layer warning, VUID error or skipped case; longest cases 14.8167s baseline / 13.9844s candidate. Candidate regressions cover bounded release, repeated 384 MiB reuse, active/host/slab protection, allocation failure while collecting releases, backwards time, unsupported heaps and avoiding repeated empty scans. Conventions pass. Linux and AMD/Intel remain untested locally. Both complete `trace_digest.py` outputs, including the raw `aps5-summary.jsonl` records, follow. The archive contains both raw traces, summary files and digests: [gta3-cold-buffer-traces.zip](https://github.com/user-attachments/files/33738905/gta3-cold-buffer-traces.zip) <details> <summary>Baseline: complete trace digest and summary</summary> **frames 4440:10** from present 4440: 10 presents, frame p50 587.4 / p90 705.2 / p99 705.2 / max 705.2 ms, GPU busy 298.7 ms per present NVIDIA GeForce RTX 3060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit 9552b5e2ccbb, dropped: no ```json {"commit":"9552b5e2ccbb","dirty":false,"env":{"APS5_DUMP_FRAMES":"147","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_TRACE_FRAMES":"4440:10"},"gpu":"NVIDIA GeForce RTX 3060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz","cpu_threads":12,"memory_mib":32509,"title_id":"PPSA03527","title":"Grand Theft Auto III \u00e2\u0080\u0093 The Definitive Edition","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"frames 4440:10","first_present":4440,"ms":5988.938},"presents":10,"frame_ms":{"p50":587.394,"p90":705.173,"p99":705.173,"max":705.173},"gpu_busy_ms_per_present":298.705,"worker_busy_pct":{"queue worker 0x0":99.262,"queue worker 0x20":89.756},"top_phases_ms_per_frame":{"Driver.Packet":1129.534,"Driver.Packet.memory_wait":517.818,"Graphics.Draw":321.549,"Graphics.Draw.draw_and_resource_release":302.126,"Driver.Packet.device_lock":249.122,"Driver.Packet.dispatch":216.385,"Resources.Complete":212.253,"Driver.Dispatch":204.801},"trace_dropped":false,"trace":"aps5-trace-9552b5e2ccbb-22520.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 4449: 705.2 ms at 5284 ms: Driver.Packet (queue worker 0x0) 681.5, Driver.Packet (queue worker 0x20) 405.2, Graphics.Draw (draw committer) 388.0, Driver.Packet.memory_wait (queue worker 0x20) 387.0 - present 4448: 648.7 ms at 4635 ms: Driver.Packet (queue worker 0x20) 646.1, Driver.Packet (queue worker 0x0) 626.7, Driver.Packet.memory_wait (queue worker 0x20) 626.6, batch (gpu) 382.2 - present 4442: 636.9 ms at 1150 ms: Driver.Packet (queue worker 0x20) 634.2, Driver.Packet (queue worker 0x0) 619.7, Driver.Packet.memory_wait (queue worker 0x20) 599.1, Graphics.Draw (draw committer) 342.5 - present 4447: 633.6 ms at 4001 ms: Driver.Packet (queue worker 0x20) 630.3, Driver.Packet (queue worker 0x0) 616.5, Driver.Packet.memory_wait (queue worker 0x20) 613.3, Graphics.Draw (draw committer) 317.9 - present 4440: 587.4 ms at 0 ms: Driver.Packet (queue worker 0x0) 571.0, batch (gpu) 305.9, Graphics.Draw (draw committer) 288.8, Driver.Packet (queue worker 0x20) 271.6 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 577.6 (96 %) | 4.6 (1 %) | 16.7 | 69.8 | Driver.Packet 581.1, Driver.EndSubmission 1.1 | | draw committer | 344.9 (58 %) | 21.5 (4 %) | 232.4 | 13.4 | Graphics.Draw 318.6, Recorder.Sync 30.2 | | presenter | 1.9 (0 %) | 0.2 (0 %) | 596.8 | 0.1 | VideoOut.Flip 2.0, Driver.Present 0.1 | | queue worker 0x20 | 14.3 (2 %) | 523.2 (87 %) | 61.3 | 0.1 | Driver.Packet 536.1, Driver.EndSubmission 1.4 | | gpu | 315.4 (53 %) | 0.0 (0 %) | 283.5 | 0.0 | batch 315.4 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 1117.2, Driver.Packet.memory_wait 517.8, Graphics.Draw 319.0, batch 315.4, Graphics.Draw.draw_and_resource_release 297.2, Driver.Packet.device_lock 245.2, Driver.Packet.dispatch 216.3, Resources.Complete 212.1, Driver.Dispatch 204.7, Vulkan.Dispatch 158.2 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x20) 670.4 ms at 4341 ms, present 4447 - Driver.Packet.memory_wait (queue worker 0x20) 637.4 ms at 5033 ms, present 4448 - Driver.Packet.memory_wait (queue worker 0x20) 568.1 ms at 327 ms, present 4440 - Driver.Packet.memory_wait (queue worker 0x20) 559.7 ms at 3761 ms, present 4446 - Driver.Packet.memory_wait (queue worker 0x20) 552.5 ms at 3197 ms, present 4445 - Driver.Packet.memory_wait (queue worker 0x20) 536.3 ms at 1548 ms, present 4442 - Driver.Packet.memory_wait (queue worker 0x20) 535.9 ms at 2646 ms, present 4444 - Driver.Packet.memory_wait (queue worker 0x20) 513.9 ms at 2097 ms, present 4443 - Driver.Packet.memory_wait (queue worker 0x20) 322.0 ms at 907 ms, present 4441 - Driver.Packet.memory_wait (queue worker 0x20) 281.4 ms at 1241 ms, present 4442 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 902: 47.5 ms at 4242 ms, present 4447: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 2.6, Graphics.Draw.validate (draw committer) 0.5, Resources.Complete (draw committer) 0.3 - batch 780: 45.3 ms at 3670 ms, present 4446: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.5, Graphics.Draw.draw_and_resource_release (draw committer) 2.4, Resources.Complete (draw committer) 0.4, Graphics.Draw.validate (draw committer) 0.3 - batch 539: 44.4 ms at 2565 ms, present 4444: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.6, Graphics.Draw.draw_and_resource_release (draw committer) 2.5, Graphics.Draw.validate (draw committer) 0.4, Resources.Complete (draw committer) 0.3 - batch 49: 43.7 ms at 240 ms, present 4440: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.1, Graphics.Draw.draw_and_resource_release (draw committer) 2.7, Graphics.Draw.validate (draw committer) 0.7, Resources.Complete (draw committer) 0.3 - batch 168: 42.8 ms at 816 ms, present 4441: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.2, Graphics.Draw.draw_and_resource_release (draw committer) 2.8, Graphics.Draw.validate (draw committer) 0.7, Resources.Complete (draw committer) 0.4 </details> <details> <summary>Candidate: complete trace digest and summary</summary> **frames 4440:10** from present 4440: 10 presents, frame p50 374.1 / p90 400.8 / p99 400.8 / max 400.8 ms, GPU busy 293.6 ms per present NVIDIA GeForce RTX 3060 Laptop GPU, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit a6c415f7ad63, dropped: no ```json {"commit":"a6c415f7ad63","dirty":false,"env":{"APS5_DUMP_FRAMES":"147","APS5_DUMP_FRAMES_EVERY":"30","APS5_DUMP_SCALE":"4","APS5_LAZY_SHADER_PREPARE":"1","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_PIPELINE_JOURNAL_THREADS":"2","APS5_TRACE_FRAMES":"4440:10"},"gpu":"NVIDIA GeForce RTX 3060 Laptop GPU","driver":"NVIDIA 617.42","os":"Windows 10.0.26300","cpu":"11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz","cpu_threads":12,"memory_mib":32509,"title_id":"PPSA03527","title":"Grand Theft Auto III \u00e2\u0080\u0093 The Definitive Edition","content_version":"01.003.000","resolution":"3840x2160","window":{"spec":"frames 4440:10","first_present":4440,"ms":3739.319},"presents":10,"frame_ms":{"p50":374.071,"p90":400.796,"p99":400.796,"max":400.796},"gpu_busy_ms_per_present":293.601,"worker_busy_pct":{"queue worker 0x0":98.964,"queue worker 0x20":94.925},"top_phases_ms_per_frame":{"Driver.Packet":723.913,"Driver.Packet.dispatch":263.692,"Recorder.Sync":201.478,"Driver.Packet.device_lock":193.149,"Driver.Packet.memory_wait":166.197,"Graphics.Draw":85.945,"Driver.Packet.draw":76.704,"Driver.Draw":75.787},"trace_dropped":false,"trace":"aps5-trace-a6c415f7ad63-32836.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 4447: 400.8 ms at 2590 ms: Driver.Packet (queue worker 0x20) 400.5, Driver.Packet (queue worker 0x0) 382.4, batch (gpu) 348.8, Recorder.Sync (draw committer) 216.5 - present 4445: 385.4 ms at 1823 ms: Driver.Packet (queue worker 0x20) 385.0, Driver.Packet (queue worker 0x0) 366.1, batch (gpu) 333.4, Recorder.Sync (draw committer) 203.0 - present 4446: 381.8 ms at 2209 ms: Driver.Packet (queue worker 0x20) 381.5, Driver.Packet (queue worker 0x0) 363.3, batch (gpu) 328.9, Recorder.Sync (draw committer) 197.3 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 356.1 (95 %) | 0.1 (0 %) | 17.7 | 78.6 | Driver.Packet 355.4, Driver.EndSubmission 0.9 | | draw committer | 286.5 (77 %) | 1.1 (0 %) | 86.3 | 18.0 | Recorder.Sync 199.2, Graphics.Draw 81.4 | | presenter | 1.2 (0 %) | 0.7 (0 %) | 372.1 | 0.1 | VideoOut.Flip 1.7, Driver.Present 0.1 | | queue worker 0x20 | 180.2 (48 %) | 174.7 (47 %) | 18.9 | 0.1 | Driver.Packet 354.7, Driver.EndSubmission 0.2 | | gpu | 324.8 (87 %) | 0.0 (0 %) | 49.1 | 0.0 | batch 324.8 | **Largest slices** (ms per frame, inclusive, all threads): Driver.Packet 710.1, batch 324.8, Driver.Packet.dispatch 263.6, Recorder.Sync 201.5, Driver.Packet.device_lock 189.2, Driver.Packet.memory_wait 166.1 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x20) 199.5 ms at 2149 ms, present 4445 - Driver.Packet.memory_wait (queue worker 0x20) 194.4 ms at 2535 ms, present 4446 - Driver.Packet.memory_wait (queue worker 0x20) 183.3 ms at 1405 ms, present 4443 - Driver.Packet.memory_wait (queue worker 0x20) 181.9 ms at 2937 ms, present 4447 - Driver.Packet.memory_wait (queue worker 0x20) 181.7 ms at 1770 ms, present 4444 - Driver.Packet.memory_wait (queue worker 0x20) 181.6 ms at 681 ms, present 4441 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 499: 71.1 ms at 2060 ms, present 4445: GPU no ranges; recorded by Graphics.Draw (draw committer) 4.0, Graphics.Draw.draw_and_resource_release (draw committer) 2.0, Graphics.Draw.validate (draw committer) 1.4, Recorder.Submit (draw committer) 0.1 - batch 688: 67.6 ms at 2852 ms, present 4447: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.4, Graphics.Draw.draw_and_resource_release (draw committer) 2.1, Graphics.Draw.validate (draw committer) 0.6, Recorder.Submit (draw committer) 0.1 - batch 595: 65.8 ms at 2452 ms, present 4446: GPU no ranges; recorded by Graphics.Draw (draw committer) 3.8, Graphics.Draw.draw_and_resource_release (draw committer) 2.2, Graphics.Draw.validate (draw committer) 0.8, Recorder.Submit (draw committer) 0.1 </details> Fresh pre-publication main `50e0624d7a902d1083368fafee4a019a10296e1e` is checked separately for conflicts and changed inputs; it is not the commit measured above. ### 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: #8527 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA RTX 3060 Laptop GPU, driver 617.42, Windows 10.0.26300 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-20 20:42:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T20:42:36Z.


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:6301037439 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8672#issuecomment-6301037439). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T20:42:36Z. --- <!-- 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 20:55:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:55:10Z.

Review: APPROVED


I reviewed the reclaim policy and its call site. Take advances the pool clock, so entries reused during the one-second observation window are newer than reclaimBefore; active allocations are absent from the free tier, and slab allocations are explicitly excluded. The operation removes pool bookkeeping under the mutex and destroys Vulkan allocations after releasing it. The one-device-local-heap guard matches the implementation's lack of per-allocation heap tracking, and the budget is reread only after an actual release.

The PR description reports focused Vulkan validation with synchronization validation and paired traces for the same Windows/NVIDIA scene, while clearly limiting the performance claim to that scene. Hosted platform jobs are skipped, so this approval relies on the author's detailed run report rather than an independent build or GPU run here.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5591610284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8672#pullrequestreview-5591610284). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T20:55:10Z. **Review:** APPROVED --- I reviewed the reclaim policy and its call site. `Take` advances the pool clock, so entries reused during the one-second observation window are newer than `reclaimBefore`; active allocations are absent from the free tier, and slab allocations are explicitly excluded. The operation removes pool bookkeeping under the mutex and destroys Vulkan allocations after releasing it. The one-device-local-heap guard matches the implementation's lack of per-allocation heap tracking, and the budget is reread only after an actual release. The PR description reports focused Vulkan validation with synchronization validation and paired traces for the same Windows/NVIDIA scene, while clearly limiting the performance claim to that scene. Hosted platform jobs are skipped, so this approval relies on the author's detailed run report rather than an independent build or GPU run here.
eliasbruno124-dev commented 2026-10-20 21:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by eliasbruno124-dev on 2026-10-20T21:37:16Z.


Rebased to 74b001a9cc after #7870. Retained images now share the free tier, so idle buffer reclamation explicitly excludes them. The new mixed-pool regression fails without that exclusion and passes with it, including image reuse and exact cleanup.

Both complete Windows/NVIDIA runtimes pass the same 28 focused tests with cache disabled and Khronos synchronization validation: no VUID errors or skipped cases. Conventions pass. The description now distinguishes these checks from the earlier title timing evidence.

Prepared with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302077550 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8672#issuecomment-6302077550). Originally posted by [eliasbruno124-dev](https://github.com/eliasbruno124-dev) on 2026-10-20T21:37:16Z. --- Rebased to `74b001a9cc` after #7870. Retained images now share the free tier, so idle buffer reclamation explicitly excludes them. The new mixed-pool regression fails without that exclusion and passes with it, including image reuse and exact cleanup. Both complete Windows/NVIDIA runtimes pass the same 28 focused tests with cache disabled and Khronos synchronization validation: no VUID errors or skipped cases. Conventions pass. The description now distinguishes these checks from the earlier title timing evidence. Prepared with AI assistance.
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!8672
No description provided.