perf(agc): read dropped sampled snapshots straight into their upload staging buffer #9884

Merged
thuanquang merged 13 commits from upstream-pr/9884 into main 2026-11-10 23:19:01 +00:00
thuanquang commented 2026-10-22 20:32:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-22T20:32:45Z.


What

This reopens the change I closed on 2026-10-23 in favour of #8026. It is now rebased past #8026 and keeps #8026's spare pool for the snapshots that still use a vector.

Since #6982, a sampled snapshot of a tracked or hinted surface over 256 KiB keeps no bytes after its upload, and since #8026 its vector then goes to a spare pool. To build one, cachedTexture does three things on main 91ecd2d974:

  • it takes a vector of the surface size from that pool, or allocates and zero-fills a new one (ShaderResources.cpp:1081-1082);
  • it reads the guest surface into the vector (:1117);
  • the Texture copies the vector into a pooled staging Buffer (Texture.cpp:489-490).

The vector is parked afterwards (ShaderResources.cpp:1128).

With Uncompressed keys, such a snapshot is now read straight into the staging Buffer:

  • ShaderResources.cpp, cachedTexture:
    • The drop test runs before the read, on the same inputs as main's drop after the upload: over 256 KiB, and either entry.generation != 0 (the snapshot generation) or the untracked-memory hint when no write is pending.
    • A dropped Uncompressed snapshot gets a pooled host-visible Buffer (TRANSFER_SRC). ReadTextureSurface fills it, and the texture is built from it.
    • It takes nothing from the spare pool and parks nothing of its own. If the entry it replaces kept a vector, that vector goes to the pool.
    • It still runs the pool's expiry, so a spare unused for more than 16 presents is released at the next snapshot, as on main. The expiry loop moves into expireSpareSnapshots, which parkSnapshot and spareSnapshot now call too.
    • The staging path passes #12246's layerRows as the vector path does, so a dropped snapshot of a 1D array past maxImageArrayLayers is still laid out as rows of a 2D image.
    • Kept snapshots and snapshots with other keys (DCC clear keys, ClearSingle) keep the vector and the pool. A surface that main clears on the GPU (#13648) keeps no snapshot, as before, and still parks the vector of the entry it replaces. The uncached path (APS5_NO_TEXTURE_CACHE) is unchanged.
  • Texture.cpp (declared in Texture.hpp): the span constructor and a new constructor that takes the staging Buffer as a std::shared_ptr (with depthCompare and layerRows) both delegate to one private constructor. It allocates a staging Buffer and copies the span into it only when none was handed in. The rest of the upload is main's: since #10773, with a recorder, it copies the staging Buffer into the batch's tiled upload scratch and keeps the Buffer with the batch (Texture.cpp:513-526 on this head).

For a dropped Uncompressed snapshot, this removes the vector allocation, its zero-fill and the surface-sized memcpy. The staging Buffer goes back to the BufferPool when the recorder releases it, as on main.

A reused pooled Buffer still holds earlier bytes, so this relies on ReadTextureSurface writing every byte for Uncompressed keys. GuestMemory::ReadCommitted does: it copies the whole range when it is accessible, and otherwise zero-fills the range and copies the committed parts (copyCommitted, GuestMemory.cpp:2927-2934 on 91ecd2d974, which ReadCommitted calls at :2944). On Windows, since #10575, each of those copies is a ReadProcessMemory read. If it fails because a page is not readable, the copy goes page by page and zero-fills every page it cannot read; since #10498, a short read or any other read error throws, and nothing is uploaded from that Buffer (readPages, visitReadablePages and copyCommittedBytes, :2867-2905). #8026 relies on the same contract for reused vectors, and on 91ecd2d974, DepthSurface.cpp:1603 already reads with ReadCommitted straight into a pooled Buffer.

Changes since the close (old head 388daf981f):

  • Rebased past #8026, with the pool handling above.
  • #8026's recycleTests and spareAgeTests (tests/execution/SampledCacheBudget.cpp) made their spare with a dropped Uncompressed snapshot, which no longer parks one. They now park it through a fast-cleared BC5 snapshot (1024x1024, 0000 keys, 1 MiB), a producer that still does, and check the same counts.
    • The 8_8_8_8 and 32 uint surfaces they used before no longer work: since #13648, main clears them on the GPU and keeps no snapshot. SampledClearColor refuses block-compressed formats, so a BC5 surface stays a snapshot.
    • These rows need BC support. Without it they print a "not tested" line.
    • As NFSS10 noted, they rely on clear keys staying on the vector path: if the staging path is ever widened to clear keys, they need another producer.
  • agc_snapshot_staging_upload is replaced by agc_snapshot_read_into_staging (see Tested).

Overlap:

  • #10064 (draft) builds a partially committed sampled 3D view from its committed slabs.
    • It changes the same snapshot read in cachedTexture and the same staging setup in Texture's constructor, so the two conflict in Texture.hpp, ShaderResources.cpp and Texture.cpp.
    • Merge order (agreed with EagleBearerYS; the one #10064 had with #10845, closed as a duplicate of this PR): this PR first, then #10064.
    • EagleBearerYS takes the merge on #10064's side: a packed-slab snapshot is not the surface's layout and stays on the vector path (a !slabs.has_value() term on the condition that picks the staging buffer), and packedSlabs is forwarded into the staging constructor (comment).
  • #10773 (fma-rc) merged first, on 2026-11-02 (88a4bed5d3), as agreed with fma-rc. It replaced the upload's per-upload tiled and linear DeviceBuffers with a per-batch scratch, in the block of Texture.cpp where this PR makes the staging buffer only when none was passed in. The two complement each other: #10773 changed the device buffers the upload copies and detiles through, this PR how the host staging Buffer is filled. The merge of main a4eca2a056 keeps #10773's lines as they are and puts this PR's staging block after its syncUploads and recorder lines.
  • #7085 (Amoenus) adds a mip-level report right after the snapshot size check that this PR changes to check the staging buffer. Merge order (agreed with Amoenus): this PR before #10064 before #7085; the resolution keeps both lines.

Why

PPSA14363 (METAL GEAR SOLID - Master Collection Version): in my runs of a timing build on main 379b1dca32 (below), each page turn in the launcher's Screenplay Book sampled a new snapshot of a 15360x8640 R8 linear surface (126.6 MiB), which was dropped after its upload. I have not checked the snapshot itself again on a current build; the page-turn pair on this head is under Tested.

#8026 releases a spare once it has gone unused for more than 16 presents, and page turns come seconds apart (7 s in my scripted route, about 400 presents). So in my runs, main allocated and zero-filled a new 126.6 MiB vector on every turn, read the surface into it and copied it into the staging buffer.

The same holds for any dropped Uncompressed snapshot: it always pays the memcpy, and it pays the allocation and zero-fill whenever no spare of its size was parked in the last 16 presents.

I measured this with a local timing build on main 379b1dca32, which has #8026 (timing probes, not in this PR; run with APS5_PROFILE_DRAW=1 and APS5_TRACE_SUMMARY_EVERY=10; it also carried a local change of mine, not part of any PR, that uploads a linear snapshot without the identity detile and changes only the steps after the memcpy). Two runs, each opening the book and turning 8 pages: none of the 18 snapshot builds took a vector from the pool. Per page turn (16 turns, Ryzen 5 5600X):

Step Range Median
vector allocation and zero-fill 17.4-31.1 ms 23.5 ms
guest read (ReadTextureSurface) 7.1-14.6 ms 9.2 ms
memcpy into the staging Buffer 6.6-15.1 ms 8.7 ms

This PR removes the first and the last step, which took 24.1-46.2 ms per turn together (median 31.6 ms); the read stays. Keeping spares longer would avoid only the allocation and zero-fill, by holding 126.6 MiB of host memory between turns, and would keep the memcpy. The page-turn frame times of main and of this head are under Tested.

Tested

Head ac57b02043 on main 4f41f4c375 (2026-11-03). RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.16010, Windows 11 26200, WinLibs GCC 15.2.0 r7 Release, ANYPS5_REQUIRE_VULKAN=1.

Integration since 0386e61741, the head of the earlier results:

  • 491ffaa5a6 and 6a54ad1a07 merge main dc9dc7eaae and f2d874c1fd. The first resolves the conflicts with #13648, which clears fast-cleared sampled textures on the GPU through a new clear parameter of the snapshot constructor, and moves the test registration into tests/cmake/agc_driver_recorder_tests.cmake (#12862).
  • 181f0ab5e7 moves the spare-pool producers to BC5 surfaces (see What) and adds a guard row for the GPU-clear park (below).
  • 38f795a674 merges main a4eca2a056. #12246 conflicts in Texture.hpp, Texture.cpp and ShaderResources.cpp, and #10773 in Texture.cpp. The resolution is described in What and under Overlap.
  • e9b72ae83a adds the 1D-array row (below). On a4eca2a056 it also passed 42 related tests in each of 3 runs (that selection missed #10773's agc_recorder_upload_scratch), and a validation-layer run with no VUID- line.
  • 1b0577cc92 merges main 91ecd2d974 without conflicts; the page-turn pair below ran on it. Since a4eca2a056, #8963, #6185, #14891, #12158 and #12980 changed five of this PR's six files. The head's changed lines against 91ecd2d974 are the same as e9b72ae83a's against a4eca2a056 (six files, 380+/34-).
  • ac57b02043 merges main 4f41f4c375 (2026-11-03 08:12 UTC) without conflicts. That main is 240 commits past 91ecd2d974: 50 merges, all within five minutes after it. The head's changed lines against 4f41f4c375 are the same as 1b0577cc92's against 91ecd2d974, and its tree (e7a000f88c) is the one git merge-tree gives for e9b72ae83a merged with 4f41f4c375, the merge XairRrR's lavapipe review ran (every row of agc_snapshot_read_into_staging passed there, and the negative control failed; see GPUs tested).
    • #10000, #10556, #14302 and #14311 changed this PR's production files, all outside cachedTexture, the spare pool and the snapshot Texture constructors and upload: StorageTexture, and the sampler masks and null-descriptor checks of ShaderResources.cpp. #6905 and #14302 also add tests to agc_driver_recorder_tests (tests/Recorder.cpp and its registrations), the binary that runs agc_snapshot_read_into_staging.
    • #6905 also changes the detile shader that the snapshot upload dispatches (TextureDetile.comp, TextureDetiler.cpp): for 1- and 2-byte texels, such as the page surface's R8, it now stores whole words, in both arms. It does not touch the vector allocation, the zero-fill or the memcpy this PR removes. The page-turn pair below ran on 1b0577cc92 and 91ecd2d974, before it; page-turn and GPU-batch times on 4f41f4c375 may differ in both arms.

New test: agc_snapshot_read_into_staging (agc_driver_recorder_tests --snapshot-read-into-staging-only) samples through CachedSampledTexture on write-watched guest allocations. On the head, in the validation-layer run (ctest -V), every row below printed passed and none printed not tested. The test took 0.21-1.59 s in the three plain runs; its CTest TIMEOUT is 30 s.

  • GPU-clear guard (181f0ab5e7, needs no BC):
    • An uncompressed 256 KiB 8_8_8_8 snapshot keeps its vector. Once its keys read 1111, the GPU clear that replaces it must park that vector in the spare pool.
    • A new 1111 surface of the same size, cleared on the GPU 16 presents later, must leave that spare alone, and the next snapshot, one present later, releases it.
    • The row also passes on main's production files.
  • Dropped snapshots of four surfaces: a linear 512x512 one, a 64KB_R_X one, a padded linear 600x300 one (rows of 640 texels), and a three-level linear one whose level-1 centre pages are not committed, with committed levels stored before and after them.
    • Before each, a pooled staging Buffer of the surface's size is filled with 0xee and returned to the pool.
    • Each snapshot must leave the spare pool empty.
    • It must upload from that reused Buffer: a probe Buffer of that size must not get it back.
    • It must sample the guest bytes in every level, with zeros in the uncommitted pages.
    • It must be remade after a driver store of the bytes already there, since it kept none to compare.
  • 1D array laid out as rows (e9b72ae83a, needs nullDescriptor): a watched linear 1D array of 8-texel 8_8_8_8 slices, bound as a 2D image through ShaderResources.
    • The row's own context caps maxImageArrayLayers at 2048. The RX 6700 XT reports 8192, which allows every array a T# can describe.
    • The array has 2049 slices (524,544 bytes), so cachedTexture drops its snapshot, and the texture lays it out as rows of a 2D image.
    • It must be a snapshot, not a storage view, park no vector, and sample the centre slice at the centre of the image.
  • The pool (BC5 producers, need BC):
    • A fast-cleared BC5 snapshot still parks its vector.
    • A dropped Uncompressed snapshot of the same size 16 presents later leaves that spare alone, and the next snapshot, one present later, releases it.
    • A dropped snapshot 16 presents after a spare was parked keeps the spare. One 17 presents after it releases the spare.
  • The ctest entry unsets APS5_SYNC_TEXTURE_UPLOAD, APS5_DUMP_TEXTURE, APS5_NO_TEXTURE_CACHE and the buffer pool switches (APS5_BUFFER_POOL_SLOTS, APS5_BUFFER_POOL_SHARED, APS5_NO_BUFFER_CLASSES, APS5_STAGING_POOL_MIB). Each of them changes how a snapshot uploads or which Buffer the pool hands out.
  • Negative control (a), main's production files: this head with Texture.hpp, ShaderResources.cpp and Texture.cpp from 4f41f4c375 fails in 4 of 4 runs (3 plain, 1 with the validation layer): AGC graphics: the dropped snapshot of the linear surface parked a vector in the spare pool. The head passes in 4 of 4 runs. With main's files the test stops at that row, so the 1D-array row does not run there.
  • Negative control (b), layerRows dropped from the staging path: with false instead of layerRows in the staging createTexture call of cachedTexture, the test fails at the 1D-array row, after the four other dropped rows pass: AGC graphics: a texture array with more layers than maxImageArrayLayers is not implemented (1 run). With the file restored, the head passes again.

Related tests: 45 tests, selected by name with ctest -N -R 'detile_small_elements|recorder|snapshot|sampled_cache|partially_resident|recover_.*allocation|read_written_staging|staged_clear_sampled_read|sampled_storage_base_level_usage|buffer_pool|storage_cache_budget|clear_keys|sampled_clear'.

  • They are the 41 of the earlier run (which include the 25 of the first one), plus agc_driver_sampled_clear_keys (the last two patterns are new), agc_recorder_upload_scratch (#10773), agc_driver_sampled_cache_budget_report_age (#14891) and agc_detile_small_elements (#6905, the detile shader the upload dispatches).
  • Among them: agc_snapshot_read_into_staging, agc_driver_sampled_cache_budget, agc_driver_sampled_cache_budget_without_storage_image_multisample, agc_driver_sampled_cache_budget_memory, agc_driver_partially_resident_snapshot, agc_driver_large_tracked_snapshot, agc_driver_untracked_snapshot_hint and the 4 buffer_pool tests.
  • The head passes 45 of 45 in each of 3 runs. main's production files with these tests pass 44 of 45 in each of 3 runs; the only failure is agc_snapshot_read_into_staging, as above.

Validation layer: the same 45 tests with ctest -V, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan-ValidationLayers vulkan-sdk-1.4.363.0), VK_LOADER_DEBUG=layer, VK_LOADER_LAYERS_DISABLE=~implicit~, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1, on main's production files with these tests and on the head. Each log shows the loader inserting VK_LAYER_KHRONOS_validation 35 times, once in each of the 35 tests that create a Vulkan instance (agc_snapshot_read_into_staging among them; the other 10 print no loader output). Neither log has was not found but was requested, a VUID- line or a Validation Error. Results as above: 44 of 45 and 45 of 45.

Title, on the previous head 1b0577cc92 (the same changed lines as this head, on main 91ecd2d974): PPSA14363, launcher → Screenplay Book, 8 page turns (R1) 7 s apart, scripted pad input. 150 s legs of main 91ecd2d9743b831b575d293e6c8fafbe737e1e88 (M) and of 1b0577cc927bdde256dc6a54697f9c57f2d340af (P), two clean builds, in the order M1, P1, M2, P2 (2026-11-03).

  • Each arm runs in its own folder. One 150 s run of the same route warmed each folder's shader cache before M1, and no leg's log shows a shader disk cache miss. Each leg started the title anew, and each folder's libSceAgcDriver.prx was checked by hash against its build.
  • Each leg set only APS5_TRACE_SECONDS=60:70 and the pad input variables. No leg's trace dropped events.
  • The GPU and build locks were held for every leg. Before each leg, a check found no build, test, other emulator run or other game running, then 30 s of quiet CPU. League of Legends may have been running; the check does not count it.
  • Per page turn, the analysis takes the longest present interval from 1 s before to 1.5 s after the press, the longest draw-committer span overlapping it, and the longest GPU batch overlapping it or starting within 50 ms after it.

Per leg, 8 page turns each (ms; medians over the turns of the leg):

Leg Page-turn frame median Range Longest committer span Longest GPU batch Window p99 Window max
M1 (main 91ecd2d974) 103.35 96.3-126.9 42.1 27.65 17.428 126.883
P1 (1b0577cc92) 77.95 74.4-92.5 15.7 27.95 17.433 92.502
M2 (main 91ecd2d974) 100.5 97.8-126.9 43.2 27.6 17.505 126.907
P2 (1b0577cc92) 74.1 68.3-92.3 15.6 28.25 17.572 92.258

All turns of each arm: main 91ecd2d974 102.7 ms median (96.3-126.9, 16 turns), committer span 42.7 ms, GPU batch 27.6 ms; 1b0577cc92 77.3 ms median (68.3-92.5, 16 turns), committer span 15.6 ms, GPU batch 28.2 ms. Every page turn still drops frames with the change.

Over the whole 70 s window, in each of the 3 adjacent pairs (M1-P1, M2-P1, M2-P2), the frame p50 is the same (16.683 ms). With the change the mean frame is 0.07-0.08 ms shorter, there are 2.4-2.8 more presents per 10 s, and the GPU is busy 0.002-0.006 ms less per present.

Traces of all four legs, each with its tools/trace_digest.py output, as CONTRIBUTING asks: M1: trace, digest; P1: trace, digest; M2: trace, digest; P2: trace, digest. They hold only AnyPS5's scope and thread names, timings, batch ids and present numbers; I checked each for anything from the title.

Summary lines of the four legs (M1, P1, M2, P2):

{"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.123},"presents":4139,"frame_ms":{"p50":16.683,"p90":16.910,"p99":17.428,"max":126.883},"gpu_busy_ms_per_present":6.837,"worker_busy_pct":{"queue worker 0x0":10.513},"top_phases_ms_per_frame":{"VideoOut.Flip":13.645,"VideoOut.Flip.vblank_wait":12.619,"Driver.Packet":1.775,"Graphics.Draw":1.429,"Graphics.Draw.draw_and_resource_release":1.269,"Driver.Packet.draw":1.203,"Driver.Draw":1.183,"VideoOut.Flip.present":0.935},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-14216.json.gz"}
{"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3575,"ms":70003.079},"presents":4159,"frame_ms":{"p50":16.683,"p90":16.910,"p99":17.433,"max":92.502},"gpu_busy_ms_per_present":6.831,"worker_busy_pct":{"queue worker 0x0":10.011},"top_phases_ms_per_frame":{"VideoOut.Flip":13.686,"VideoOut.Flip.vblank_wait":12.650,"Driver.Packet":1.682,"Graphics.Draw":1.342,"Graphics.Draw.draw_and_resource_release":1.191,"Driver.Packet.draw":1.167,"Driver.Draw":1.148,"VideoOut.Flip.present":0.929},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-8828.json.gz"}
{"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.310},"presents":4140,"frame_ms":{"p50":16.683,"p90":16.909,"p99":17.505,"max":126.907},"gpu_busy_ms_per_present":6.833,"worker_busy_pct":{"queue worker 0x0":10.440},"top_phases_ms_per_frame":{"VideoOut.Flip":13.644,"VideoOut.Flip.vblank_wait":12.612,"Driver.Packet":1.762,"Graphics.Draw":1.413,"Graphics.Draw.draw_and_resource_release":1.260,"Driver.Packet.draw":1.195,"Driver.Draw":1.175,"VideoOut.Flip.present":0.939},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-8032.json.gz"}
{"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3574,"ms":70003.066},"presents":4157,"frame_ms":{"p50":16.683,"p90":16.921,"p99":17.572,"max":92.258},"gpu_busy_ms_per_present":6.829,"worker_busy_pct":{"queue worker 0x0":10.067},"top_phases_ms_per_frame":{"VideoOut.Flip":13.663,"VideoOut.Flip.vblank_wait":12.616,"Driver.Packet":1.692,"Graphics.Draw":1.347,"Graphics.Draw.draw_and_resource_release":1.196,"Driver.Packet.draw":1.184,"Driver.Draw":1.164,"VideoOut.Flip.present":0.965},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-2116.json.gz"}
tools/performance_compare.py --require-matching-context M1 against P1

Performance comparison

Capture Commit Trace Presents Window (ms)
baseline 91ecd2d974 aps5-trace-91ecd2d9743b-14216.json.gz 4139 70003.123
candidate 1b0577cc92 aps5-trace-1b0577cc927b-8828.json.gz 4159 70003.079
  • 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.
  • Worker busy changes are percentage points; change (%) is relative to the baseline. Workers are matched by their recorded names; a missing worker is unreported, not idle.

Frame and GPU times (ms)

Metric Baseline Candidate Change Change (%)
frame_ms.p50 16.683 16.683 +0.000 +0.000
frame_ms.p90 16.910 16.910 +0.000 +0.000
frame_ms.p99 17.428 17.433 +0.005 +0.029
frame_ms.max 126.883 92.502 -34.381 -27.097
mean_frame_ms 16.913 16.832 -0.081 -0.481
gpu_busy_ms_per_present 6.837 6.831 -0.006 -0.088

Top phases (ms per frame)

Metric Baseline Candidate Change Change (%)
Driver.Draw 1.183 1.148 -0.035 -2.959
Driver.Packet 1.775 1.682 -0.093 -5.239
Driver.Packet.draw 1.203 1.167 -0.036 -2.993
Graphics.Draw 1.429 1.342 -0.087 -6.088
Graphics.Draw.draw_and_resource_release 1.269 1.191 -0.078 -6.147
VideoOut.Flip 13.645 13.686 +0.041 +0.300
VideoOut.Flip.present 0.935 0.929 -0.006 -0.642
VideoOut.Flip.vblank_wait 12.619 12.650 +0.031 +0.246

Worker busy time (%)

Metric Baseline Candidate Change (pp) Change (%)
queue worker 0x0 10.513 10.011 -0.502 -4.775
tools/trace_digest.py of the M1 trace

seconds 60:70 from present 3572: 4139 presents, frame p50 16.7 / p90 16.9 / p99 17.4 / max 126.9 ms, GPU busy 6.8 ms per present
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit 91ecd2d974, dropped: no

{"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.123},"presents":4139,"frame_ms":{"p50":16.683,"p90":16.91,"p99":17.428,"max":126.883},"gpu_busy_ms_per_present":6.837,"worker_busy_pct":{"queue worker 0x0":10.513},"top_phases_ms_per_frame":{"VideoOut.Flip":13.645,"VideoOut.Flip.vblank_wait":12.619,"Driver.Packet":1.775,"Graphics.Draw":1.429,"Graphics.Draw.draw_and_resource_release":1.269,"Driver.Packet.draw":1.203,"Driver.Draw":1.183,"VideoOut.Flip.present":0.935},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-14216.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 4142: 126.9 ms at 9509 ms: Driver.Packet (queue worker 0x0) 90.0, Graphics.Draw (draw committer) 89.5, Graphics.Draw.draw_and_resource_release (draw committer) 89.4, Driver.Packet.pipeline_drain (queue worker 0x0) 89.0
  • present 5362: 111.4 ms at 30213 ms: Driver.WorkerWait (queue worker 0x0) 67.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 67.3, Driver.Packet (queue worker 0x0) 43.1, Graphics.Draw (draw committer) 42.8
  • present 4544: 105.3 ms at 16367 ms: Driver.WorkerWait (queue worker 0x0) 57.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 57.6, Driver.Packet (queue worker 0x0) 46.6, Graphics.Draw (draw committer) 46.2
  • present 6190: 103.4 ms at 44261 ms: Driver.WorkerWait (queue worker 0x0) 59.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 59.5, Driver.Packet (queue worker 0x0) 42.9, Graphics.Draw (draw committer) 42.7
  • present 7017: 103.3 ms at 58291 ms: Driver.WorkerWait (queue worker 0x0) 57.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 57.0, Driver.Packet (queue worker 0x0) 45.3, Graphics.Draw (draw committer) 44.6

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 16.9 0.6 Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0
queue worker 0x0 1.0 (6 %) 15.1 (89 %) 0.9 2.9 Driver.Packet 1.0, Driver.Completion 0.0
draw committer 0.8 (5 %) 0.0 (0 %) 16.1 1.5 Graphics.Draw 0.7, Vulkan.DrawFromRecipe 0.1
presenter 0.8 (5 %) 12.9 (76 %) 3.3 0.0 VideoOut.Flip 13.6, Driver.Present 0.0
gpu 6.8 (40 %) 0.0 (0 %) 10.1 0.0 batch 6.8

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 15.1, Driver.WorkerWait.idle_and_completion_poll 15.1, VideoOut.Flip 13.6, VideoOut.Flip.vblank_wait 12.6, batch 6.8, Driver.Packet 1.0, VideoOut.Flip.present 0.9, Driver.Present 0.9, Graphics.Draw 0.7, Graphics.Draw.draw_and_resource_release 0.6

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 78.7 ms at 30202 ms, present 5361
  • Driver.WorkerWait (queue worker 0x0) 72.2 ms at 44248 ms, present 6189
  • Driver.WorkerWait (queue worker 0x0) 70.4 ms at 37274 ms, present 5779
  • Driver.WorkerWait (queue worker 0x0) 70.2 ms at 16354 ms, present 4543
  • Driver.WorkerWait (queue worker 0x0) 70.0 ms at 58278 ms, present 7016
  • Driver.WorkerWait (queue worker 0x0) 68.0 ms at 51322 ms, present 6605
  • Driver.WorkerWait (queue worker 0x0) 64.4 ms at 23294 ms, present 4952
  • Driver.WorkerWait (queue worker 0x0) 59.3 ms at 58427 ms, present 7018
  • Driver.WorkerWait (queue worker 0x0) 51.5 ms at 37422 ms, present 5781
  • Driver.WorkerWait (queue worker 0x0) 49.0 ms at 9496 ms, present 4141

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

  • batch 1142: 33.4 ms at 9636 ms, present 4143: GPU no ranges; recorded by Graphics.Draw (draw committer) 89.1, Graphics.Draw.draw_and_resource_release (draw committer) 89.1, Resources.Complete (draw committer) 23.6, Resources.Prepare (draw committer) 1.2
  • batch 6892: 28.2 ms at 58395 ms, present 7018: GPU no ranges; recorded by Graphics.Draw (draw committer) 44.3, Graphics.Draw.draw_and_resource_release (draw committer) 44.2, Resources.Prepare (draw committer) 0.0
  • batch 4418: 27.9 ms at 37389 ms, present 5781: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.7, Graphics.Draw.draw_and_resource_release (draw committer) 42.6, Resources.Prepare (draw committer) 0.0
  • batch 3582: 27.7 ms at 30325 ms, present 5363: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.2, Graphics.Draw.draw_and_resource_release (draw committer) 42.1, Graphics.Draw.vertex_upload (draw committer) 0.0
  • batch 6070: 27.6 ms at 51435 ms, present 6607: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.6, Graphics.Draw.draw_and_resource_release (draw committer) 42.5, Graphics.Draw.vertex_upload (draw committer) 0.0
tools/trace_digest.py of the P1 trace

seconds 60:70 from present 3575: 4159 presents, frame p50 16.7 / p90 16.9 / p99 17.4 / max 92.5 ms, GPU busy 6.8 ms per present
AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit 1b0577cc92, dropped: no

{"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3575,"ms":70003.079},"presents":4159,"frame_ms":{"p50":16.683,"p90":16.91,"p99":17.433,"max":92.502},"gpu_busy_ms_per_present":6.831,"worker_busy_pct":{"queue worker 0x0":10.011},"top_phases_ms_per_frame":{"VideoOut.Flip":13.686,"VideoOut.Flip.vblank_wait":12.65,"Driver.Packet":1.682,"Graphics.Draw":1.342,"Graphics.Draw.draw_and_resource_release":1.191,"Driver.Packet.draw":1.167,"Driver.Draw":1.148,"VideoOut.Flip.present":0.929},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-8828.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 4144: 92.5 ms at 9493 ms: Driver.Packet (queue worker 0x0) 55.2, Graphics.Draw (draw committer) 55.1, Graphics.Draw.draw_and_resource_release (draw committer) 55.0, Driver.Packet.pipeline_drain (queue worker 0x0) 54.5
  • present 5373: 81.8 ms at 30263 ms: Driver.WorkerWait (queue worker 0x0) 64.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 64.2, Driver.Packet (queue worker 0x0) 16.7, Graphics.Draw (draw committer) 16.3
  • present 6203: 78.7 ms at 44261 ms: Driver.WorkerWait (queue worker 0x0) 60.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.4, Driver.Packet (queue worker 0x0) 17.4, Graphics.Draw (draw committer) 16.9
  • present 5786: 78.3 ms at 37237 ms: Driver.WorkerWait (queue worker 0x0) 60.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.2, Driver.Packet (queue worker 0x0) 17.0, Graphics.Draw (draw committer) 16.8
  • present 7036: 77.6 ms at 58291 ms: Driver.WorkerWait (queue worker 0x0) 60.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.0, Driver.Packet (queue worker 0x0) 16.7, Graphics.Draw (draw committer) 16.4

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
title 0.0 (0 %) 0.0 (0 %) 16.8 0.6 Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0
queue worker 0x0 0.9 (5 %) 15.1 (90 %) 0.9 2.8 Driver.Packet 0.9, Driver.Completion 0.0
draw committer 0.8 (5 %) 0.0 (0 %) 16.0 1.5 Graphics.Draw 0.7, Vulkan.DrawFromRecipe 0.1
presenter 0.8 (5 %) 12.9 (77 %) 3.1 0.0 VideoOut.Flip 13.7, Driver.Present 0.0
gpu 6.8 (41 %) 0.0 (0 %) 10.0 0.0 batch 6.8

Largest slices (ms per frame, inclusive, all threads): Driver.WorkerWait 15.1, Driver.WorkerWait.idle_and_completion_poll 15.1, VideoOut.Flip 13.7, VideoOut.Flip.vblank_wait 12.7, batch 6.8, VideoOut.Flip.present 0.9, Driver.Present 0.9, Driver.Packet 0.9, Graphics.Draw 0.7, Driver.Packet.draw 0.6

Longest waits

  • Driver.WorkerWait (queue worker 0x0) 77.0 ms at 30251 ms, present 5372
  • Driver.WorkerWait (queue worker 0x0) 73.5 ms at 37224 ms, present 5785
  • Driver.WorkerWait (queue worker 0x0) 73.0 ms at 58278 ms, present 7035
  • Driver.WorkerWait (queue worker 0x0) 72.8 ms at 44248 ms, present 6202
  • Driver.WorkerWait (queue worker 0x0) 71.2 ms at 16371 ms, present 4550
  • Driver.WorkerWait (queue worker 0x0) 69.8 ms at 23310 ms, present 4961
  • Driver.WorkerWait (queue worker 0x0) 68.1 ms at 51339 ms, present 6623
  • Driver.WorkerWait (queue worker 0x0) 49.6 ms at 9479 ms, present 4143
  • Driver.WorkerWait (queue worker 0x0) 36.5 ms at 23399 ms, present 4963
  • Vulkan.Acquire.acquire_fence_wait (presenter) 34.0 ms at 23399 ms, present 4963

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

  • batch 2776: 34.7 ms at 23399 ms, present 4963: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.7, Graphics.Draw.draw_and_resource_release (draw committer) 16.7
  • batch 1140: 31.8 ms at 9585 ms, present 4145: GPU no ranges; recorded by Graphics.Draw (draw committer) 54.6, Graphics.Draw.draw_and_resource_release (draw committer) 54.6, Resources.Complete (draw committer) 10.1, Resources.Prepare (draw committer) 1.3
  • batch 6100: 28.2 ms at 51426 ms, present 6625: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.4, Graphics.Draw.draw_and_resource_release (draw committer) 16.3
  • batch 4424: 28.0 ms at 37315 ms, present 5787: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.2, Graphics.Draw.draw_and_resource_release (draw committer) 16.1
  • batch 5258: 27.9 ms at 44340 ms, present 6204: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.5, Graphics.Draw.draw_and_resource_release (draw committer) 16.4

Title, on the previous head: the same route, form and analysis, main 6a3afa4deb against 0386e61741 (this PR on 6a3afa4deb), legs M1, P1, M2, P2 on 2026-10-31 (UTC), two clean builds, no dropped trace events.

  • Over all turns of each arm (16 each), the committer span fell from 42.5 to 15.9 ms and the GPU batch was 29.1 and 29.4 ms. The page-turn frame median was 102.5 ms in both arms (main 92.8-262.5 ms, 0386e61741 68.1-228.8 ms).
  • Per leg, the page-turn frame medians were 99.4 and 117.0 ms for main, and 102.55 and 102.45 ms for 0386e61741.
  • Over the whole window, the frame p50 was the same in each of the 3 pairs, and the mean frame was 0.05-0.09 ms shorter with the change.
  • The slowest page turn of each leg of that pair took 218.7-262.5 ms, in both arms; I have not looked into why.
  • Traces of its four legs, each with its tools/trace_digest.py output: M1: trace, digest; P1: trace, digest; M2: trace, digest; P2: trace, digest. They hold the same kinds of data as the traces above, and I checked them the same way.
Title, on an earlier revision: main 5fa2520ad9 against 85f41ae08d (not current-main numbers)

Title, on an earlier revision: the same route and analysis. These legs compare main 5fa2520ad9 with 85f41ae08d, which is this change on 5fa2520ad9. They are not current-main numbers.

  • 150 s legs of main 5fa2520ad9 (M) and of 85f41ae08d (S), in the order M1, S1, two legs of a local build that also has the detile change from Why, S2, M2, and later M3, S3. 85f41ae08d is pushed as thuanquang:perf/snapshot-staging-upload-measured. Outside tests/Recorder.cpp, its changed lines against 5fa2520ad9 are the same as 0386e61741's against 6a3afa4deb.
  • M2 is void and left out: a demanding game was not running when it started and was running when it ended.
  • The GPU and build locks were held for every leg, so none of my other builds or GPU jobs ran during one. Before and after each leg a check found no demanding game running, except after M2. League of Legends may have been running; the check does not count it.
  • Each leg set only APS5_TRACE_SECONDS=60:70 and the pad input variables. Only libSceAgcDriver.prx differed between legs, checked by hash. Each leg started the title anew in the same run folder, whose shader cache was copied from an earlier run before M1 and kept between legs.

Per leg, 8 page turns each (ms; medians over the turns of the leg):

Leg Page-turn frame median Range Longest committer span Longest GPU batch Window p99 Window max
M1 (main 5fa2520ad9) 111.8 107.2-143.3 43.4 35.8 18.763 143.273
M3 (main 5fa2520ad9) 123.5 107.3-157.8 48.8 37.3 17.352 157.814
S1 (85f41ae08d) 74.7 66.4-97.2 10.4 28.5 17.373 97.168
S2 (85f41ae08d) 73.3 66.8-102.3 10.0 31.8 17.308 102.327
S3 (85f41ae08d) 76.0 63.5-103.3 9.3 31.2 17.241 103.336

All turns of each arm: main 5fa2520ad9 122.6 ms median (107.2-157.8, 16 turns), committer span 46.5 ms, GPU batch 36.1 ms; 85f41ae08d 75.3 ms median (63.5-103.3, 24 turns), committer span 9.9 ms, GPU batch 30.9 ms. Every page turn still drops frames with the change.

Traces of M1, M3, S1 and S3, as CONTRIBUTING asks (S2's trace is not attached): M1: trace, digest; M3: trace, digest; S1: trace, digest; S3: trace, digest. They hold only AnyPS5's scope and thread names, timings, batch ids and present numbers; I checked each for anything from the title. Each digest is the tools/trace_digest.py output of its trace.

Summary lines of M1 (main 5fa2520ad9) and S1 (85f41ae08d)
{"commit":"5fa2520ad95e","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3552,"ms":70003.173},"presents":4126,"frame_ms":{"p50":16.683,"p90":16.914,"p99":18.763,"max":143.273},"gpu_busy_ms_per_present":8.634,"worker_busy_pct":{"queue worker 0x0":14.159},"top_phases_ms_per_frame":{"VideoOut.Flip":12.819,"VideoOut.Flip.vblank_wait":11.509,"Driver.Packet":2.397,"Graphics.Draw":1.905,"Driver.Packet.draw":1.696,"Driver.Draw":1.663,"Graphics.Draw.draw_and_resource_release":1.549,"Driver.Draw.draw_enqueued":1.001},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":42.045,"events_lost":162856,"totals_full":false}},"trace":"aps5-trace-5fa2520ad95e-7364.json.gz"}
{"commit":"85f41ae08dbc","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3573,"ms":70003.273},"presents":4157,"frame_ms":{"p50":16.684,"p90":16.910,"p99":17.373,"max":97.168},"gpu_busy_ms_per_present":8.044,"worker_busy_pct":{"queue worker 0x0":11.491},"top_phases_ms_per_frame":{"VideoOut.Flip":13.362,"VideoOut.Flip.vblank_wait":12.380,"Driver.Packet":1.931,"Graphics.Draw":1.539,"Driver.Packet.draw":1.390,"Driver.Draw":1.363,"Graphics.Draw.draw_and_resource_release":1.239,"Driver.Draw.draw_enqueued":0.808},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":57.427,"events_lost":57660,"totals_full":false}},"trace":"aps5-trace-85f41ae08dbc-27224.json.gz"}

In that pair, every leg's trace dropped events of the queue worker thread (trace_dropped), as its M1 and S1 lines show (M3, S2 and S3 likewise); the page-turn analysis reads presents, draw-committer spans and GPU batches. M3 also dropped draw-committer events from 61.4 s into its window, after its last page turn (58.0 s into the window).

tools/performance_compare.py M1 against S1

Performance comparison

Capture Commit Trace Presents Window (ms)
baseline 5fa2520ad9 aps5-trace-5fa2520ad95e-7364.json.gz 4126 70003.173
candidate 85f41ae08dbc aps5-trace-85f41ae08dbc-27224.json.gz 4157 70003.273
  • 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.
  • baseline: trace events were dropped; the event trace omits some of the work included in phase totals.
  • candidate: trace events were dropped; the event trace omits some of the work included in phase totals.

Configuration differences

Setting Baseline Candidate
window.first_present 3552 3573

Frame and GPU times (ms)

Metric Baseline Candidate Change Change (%)
frame_ms.p50 16.683 16.684 +0.001 +0.006
frame_ms.p90 16.914 16.910 -0.004 -0.024
frame_ms.p99 18.763 17.373 -1.390 -7.408
frame_ms.max 143.273 97.168 -46.105 -32.180
mean_frame_ms 16.966 16.840 -0.126 -0.746
gpu_busy_ms_per_present 8.634 8.044 -0.590 -6.833

Top phases (ms per frame)

Metric Baseline Candidate Change Change (%)
Driver.Draw 1.663 1.363 -0.300 -18.040
Driver.Draw.draw_enqueued 1.001 0.808 -0.193 -19.281
Driver.Packet 2.397 1.931 -0.466 -19.441
Driver.Packet.draw 1.696 1.390 -0.306 -18.042
Graphics.Draw 1.905 1.539 -0.366 -19.213
Graphics.Draw.draw_and_resource_release 1.549 1.239 -0.310 -20.013
VideoOut.Flip 12.819 13.362 +0.543 +4.236
VideoOut.Flip.vblank_wait 11.509 12.380 +0.871 +7.568

The only recorded configuration difference is window.first_present (3552 against 3573), the present at which each window opened.

tools/check_conventions.py and git diff --check pass against 4f41f4c375.

Not tested:

  • the full test suite on this head;
  • the title on main 4f41f4c375 (the page-turn pair is on 1b0577cc92 and 91ecd2d974);
  • Linux by me: my WSL lavapipe build skips agc_snapshot_read_into_staging, since WSL gives it no write watch (XairRrR's lavapipe run of e9b72ae83a ran every row, see GPUs tested);
  • other GPUs on this head (the runs from this thread are on e9b72ae83a or earlier), and other titles;
  • the 1D-array row on main's production files on its own: there the test stops at the linear row first, so control (b) is that row's check;
  • control (b) more than once;
  • this PR together with #10064 or #7085.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#10773, the agreed prerequisite, merged first on 2026-11-02 as 88a4bed5d3; this head contains it)
  • Fixes: none
  • Unblocks: PPSA14363 #9615 (Screenplay Book page-turn frames, not a stop)
  • GPUs tested: AMD Radeon RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.16010, Windows 11 26200, on head ac57b02043 (tests) and 1b0577cc92 (page-turn pair). From this thread, on e9b72ae83a: by TechLevelZero's NVIDIA run, merged onto main f6232fc (0 new failures, no new validation IDs against main; the new test was validated but not compared), NVIDIA RTX 2000 Ada Generation (driver 595.99.02), Ubuntu 26.04.1 (comment); by XairRrR, merged onto main 4f41f4c375 (20 related tests, negative control red), lavapipe (Mesa 26.1.6, LLVM 19), Debian 13 (review). On 52a861028e: by ycbuzi, merged onto main 2e1c72239b (the 17 snapshot tests, 2 runs each, negative control red), NVIDIA GeForce RTX 4070 SUPER and GTX 1650 SUPER (NVIDIA 616.92) and AMD Radeon RDNA2 iGPU 1002:164e (AMD 32.0.21030.2001), Windows 11 26200 (comment); by NFSS10 (14 related tests with the validation layer), AMD Radeon RX 7900 GRE, AMD 25.6.1, Windows 10.0.22631 (comment); by Bram910, cherry-picked onto a local integration (7 tests with the validation layer, negative control red), NVIDIA GeForce RTX 3080, Windows driver 32.0.16.1047, Windows 11 26200 (comment)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4973730962 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9884). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-22T20:32:45Z. --- ### What This reopens the change I closed on 2026-10-23 in favour of #8026. It is now rebased past #8026 and keeps #8026's spare pool for the snapshots that still use a vector. Since #6982, a sampled snapshot of a tracked or hinted surface over 256 KiB keeps no bytes after its upload, and since #8026 its vector then goes to a spare pool. To build one, `cachedTexture` does three things on `main` `91ecd2d974`: - it takes a vector of the surface size from that pool, or allocates and zero-fills a new one (`ShaderResources.cpp:1081-1082`); - it reads the guest surface into the vector (`:1117`); - the `Texture` copies the vector into a pooled staging `Buffer` (`Texture.cpp:489-490`). The vector is parked afterwards (`ShaderResources.cpp:1128`). With `Uncompressed` keys, such a snapshot is now read straight into the staging `Buffer`: - **`ShaderResources.cpp`, `cachedTexture`:** - The drop test runs before the read, on the same inputs as `main`'s drop after the upload: over 256 KiB, and either `entry.generation != 0` (the snapshot generation) or the untracked-memory hint when no write is pending. - A dropped `Uncompressed` snapshot gets a pooled host-visible `Buffer` (`TRANSFER_SRC`). `ReadTextureSurface` fills it, and the texture is built from it. - It takes nothing from the spare pool and parks nothing of its own. If the entry it replaces kept a vector, that vector goes to the pool. - It still runs the pool's expiry, so a spare unused for more than 16 presents is released at the next snapshot, as on `main`. The expiry loop moves into `expireSpareSnapshots`, which `parkSnapshot` and `spareSnapshot` now call too. - The staging path passes #12246's `layerRows` as the vector path does, so a dropped snapshot of a 1D array past `maxImageArrayLayers` is still laid out as rows of a 2D image. - Kept snapshots and snapshots with other keys (DCC clear keys, `ClearSingle`) keep the vector and the pool. A surface that `main` clears on the GPU (#13648) keeps no snapshot, as before, and still parks the vector of the entry it replaces. The uncached path (`APS5_NO_TEXTURE_CACHE`) is unchanged. - **`Texture.cpp` (declared in `Texture.hpp`):** the span constructor and a new constructor that takes the staging `Buffer` as a `std::shared_ptr` (with `depthCompare` and `layerRows`) both delegate to one private constructor. It allocates a staging `Buffer` and copies the span into it only when none was handed in. The rest of the upload is `main`'s: since #10773, with a recorder, it copies the staging `Buffer` into the batch's tiled upload scratch and keeps the `Buffer` with the batch (`Texture.cpp:513-526` on this head). For a dropped `Uncompressed` snapshot, this removes the vector allocation, its zero-fill and the surface-sized memcpy. The staging `Buffer` goes back to the `BufferPool` when the recorder releases it, as on `main`. A reused pooled `Buffer` still holds earlier bytes, so this relies on `ReadTextureSurface` writing every byte for `Uncompressed` keys. `GuestMemory::ReadCommitted` does: it copies the whole range when it is accessible, and otherwise zero-fills the range and copies the committed parts (`copyCommitted`, `GuestMemory.cpp:2927-2934` on `91ecd2d974`, which `ReadCommitted` calls at :2944). On Windows, since #10575, each of those copies is a `ReadProcessMemory` read. If it fails because a page is not readable, the copy goes page by page and zero-fills every page it cannot read; since #10498, a short read or any other read error throws, and nothing is uploaded from that `Buffer` (`readPages`, `visitReadablePages` and `copyCommittedBytes`, :2867-2905). #8026 relies on the same contract for reused vectors, and on `91ecd2d974`, `DepthSurface.cpp:1603` already reads with `ReadCommitted` straight into a pooled `Buffer`. **Changes since the close** (old head `388daf981f`): - Rebased past #8026, with the pool handling above. - #8026's `recycleTests` and `spareAgeTests` (`tests/execution/SampledCacheBudget.cpp`) made their spare with a dropped `Uncompressed` snapshot, which no longer parks one. They now park it through a fast-cleared BC5 snapshot (1024x1024, 0000 keys, 1 MiB), a producer that still does, and check the same counts. - The 8_8_8_8 and 32 uint surfaces they used before no longer work: since #13648, `main` clears them on the GPU and keeps no snapshot. `SampledClearColor` refuses block-compressed formats, so a BC5 surface stays a snapshot. - These rows need BC support. Without it they print a "not tested" line. - As NFSS10 noted, they rely on clear keys staying on the vector path: if the staging path is ever widened to clear keys, they need another producer. - `agc_snapshot_staging_upload` is replaced by `agc_snapshot_read_into_staging` (see Tested). **Overlap:** - **#10064** (draft) builds a partially committed sampled 3D view from its committed slabs. - It changes the same snapshot read in `cachedTexture` and the same staging setup in `Texture`'s constructor, so the two conflict in `Texture.hpp`, `ShaderResources.cpp` and `Texture.cpp`. - Merge order (agreed with EagleBearerYS; the one #10064 had with #10845, closed as a duplicate of this PR): this PR first, then #10064. - EagleBearerYS takes the merge on #10064's side: a packed-slab snapshot is not the surface's layout and stays on the vector path (a `!slabs.has_value()` term on the condition that picks the staging buffer), and `packedSlabs` is forwarded into the staging constructor ([comment](https://github.com/boykopovar/AnyPS5/pull/9884#issuecomment-6413601680)). - **#10773** (fma-rc) merged first, on 2026-11-02 (`88a4bed5d3`), as agreed with fma-rc. It replaced the upload's per-upload tiled and linear `DeviceBuffer`s with a per-batch scratch, in the block of `Texture.cpp` where this PR makes the staging buffer only when none was passed in. The two complement each other: #10773 changed the device buffers the upload copies and detiles through, this PR how the host staging `Buffer` is filled. The merge of `main` `a4eca2a056` keeps #10773's lines as they are and puts this PR's staging block after its `syncUploads` and `recorder` lines. - **#7085** (Amoenus) adds a mip-level report right after the snapshot size check that this PR changes to check the staging buffer. Merge order (agreed with Amoenus): this PR before #10064 before #7085; the resolution keeps both lines. ### Why PPSA14363 (METAL GEAR SOLID - Master Collection Version): in my runs of a timing build on `main` `379b1dca32` (below), each page turn in the launcher's Screenplay Book sampled a new snapshot of a 15360x8640 R8 linear surface (126.6 MiB), which was dropped after its upload. I have not checked the snapshot itself again on a current build; the page-turn pair on this head is under Tested. #8026 releases a spare once it has gone unused for more than 16 presents, and page turns come seconds apart (7 s in my scripted route, about 400 presents). So in my runs, `main` allocated and zero-filled a new 126.6 MiB vector on every turn, read the surface into it and copied it into the staging buffer. The same holds for any dropped `Uncompressed` snapshot: it always pays the memcpy, and it pays the allocation and zero-fill whenever no spare of its size was parked in the last 16 presents. I measured this with a local timing build on `main` `379b1dca32`, which has #8026 (timing probes, not in this PR; run with `APS5_PROFILE_DRAW=1` and `APS5_TRACE_SUMMARY_EVERY=10`; it also carried a local change of mine, not part of any PR, that uploads a linear snapshot without the identity detile and changes only the steps after the memcpy). Two runs, each opening the book and turning 8 pages: none of the 18 snapshot builds took a vector from the pool. Per page turn (16 turns, Ryzen 5 5600X): | Step | Range | Median | |---|---|---| | vector allocation and zero-fill | 17.4-31.1 ms | 23.5 ms | | guest read (`ReadTextureSurface`) | 7.1-14.6 ms | 9.2 ms | | memcpy into the staging `Buffer` | 6.6-15.1 ms | 8.7 ms | This PR removes the first and the last step, which took 24.1-46.2 ms per turn together (median 31.6 ms); the read stays. Keeping spares longer would avoid only the allocation and zero-fill, by holding 126.6 MiB of host memory between turns, and would keep the memcpy. The page-turn frame times of `main` and of this head are under Tested. ### Tested Head `ac57b02043` on `main` `4f41f4c375` (2026-11-03). RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.16010, Windows 11 26200, WinLibs GCC 15.2.0 r7 Release, `ANYPS5_REQUIRE_VULKAN=1`. **Integration** since `0386e61741`, the head of the earlier results: - `491ffaa5a6` and `6a54ad1a07` merge `main` `dc9dc7eaae` and `f2d874c1fd`. The first resolves the conflicts with #13648, which clears fast-cleared sampled textures on the GPU through a new `clear` parameter of the snapshot constructor, and moves the test registration into `tests/cmake/agc_driver_recorder_tests.cmake` (#12862). - `181f0ab5e7` moves the spare-pool producers to BC5 surfaces (see What) and adds a guard row for the GPU-clear park (below). - `38f795a674` merges `main` `a4eca2a056`. #12246 conflicts in `Texture.hpp`, `Texture.cpp` and `ShaderResources.cpp`, and #10773 in `Texture.cpp`. The resolution is described in What and under Overlap. - `e9b72ae83a` adds the 1D-array row (below). On `a4eca2a056` it also passed 42 related tests in each of 3 runs (that selection missed #10773's `agc_recorder_upload_scratch`), and a validation-layer run with no `VUID-` line. - `1b0577cc92` merges `main` `91ecd2d974` without conflicts; the page-turn pair below ran on it. Since `a4eca2a056`, #8963, #6185, #14891, #12158 and #12980 changed five of this PR's six files. The head's changed lines against `91ecd2d974` are the same as `e9b72ae83a`'s against `a4eca2a056` (six files, 380+/34-). - `ac57b02043` merges `main` `4f41f4c375` (2026-11-03 08:12 UTC) without conflicts. That `main` is 240 commits past `91ecd2d974`: 50 merges, all within five minutes after it. The head's changed lines against `4f41f4c375` are the same as `1b0577cc92`'s against `91ecd2d974`, and its tree (`e7a000f88c`) is the one `git merge-tree` gives for `e9b72ae83a` merged with `4f41f4c375`, the merge XairRrR's lavapipe review ran (every row of `agc_snapshot_read_into_staging` passed there, and the negative control failed; see GPUs tested). - #10000, #10556, #14302 and #14311 changed this PR's production files, all outside `cachedTexture`, the spare pool and the snapshot `Texture` constructors and upload: `StorageTexture`, and the sampler masks and null-descriptor checks of `ShaderResources.cpp`. #6905 and #14302 also add tests to `agc_driver_recorder_tests` (`tests/Recorder.cpp` and its registrations), the binary that runs `agc_snapshot_read_into_staging`. - #6905 also changes the detile shader that the snapshot upload dispatches (`TextureDetile.comp`, `TextureDetiler.cpp`): for 1- and 2-byte texels, such as the page surface's R8, it now stores whole words, in both arms. It does not touch the vector allocation, the zero-fill or the memcpy this PR removes. The page-turn pair below ran on `1b0577cc92` and `91ecd2d974`, before it; page-turn and GPU-batch times on `4f41f4c375` may differ in both arms. **New test:** `agc_snapshot_read_into_staging` (`agc_driver_recorder_tests --snapshot-read-into-staging-only`) samples through `CachedSampledTexture` on write-watched guest allocations. On the head, in the validation-layer run (`ctest -V`), every row below printed `passed` and none printed `not tested`. The test took 0.21-1.59 s in the three plain runs; its CTest `TIMEOUT` is 30 s. - **GPU-clear guard** (`181f0ab5e7`, needs no BC): - An uncompressed 256 KiB 8_8_8_8 snapshot keeps its vector. Once its keys read 1111, the GPU clear that replaces it must park that vector in the spare pool. - A new 1111 surface of the same size, cleared on the GPU 16 presents later, must leave that spare alone, and the next snapshot, one present later, releases it. - The row also passes on `main`'s production files. - **Dropped snapshots** of four surfaces: a linear 512x512 one, a 64KB_R_X one, a padded linear 600x300 one (rows of 640 texels), and a three-level linear one whose level-1 centre pages are not committed, with committed levels stored before and after them. - Before each, a pooled staging `Buffer` of the surface's size is filled with 0xee and returned to the pool. - Each snapshot must leave the spare pool empty. - It must upload from that reused `Buffer`: a probe `Buffer` of that size must not get it back. - It must sample the guest bytes in every level, with zeros in the uncommitted pages. - It must be remade after a driver store of the bytes already there, since it kept none to compare. - **1D array laid out as rows** (`e9b72ae83a`, needs `nullDescriptor`): a watched linear 1D array of 8-texel 8_8_8_8 slices, bound as a 2D image through `ShaderResources`. - The row's own context caps `maxImageArrayLayers` at 2048. The RX 6700 XT reports 8192, which allows every array a T# can describe. - The array has 2049 slices (524,544 bytes), so `cachedTexture` drops its snapshot, and the texture lays it out as rows of a 2D image. - It must be a snapshot, not a storage view, park no vector, and sample the centre slice at the centre of the image. - **The pool** (BC5 producers, need BC): - A fast-cleared BC5 snapshot still parks its vector. - A dropped `Uncompressed` snapshot of the same size 16 presents later leaves that spare alone, and the next snapshot, one present later, releases it. - A dropped snapshot 16 presents after a spare was parked keeps the spare. One 17 presents after it releases the spare. - The ctest entry unsets `APS5_SYNC_TEXTURE_UPLOAD`, `APS5_DUMP_TEXTURE`, `APS5_NO_TEXTURE_CACHE` and the buffer pool switches (`APS5_BUFFER_POOL_SLOTS`, `APS5_BUFFER_POOL_SHARED`, `APS5_NO_BUFFER_CLASSES`, `APS5_STAGING_POOL_MIB`). Each of them changes how a snapshot uploads or which `Buffer` the pool hands out. - **Negative control (a), `main`'s production files:** this head with `Texture.hpp`, `ShaderResources.cpp` and `Texture.cpp` from `4f41f4c375` fails in 4 of 4 runs (3 plain, 1 with the validation layer): `AGC graphics: the dropped snapshot of the linear surface parked a vector in the spare pool`. The head passes in 4 of 4 runs. With `main`'s files the test stops at that row, so the 1D-array row does not run there. - **Negative control (b), `layerRows` dropped from the staging path:** with `false` instead of `layerRows` in the staging `createTexture` call of `cachedTexture`, the test fails at the 1D-array row, after the four other dropped rows pass: `AGC graphics: a texture array with more layers than maxImageArrayLayers is not implemented` (1 run). With the file restored, the head passes again. **Related tests:** 45 tests, selected by name with `ctest -N -R 'detile_small_elements|recorder|snapshot|sampled_cache|partially_resident|recover_.*allocation|read_written_staging|staged_clear_sampled_read|sampled_storage_base_level_usage|buffer_pool|storage_cache_budget|clear_keys|sampled_clear'`. - They are the 41 of the earlier run (which include the 25 of the first one), plus `agc_driver_sampled_clear_keys` (the last two patterns are new), `agc_recorder_upload_scratch` (#10773), `agc_driver_sampled_cache_budget_report_age` (#14891) and `agc_detile_small_elements` (#6905, the detile shader the upload dispatches). - Among them: `agc_snapshot_read_into_staging`, `agc_driver_sampled_cache_budget`, `agc_driver_sampled_cache_budget_without_storage_image_multisample`, `agc_driver_sampled_cache_budget_memory`, `agc_driver_partially_resident_snapshot`, `agc_driver_large_tracked_snapshot`, `agc_driver_untracked_snapshot_hint` and the 4 `buffer_pool` tests. - The head passes 45 of 45 in each of 3 runs. `main`'s production files with these tests pass 44 of 45 in each of 3 runs; the only failure is `agc_snapshot_read_into_staging`, as above. **Validation layer:** the same 45 tests with `ctest -V`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan-ValidationLayers `vulkan-sdk-1.4.363.0`), `VK_LOADER_DEBUG=layer`, `VK_LOADER_LAYERS_DISABLE=~implicit~`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1`, on `main`'s production files with these tests and on the head. Each log shows the loader inserting `VK_LAYER_KHRONOS_validation` 35 times, once in each of the 35 tests that create a Vulkan instance (`agc_snapshot_read_into_staging` among them; the other 10 print no loader output). Neither log has `was not found but was requested`, a `VUID-` line or a `Validation Error`. Results as above: 44 of 45 and 45 of 45. **Title, on the previous head `1b0577cc92`** (the same changed lines as this head, on `main` `91ecd2d974`): PPSA14363, launcher → Screenplay Book, 8 page turns (R1) 7 s apart, scripted pad input. 150 s legs of `main` `91ecd2d9743b831b575d293e6c8fafbe737e1e88` (M) and of `1b0577cc927bdde256dc6a54697f9c57f2d340af` (P), two clean builds, in the order M1, P1, M2, P2 (2026-11-03). - Each arm runs in its own folder. One 150 s run of the same route warmed each folder's shader cache before M1, and no leg's log shows a shader disk cache miss. Each leg started the title anew, and each folder's `libSceAgcDriver.prx` was checked by hash against its build. - Each leg set only `APS5_TRACE_SECONDS=60:70` and the pad input variables. No leg's trace dropped events. - The GPU and build locks were held for every leg. Before each leg, a check found no build, test, other emulator run or other game running, then 30 s of quiet CPU. League of Legends may have been running; the check does not count it. - Per page turn, the analysis takes the longest present interval from 1 s before to 1.5 s after the press, the longest draw-committer span overlapping it, and the longest GPU batch overlapping it or starting within 50 ms after it. Per leg, 8 page turns each (ms; medians over the turns of the leg): | Leg | Page-turn frame median | Range | Longest committer span | Longest GPU batch | Window p99 | Window max | |---|---|---|---|---|---|---| | M1 (`main` `91ecd2d974`) | 103.35 | 96.3-126.9 | 42.1 | 27.65 | 17.428 | 126.883 | | P1 (`1b0577cc92`) | 77.95 | 74.4-92.5 | 15.7 | 27.95 | 17.433 | 92.502 | | M2 (`main` `91ecd2d974`) | 100.5 | 97.8-126.9 | 43.2 | 27.6 | 17.505 | 126.907 | | P2 (`1b0577cc92`) | 74.1 | 68.3-92.3 | 15.6 | 28.25 | 17.572 | 92.258 | All turns of each arm: `main` `91ecd2d974` 102.7 ms median (96.3-126.9, 16 turns), committer span 42.7 ms, GPU batch 27.6 ms; `1b0577cc92` 77.3 ms median (68.3-92.5, 16 turns), committer span 15.6 ms, GPU batch 28.2 ms. Every page turn still drops frames with the change. Over the whole 70 s window, in each of the 3 adjacent pairs (M1-P1, M2-P1, M2-P2), the frame p50 is the same (16.683 ms). With the change the mean frame is 0.07-0.08 ms shorter, there are 2.4-2.8 more presents per 10 s, and the GPU is busy 0.002-0.006 ms less per present. Traces of all four legs, each with its `tools/trace_digest.py` output, as CONTRIBUTING asks: M1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-91ecd2d9743b-14216.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-91ecd2d9743b-14216.md); P1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-1b0577cc927b-8828.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-1b0577cc927b-8828.md); M2: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-91ecd2d9743b-8032.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-91ecd2d9743b-8032.md); P2: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-1b0577cc927b-2116.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-1b0577cc927b-2116.md). They hold only AnyPS5's scope and thread names, timings, batch ids and present numbers; I checked each for anything from the title. Summary lines of the four legs (M1, P1, M2, P2): ```json {"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.123},"presents":4139,"frame_ms":{"p50":16.683,"p90":16.910,"p99":17.428,"max":126.883},"gpu_busy_ms_per_present":6.837,"worker_busy_pct":{"queue worker 0x0":10.513},"top_phases_ms_per_frame":{"VideoOut.Flip":13.645,"VideoOut.Flip.vblank_wait":12.619,"Driver.Packet":1.775,"Graphics.Draw":1.429,"Graphics.Draw.draw_and_resource_release":1.269,"Driver.Packet.draw":1.203,"Driver.Draw":1.183,"VideoOut.Flip.present":0.935},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-14216.json.gz"} {"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3575,"ms":70003.079},"presents":4159,"frame_ms":{"p50":16.683,"p90":16.910,"p99":17.433,"max":92.502},"gpu_busy_ms_per_present":6.831,"worker_busy_pct":{"queue worker 0x0":10.011},"top_phases_ms_per_frame":{"VideoOut.Flip":13.686,"VideoOut.Flip.vblank_wait":12.650,"Driver.Packet":1.682,"Graphics.Draw":1.342,"Graphics.Draw.draw_and_resource_release":1.191,"Driver.Packet.draw":1.167,"Driver.Draw":1.148,"VideoOut.Flip.present":0.929},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-8828.json.gz"} {"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.310},"presents":4140,"frame_ms":{"p50":16.683,"p90":16.909,"p99":17.505,"max":126.907},"gpu_busy_ms_per_present":6.833,"worker_busy_pct":{"queue worker 0x0":10.440},"top_phases_ms_per_frame":{"VideoOut.Flip":13.644,"VideoOut.Flip.vblank_wait":12.612,"Driver.Packet":1.762,"Graphics.Draw":1.413,"Graphics.Draw.draw_and_resource_release":1.260,"Driver.Packet.draw":1.195,"Driver.Draw":1.175,"VideoOut.Flip.present":0.939},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-8032.json.gz"} {"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3574,"ms":70003.066},"presents":4157,"frame_ms":{"p50":16.683,"p90":16.921,"p99":17.572,"max":92.258},"gpu_busy_ms_per_present":6.829,"worker_busy_pct":{"queue worker 0x0":10.067},"top_phases_ms_per_frame":{"VideoOut.Flip":13.663,"VideoOut.Flip.vblank_wait":12.616,"Driver.Packet":1.692,"Graphics.Draw":1.347,"Graphics.Draw.draw_and_resource_release":1.196,"Driver.Packet.draw":1.184,"Driver.Draw":1.164,"VideoOut.Flip.present":0.965},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-2116.json.gz"} ``` <details><summary><code>tools/performance_compare.py --require-matching-context</code> M1 against P1</summary> # Performance comparison | Capture | Commit | Trace | Presents | Window (ms) | | --- | --- | --- | ---: | ---: | | baseline | 91ecd2d9743b | aps5-trace-91ecd2d9743b-14216.json.gz | 4139 | 70003.123 | | candidate | 1b0577cc927b | aps5-trace-1b0577cc927b-8828.json.gz | 4159 | 70003.079 | - 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. - Worker busy changes are percentage points; change (%) is relative to the baseline. Workers are matched by their recorded names; a missing worker is unreported, not idle. ## Frame and GPU times (ms) | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | frame_ms.p50 | 16.683 | 16.683 | +0.000 | +0.000 | | frame_ms.p90 | 16.910 | 16.910 | +0.000 | +0.000 | | frame_ms.p99 | 17.428 | 17.433 | +0.005 | +0.029 | | frame_ms.max | 126.883 | 92.502 | -34.381 | -27.097 | | mean_frame_ms | 16.913 | 16.832 | -0.081 | -0.481 | | gpu_busy_ms_per_present | 6.837 | 6.831 | -0.006 | -0.088 | ## Top phases (ms per frame) | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | Driver.Draw | 1.183 | 1.148 | -0.035 | -2.959 | | Driver.Packet | 1.775 | 1.682 | -0.093 | -5.239 | | Driver.Packet.draw | 1.203 | 1.167 | -0.036 | -2.993 | | Graphics.Draw | 1.429 | 1.342 | -0.087 | -6.088 | | Graphics.Draw.draw_and_resource_release | 1.269 | 1.191 | -0.078 | -6.147 | | VideoOut.Flip | 13.645 | 13.686 | +0.041 | +0.300 | | VideoOut.Flip.present | 0.935 | 0.929 | -0.006 | -0.642 | | VideoOut.Flip.vblank_wait | 12.619 | 12.650 | +0.031 | +0.246 | ## Worker busy time (%) | Metric | Baseline | Candidate | Change (pp) | Change (%) | | --- | ---: | ---: | ---: | ---: | | queue worker 0x0 | 10.513 | 10.011 | -0.502 | -4.775 | </details> <details><summary><code>tools/trace_digest.py</code> of the M1 trace</summary> **seconds 60:70** from present 3572: 4139 presents, frame p50 16.7 / p90 16.9 / p99 17.4 / max 126.9 ms, GPU busy 6.8 ms per present AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit 91ecd2d9743b, dropped: no ```json {"commit":"91ecd2d9743b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3572,"ms":70003.123},"presents":4139,"frame_ms":{"p50":16.683,"p90":16.91,"p99":17.428,"max":126.883},"gpu_busy_ms_per_present":6.837,"worker_busy_pct":{"queue worker 0x0":10.513},"top_phases_ms_per_frame":{"VideoOut.Flip":13.645,"VideoOut.Flip.vblank_wait":12.619,"Driver.Packet":1.775,"Graphics.Draw":1.429,"Graphics.Draw.draw_and_resource_release":1.269,"Driver.Packet.draw":1.203,"Driver.Draw":1.183,"VideoOut.Flip.present":0.935},"trace_dropped":false,"trace":"aps5-trace-91ecd2d9743b-14216.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 4142: 126.9 ms at 9509 ms: Driver.Packet (queue worker 0x0) 90.0, Graphics.Draw (draw committer) 89.5, Graphics.Draw.draw_and_resource_release (draw committer) 89.4, Driver.Packet.pipeline_drain (queue worker 0x0) 89.0 - present 5362: 111.4 ms at 30213 ms: Driver.WorkerWait (queue worker 0x0) 67.3, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 67.3, Driver.Packet (queue worker 0x0) 43.1, Graphics.Draw (draw committer) 42.8 - present 4544: 105.3 ms at 16367 ms: Driver.WorkerWait (queue worker 0x0) 57.6, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 57.6, Driver.Packet (queue worker 0x0) 46.6, Graphics.Draw (draw committer) 46.2 - present 6190: 103.4 ms at 44261 ms: Driver.WorkerWait (queue worker 0x0) 59.5, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 59.5, Driver.Packet (queue worker 0x0) 42.9, Graphics.Draw (draw committer) 42.7 - present 7017: 103.3 ms at 58291 ms: Driver.WorkerWait (queue worker 0x0) 57.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 57.0, Driver.Packet (queue worker 0x0) 45.3, Graphics.Draw (draw committer) 44.6 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 16.9 | 0.6 | Shader.ResolveAbi 0.0, Shader.ResolveGraphicsStagesAbi 0.0 | | queue worker 0x0 | 1.0 (6 %) | 15.1 (89 %) | 0.9 | 2.9 | Driver.Packet 1.0, Driver.Completion 0.0 | | draw committer | 0.8 (5 %) | 0.0 (0 %) | 16.1 | 1.5 | Graphics.Draw 0.7, Vulkan.DrawFromRecipe 0.1 | | presenter | 0.8 (5 %) | 12.9 (76 %) | 3.3 | 0.0 | VideoOut.Flip 13.6, Driver.Present 0.0 | | gpu | 6.8 (40 %) | 0.0 (0 %) | 10.1 | 0.0 | batch 6.8 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 15.1, Driver.WorkerWait.idle_and_completion_poll 15.1, VideoOut.Flip 13.6, VideoOut.Flip.vblank_wait 12.6, batch 6.8, Driver.Packet 1.0, VideoOut.Flip.present 0.9, Driver.Present 0.9, Graphics.Draw 0.7, Graphics.Draw.draw_and_resource_release 0.6 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 78.7 ms at 30202 ms, present 5361 - Driver.WorkerWait (queue worker 0x0) 72.2 ms at 44248 ms, present 6189 - Driver.WorkerWait (queue worker 0x0) 70.4 ms at 37274 ms, present 5779 - Driver.WorkerWait (queue worker 0x0) 70.2 ms at 16354 ms, present 4543 - Driver.WorkerWait (queue worker 0x0) 70.0 ms at 58278 ms, present 7016 - Driver.WorkerWait (queue worker 0x0) 68.0 ms at 51322 ms, present 6605 - Driver.WorkerWait (queue worker 0x0) 64.4 ms at 23294 ms, present 4952 - Driver.WorkerWait (queue worker 0x0) 59.3 ms at 58427 ms, present 7018 - Driver.WorkerWait (queue worker 0x0) 51.5 ms at 37422 ms, present 5781 - Driver.WorkerWait (queue worker 0x0) 49.0 ms at 9496 ms, present 4141 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 1142: 33.4 ms at 9636 ms, present 4143: GPU no ranges; recorded by Graphics.Draw (draw committer) 89.1, Graphics.Draw.draw_and_resource_release (draw committer) 89.1, Resources.Complete (draw committer) 23.6, Resources.Prepare (draw committer) 1.2 - batch 6892: 28.2 ms at 58395 ms, present 7018: GPU no ranges; recorded by Graphics.Draw (draw committer) 44.3, Graphics.Draw.draw_and_resource_release (draw committer) 44.2, Resources.Prepare (draw committer) 0.0 - batch 4418: 27.9 ms at 37389 ms, present 5781: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.7, Graphics.Draw.draw_and_resource_release (draw committer) 42.6, Resources.Prepare (draw committer) 0.0 - batch 3582: 27.7 ms at 30325 ms, present 5363: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.2, Graphics.Draw.draw_and_resource_release (draw committer) 42.1, Graphics.Draw.vertex_upload (draw committer) 0.0 - batch 6070: 27.6 ms at 51435 ms, present 6607: GPU no ranges; recorded by Graphics.Draw (draw committer) 42.6, Graphics.Draw.draw_and_resource_release (draw committer) 42.5, Graphics.Draw.vertex_upload (draw committer) 0.0 </details> <details><summary><code>tools/trace_digest.py</code> of the P1 trace</summary> **seconds 60:70** from present 3575: 4159 presents, frame p50 16.7 / p90 16.9 / p99 17.4 / max 92.5 ms, GPU busy 6.8 ms per present AMD Radeon RX 6700 XT, AMD proprietary driver 26.10.1 (AMD proprietary shader compiler), Windows 10.0.26200, 1920x1080, commit 1b0577cc927b, dropped: no ```json {"commit":"1b0577cc927b","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3575,"ms":70003.079},"presents":4159,"frame_ms":{"p50":16.683,"p90":16.91,"p99":17.433,"max":92.502},"gpu_busy_ms_per_present":6.831,"worker_busy_pct":{"queue worker 0x0":10.011},"top_phases_ms_per_frame":{"VideoOut.Flip":13.686,"VideoOut.Flip.vblank_wait":12.65,"Driver.Packet":1.682,"Graphics.Draw":1.342,"Graphics.Draw.draw_and_resource_release":1.191,"Driver.Packet.draw":1.167,"Driver.Draw":1.148,"VideoOut.Flip.present":0.929},"trace_dropped":false,"trace":"aps5-trace-1b0577cc927b-8828.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 4144: 92.5 ms at 9493 ms: Driver.Packet (queue worker 0x0) 55.2, Graphics.Draw (draw committer) 55.1, Graphics.Draw.draw_and_resource_release (draw committer) 55.0, Driver.Packet.pipeline_drain (queue worker 0x0) 54.5 - present 5373: 81.8 ms at 30263 ms: Driver.WorkerWait (queue worker 0x0) 64.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 64.2, Driver.Packet (queue worker 0x0) 16.7, Graphics.Draw (draw committer) 16.3 - present 6203: 78.7 ms at 44261 ms: Driver.WorkerWait (queue worker 0x0) 60.4, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.4, Driver.Packet (queue worker 0x0) 17.4, Graphics.Draw (draw committer) 16.9 - present 5786: 78.3 ms at 37237 ms: Driver.WorkerWait (queue worker 0x0) 60.2, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.2, Driver.Packet (queue worker 0x0) 17.0, Graphics.Draw (draw committer) 16.8 - present 7036: 77.6 ms at 58291 ms: Driver.WorkerWait (queue worker 0x0) 60.0, Driver.WorkerWait.idle_and_completion_poll (queue worker 0x0) 60.0, Driver.Packet (queue worker 0x0) 16.7, Graphics.Draw (draw committer) 16.4 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | title | 0.0 (0 %) | 0.0 (0 %) | 16.8 | 0.6 | Shader.ResolveGraphicsStagesAbi 0.0, Shader.ResolveAbi 0.0 | | queue worker 0x0 | 0.9 (5 %) | 15.1 (90 %) | 0.9 | 2.8 | Driver.Packet 0.9, Driver.Completion 0.0 | | draw committer | 0.8 (5 %) | 0.0 (0 %) | 16.0 | 1.5 | Graphics.Draw 0.7, Vulkan.DrawFromRecipe 0.1 | | presenter | 0.8 (5 %) | 12.9 (77 %) | 3.1 | 0.0 | VideoOut.Flip 13.7, Driver.Present 0.0 | | gpu | 6.8 (41 %) | 0.0 (0 %) | 10.0 | 0.0 | batch 6.8 | **Largest slices** (ms per frame, inclusive, all threads): Driver.WorkerWait 15.1, Driver.WorkerWait.idle_and_completion_poll 15.1, VideoOut.Flip 13.7, VideoOut.Flip.vblank_wait 12.7, batch 6.8, VideoOut.Flip.present 0.9, Driver.Present 0.9, Driver.Packet 0.9, Graphics.Draw 0.7, Driver.Packet.draw 0.6 **Longest waits** - Driver.WorkerWait (queue worker 0x0) 77.0 ms at 30251 ms, present 5372 - Driver.WorkerWait (queue worker 0x0) 73.5 ms at 37224 ms, present 5785 - Driver.WorkerWait (queue worker 0x0) 73.0 ms at 58278 ms, present 7035 - Driver.WorkerWait (queue worker 0x0) 72.8 ms at 44248 ms, present 6202 - Driver.WorkerWait (queue worker 0x0) 71.2 ms at 16371 ms, present 4550 - Driver.WorkerWait (queue worker 0x0) 69.8 ms at 23310 ms, present 4961 - Driver.WorkerWait (queue worker 0x0) 68.1 ms at 51339 ms, present 6623 - Driver.WorkerWait (queue worker 0x0) 49.6 ms at 9479 ms, present 4143 - Driver.WorkerWait (queue worker 0x0) 36.5 ms at 23399 ms, present 4963 - Vulkan.Acquire.acquire_fence_wait (presenter) 34.0 ms at 23399 ms, present 4963 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 2776: 34.7 ms at 23399 ms, present 4963: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.7, Graphics.Draw.draw_and_resource_release (draw committer) 16.7 - batch 1140: 31.8 ms at 9585 ms, present 4145: GPU no ranges; recorded by Graphics.Draw (draw committer) 54.6, Graphics.Draw.draw_and_resource_release (draw committer) 54.6, Resources.Complete (draw committer) 10.1, Resources.Prepare (draw committer) 1.3 - batch 6100: 28.2 ms at 51426 ms, present 6625: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.4, Graphics.Draw.draw_and_resource_release (draw committer) 16.3 - batch 4424: 28.0 ms at 37315 ms, present 5787: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.2, Graphics.Draw.draw_and_resource_release (draw committer) 16.1 - batch 5258: 27.9 ms at 44340 ms, present 6204: GPU no ranges; recorded by Graphics.Draw (draw committer) 16.5, Graphics.Draw.draw_and_resource_release (draw committer) 16.4 </details> **Title, on the previous head:** the same route, form and analysis, `main` `6a3afa4deb` against `0386e61741` (this PR on `6a3afa4deb`), legs M1, P1, M2, P2 on 2026-10-31 (UTC), two clean builds, no dropped trace events. - Over all turns of each arm (16 each), the committer span fell from 42.5 to 15.9 ms and the GPU batch was 29.1 and 29.4 ms. The page-turn frame median was 102.5 ms in both arms (`main` 92.8-262.5 ms, `0386e61741` 68.1-228.8 ms). - Per leg, the page-turn frame medians were 99.4 and 117.0 ms for `main`, and 102.55 and 102.45 ms for `0386e61741`. - Over the whole window, the frame p50 was the same in each of the 3 pairs, and the mean frame was 0.05-0.09 ms shorter with the change. - The slowest page turn of each leg of that pair took 218.7-262.5 ms, in both arms; I have not looked into why. - Traces of its four legs, each with its `tools/trace_digest.py` output: M1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-6a3afa4deb18-15484.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-6a3afa4deb18-15484.md); P1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-0386e61741f9-2536.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-0386e61741f9-2536.md); M2: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-6a3afa4deb18-8900.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-6a3afa4deb18-8900.md); P2: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-0386e61741f9-23892.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-0386e61741f9-23892.md). They hold the same kinds of data as the traces above, and I checked them the same way. <details><summary>Title, on an earlier revision: <code>main</code> <code>5fa2520ad9</code> against <code>85f41ae08d</code> (not current-<code>main</code> numbers)</summary> **Title, on an earlier revision:** the same route and analysis. These legs compare `main` `5fa2520ad9` with `85f41ae08d`, which is this change on `5fa2520ad9`. They are not current-`main` numbers. - 150 s legs of `main` `5fa2520ad9` (M) and of `85f41ae08d` (S), in the order M1, S1, two legs of a local build that also has the detile change from Why, S2, M2, and later M3, S3. `85f41ae08d` is pushed as `thuanquang:perf/snapshot-staging-upload-measured`. Outside `tests/Recorder.cpp`, its changed lines against `5fa2520ad9` are the same as `0386e61741`'s against `6a3afa4deb`. - M2 is void and left out: a demanding game was not running when it started and was running when it ended. - The GPU and build locks were held for every leg, so none of my other builds or GPU jobs ran during one. Before and after each leg a check found no demanding game running, except after M2. League of Legends may have been running; the check does not count it. - Each leg set only `APS5_TRACE_SECONDS=60:70` and the pad input variables. Only `libSceAgcDriver.prx` differed between legs, checked by hash. Each leg started the title anew in the same run folder, whose shader cache was copied from an earlier run before M1 and kept between legs. Per leg, 8 page turns each (ms; medians over the turns of the leg): | Leg | Page-turn frame median | Range | Longest committer span | Longest GPU batch | Window p99 | Window max | |---|---|---|---|---|---|---| | M1 (`main` `5fa2520ad9`) | 111.8 | 107.2-143.3 | 43.4 | 35.8 | 18.763 | 143.273 | | M3 (`main` `5fa2520ad9`) | 123.5 | 107.3-157.8 | 48.8 | 37.3 | 17.352 | 157.814 | | S1 (`85f41ae08d`) | 74.7 | 66.4-97.2 | 10.4 | 28.5 | 17.373 | 97.168 | | S2 (`85f41ae08d`) | 73.3 | 66.8-102.3 | 10.0 | 31.8 | 17.308 | 102.327 | | S3 (`85f41ae08d`) | 76.0 | 63.5-103.3 | 9.3 | 31.2 | 17.241 | 103.336 | All turns of each arm: `main` `5fa2520ad9` 122.6 ms median (107.2-157.8, 16 turns), committer span 46.5 ms, GPU batch 36.1 ms; `85f41ae08d` 75.3 ms median (63.5-103.3, 24 turns), committer span 9.9 ms, GPU batch 30.9 ms. Every page turn still drops frames with the change. Traces of M1, M3, S1 and S3, as CONTRIBUTING asks (S2's trace is not attached): M1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-5fa2520ad95e-7364.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-5fa2520ad95e-7364.md); M3: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-5fa2520ad95e-17252.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-5fa2520ad95e-17252.md); S1: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-85f41ae08dbc-27224.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-85f41ae08dbc-27224.md); S3: [trace](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/aps5-trace-85f41ae08dbc-25616.json.gz), [digest](https://github.com/thuanquang/AnyPS5/blob/evidence/9884-page-turn-traces/digest-aps5-trace-85f41ae08dbc-25616.md). They hold only AnyPS5's scope and thread names, timings, batch ids and present numbers; I checked each for anything from the title. Each digest is the `tools/trace_digest.py` output of its trace. <details><summary>Summary lines of M1 (<code>main</code> <code>5fa2520ad9</code>) and S1 (<code>85f41ae08d</code>)</summary> ```json {"commit":"5fa2520ad95e","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3552,"ms":70003.173},"presents":4126,"frame_ms":{"p50":16.683,"p90":16.914,"p99":18.763,"max":143.273},"gpu_busy_ms_per_present":8.634,"worker_busy_pct":{"queue worker 0x0":14.159},"top_phases_ms_per_frame":{"VideoOut.Flip":12.819,"VideoOut.Flip.vblank_wait":11.509,"Driver.Packet":2.397,"Graphics.Draw":1.905,"Driver.Packet.draw":1.696,"Driver.Draw":1.663,"Graphics.Draw.draw_and_resource_release":1.549,"Driver.Draw.draw_enqueued":1.001},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":42.045,"events_lost":162856,"totals_full":false}},"trace":"aps5-trace-5fa2520ad95e-7364.json.gz"} {"commit":"85f41ae08dbc","dirty":false,"env":{"APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_SECONDS":"60:70"},"gpu":"AMD Radeon RX 6700 XT","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26200","cpu":"AMD Ryzen 5 5600X 6-Core Processor","cpu_threads":12,"memory_mib":32690,"title_id":"PPSA14363","title":"METAL GEAR SOLID - Master Collection Version","content_version":"03.000.000","resolution":"1920x1080","window":{"spec":"seconds 60:70","first_present":3573,"ms":70003.273},"presents":4157,"frame_ms":{"p50":16.684,"p90":16.910,"p99":17.373,"max":97.168},"gpu_busy_ms_per_present":8.044,"worker_busy_pct":{"queue worker 0x0":11.491},"top_phases_ms_per_frame":{"VideoOut.Flip":13.362,"VideoOut.Flip.vblank_wait":12.380,"Driver.Packet":1.931,"Graphics.Draw":1.539,"Driver.Packet.draw":1.390,"Driver.Draw":1.363,"Graphics.Draw.draw_and_resource_release":1.239,"Driver.Draw.draw_enqueued":0.808},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":57.427,"events_lost":57660,"totals_full":false}},"trace":"aps5-trace-85f41ae08dbc-27224.json.gz"} ``` </details> In that pair, every leg's trace dropped events of the queue worker thread (`trace_dropped`), as its M1 and S1 lines show (M3, S2 and S3 likewise); the page-turn analysis reads presents, draw-committer spans and GPU batches. M3 also dropped draw-committer events from 61.4 s into its window, after its last page turn (58.0 s into the window). <details><summary><code>tools/performance_compare.py</code> M1 against S1</summary> # Performance comparison | Capture | Commit | Trace | Presents | Window (ms) | | --- | --- | --- | ---: | ---: | | baseline | 5fa2520ad95e | aps5-trace-5fa2520ad95e-7364.json.gz | 4126 | 70003.173 | | candidate | 85f41ae08dbc | aps5-trace-85f41ae08dbc-27224.json.gz | 4157 | 70003.273 | - 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. - baseline: trace events were dropped; the event trace omits some of the work included in phase totals. - candidate: trace events were dropped; the event trace omits some of the work included in phase totals. ## Configuration differences | Setting | Baseline | Candidate | | --- | --- | --- | | window.first_present | 3552 | 3573 | ## Frame and GPU times (ms) | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | frame_ms.p50 | 16.683 | 16.684 | +0.001 | +0.006 | | frame_ms.p90 | 16.914 | 16.910 | -0.004 | -0.024 | | frame_ms.p99 | 18.763 | 17.373 | -1.390 | -7.408 | | frame_ms.max | 143.273 | 97.168 | -46.105 | -32.180 | | mean_frame_ms | 16.966 | 16.840 | -0.126 | -0.746 | | gpu_busy_ms_per_present | 8.634 | 8.044 | -0.590 | -6.833 | ## Top phases (ms per frame) | Metric | Baseline | Candidate | Change | Change (%) | | --- | ---: | ---: | ---: | ---: | | Driver.Draw | 1.663 | 1.363 | -0.300 | -18.040 | | Driver.Draw.draw_enqueued | 1.001 | 0.808 | -0.193 | -19.281 | | Driver.Packet | 2.397 | 1.931 | -0.466 | -19.441 | | Driver.Packet.draw | 1.696 | 1.390 | -0.306 | -18.042 | | Graphics.Draw | 1.905 | 1.539 | -0.366 | -19.213 | | Graphics.Draw.draw_and_resource_release | 1.549 | 1.239 | -0.310 | -20.013 | | VideoOut.Flip | 12.819 | 13.362 | +0.543 | +4.236 | | VideoOut.Flip.vblank_wait | 11.509 | 12.380 | +0.871 | +7.568 | </details> The only recorded configuration difference is `window.first_present` (3552 against 3573), the present at which each window opened. </details> `tools/check_conventions.py` and `git diff --check` pass against `4f41f4c375`. **Not tested:** - the full test suite on this head; - the title on `main` `4f41f4c375` (the page-turn pair is on `1b0577cc92` and `91ecd2d974`); - Linux by me: my WSL lavapipe build skips `agc_snapshot_read_into_staging`, since WSL gives it no write watch (XairRrR's lavapipe run of `e9b72ae83a` ran every row, see GPUs tested); - other GPUs on this head (the runs from this thread are on `e9b72ae83a` or earlier), and other titles; - the 1D-array row on `main`'s production files on its own: there the test stops at the linear row first, so control (b) is that row's check; - control (b) more than once; - this PR together with #10064 or #7085. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#10773, the agreed prerequisite, merged first on 2026-11-02 as `88a4bed5d3`; this head contains it) - [x] Fixes: none - [x] Unblocks: PPSA14363 #9615 (Screenplay Book page-turn frames, not a stop) - [x] GPUs tested: AMD Radeon RX 6700 XT (gfx1031), AMD Windows driver 32.0.21045.16010, Windows 11 26200, on head `ac57b02043` (tests) and `1b0577cc92` (page-turn pair). From this thread, on `e9b72ae83a`: by TechLevelZero's NVIDIA run, merged onto `main` `f6232fc` (0 new failures, no new validation IDs against `main`; the new test was validated but not compared), NVIDIA RTX 2000 Ada Generation (driver 595.99.02), Ubuntu 26.04.1 ([comment](https://github.com/boykopovar/AnyPS5/pull/9884#issuecomment-6599555639)); by XairRrR, merged onto `main` `4f41f4c375` (20 related tests, negative control red), lavapipe (Mesa 26.1.6, LLVM 19), Debian 13 ([review](https://github.com/boykopovar/AnyPS5/pull/9884#pullrequestreview-5749326694)). On `52a861028e`: by ycbuzi, merged onto `main` `2e1c72239b` (the 17 snapshot tests, 2 runs each, negative control red), NVIDIA GeForce RTX 4070 SUPER and GTX 1650 SUPER (NVIDIA 616.92) and AMD Radeon RDNA2 iGPU `1002:164e` (AMD 32.0.21030.2001), Windows 11 26200 ([comment](https://github.com/boykopovar/AnyPS5/pull/9884#issuecomment-6400912223)); by NFSS10 (14 related tests with the validation layer), AMD Radeon RX 7900 GRE, AMD 25.6.1, Windows 10.0.22631 ([comment](https://github.com/boykopovar/AnyPS5/pull/9884#issuecomment-6471297007)); by Bram910, cherry-picked onto a local integration (7 tests with the validation layer, negative control red), NVIDIA GeForce RTX 3080, Windows driver 32.0.16.1047, Windows 11 26200 ([comment](https://github.com/boykopovar/AnyPS5/pull/9884#issuecomment-6493970628)) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-29 10:30:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T10:30:02Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The direct-to-staging path is coherent on inspection: the dropped-snapshot predicate is limited to large uncompressed snapshots that are not retained for comparison, ReadTextureSurface fills the selected span through GuestMemory::ReadCommitted, and the new Texture overload avoids the vector-to-staging copy. The four surface-layout cases and the negative control are useful evidence.

What I checked

  • Exact head: 52a861028e91031a5ed68e844a763a085ee01e90.
  • Current main: bc3e33f4e334996ab9ba5cbf8544942465be18f3.
  • git merge-tree --write-tree is clean (ecf94663beed0ee0d00e430424beab911a2d679f).
  • git diff --check passes and tools/check_conventions.py passes against current main.
  • I inspected the snapshot/drop/cache path and the staging-buffer texture constructor. No concrete source defect found in the PR-base diff.
  • There is no configured product build in this checkout; I did not run a local build or GPU tests.

Blocking items

  1. Validate the current-main integration. The 25 focused tests and validation-layer run are on main 30be9b428b. Since then main has changed ShaderResources.cpp, Texture.cpp, Texture.hpp and the driver test registration; those are also touched by this PR. The merge preview is clean, but these overlapping changes make the old runtime result insufficient for the integrated tree. Please merge/rebase current main and rerun the focused 25-test set, including the Vulkan validation comparison and negative control, on the resulting exact head.
  2. Refresh the performance comparison on that integration. The page-turn pair is based on main 5fa2520ad9 plus a candidate rather than the current integrated head. Since the sampled-resource and texture paths changed on main after that baseline, please provide the required matched current-main/change capture pair, or demonstrate from the integrated diff and a current run that those intervening changes do not affect this measurement.
  3. Record the agreed prerequisite. The PR says #10773 lands first and its author agreed, but #10773 is still open and this checklist says Depends on: none. Please change it to Depends on: #10773 and keep the stated order in the merge plan.

The existing reports support the optimization and the earlier behavior, but do not cover these current integration and landing-order requirements. I will reassess after they are addressed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5696241043 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9884#pullrequestreview-5696241043). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T10:30:02Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The direct-to-staging path is coherent on inspection: the dropped-snapshot predicate is limited to large uncompressed snapshots that are not retained for comparison, `ReadTextureSurface` fills the selected span through `GuestMemory::ReadCommitted`, and the new `Texture` overload avoids the vector-to-staging copy. The four surface-layout cases and the negative control are useful evidence. ## What I checked - Exact head: `52a861028e91031a5ed68e844a763a085ee01e90`. - Current `main`: `bc3e33f4e334996ab9ba5cbf8544942465be18f3`. - `git merge-tree --write-tree` is clean (`ecf94663beed0ee0d00e430424beab911a2d679f`). - `git diff --check` passes and `tools/check_conventions.py` passes against current `main`. - I inspected the snapshot/drop/cache path and the staging-buffer texture constructor. No concrete source defect found in the PR-base diff. - There is no configured product build in this checkout; I did not run a local build or GPU tests. ## Blocking items 1. **Validate the current-main integration.** The 25 focused tests and validation-layer run are on `main` `30be9b428b`. Since then `main` has changed `ShaderResources.cpp`, `Texture.cpp`, `Texture.hpp` and the driver test registration; those are also touched by this PR. The merge preview is clean, but these overlapping changes make the old runtime result insufficient for the integrated tree. Please merge/rebase current `main` and rerun the focused 25-test set, including the Vulkan validation comparison and negative control, on the resulting exact head. 2. **Refresh the performance comparison on that integration.** The page-turn pair is based on `main` `5fa2520ad9` plus a candidate rather than the current integrated head. Since the sampled-resource and texture paths changed on `main` after that baseline, please provide the required matched current-main/change capture pair, or demonstrate from the integrated diff and a current run that those intervening changes do not affect this measurement. 3. **Record the agreed prerequisite.** The PR says #10773 lands first and its author agreed, but #10773 is still open and this checklist says `Depends on: none`. Please change it to `Depends on: #10773` and keep the stated order in the merge plan. The existing reports support the optimization and the earlier behavior, but do not cover these current integration and landing-order requirements. I will reassess after they are addressed.
XairRrR commented 2026-11-03 08:51:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T08:51:44Z.

Review: APPROVED


Reviewed — approved

Dropped Uncompressed snapshots are now read straight into a pooled staging Buffer. The merged tree builds and passes the related snapshot and sampled-cache tests on lavapipe. The new test fails on main's production files and passes with the PR, and the validation layer reports no new VUIDs that come from this change.

What I ran

Head e9b72ae83aa067744d220d8a33ae15a906e2ab20 merged into main 4f41f4c375f5abb487dbd184fbc150f31994d762 (merged tree 307f0479be47bc7bd49c21ae3aa506d8ee504a3b), in a clean worktree. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19).

git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...e9b72ae83aa067744d220d8a33ae15a906e2ab20
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "snapshot|sampled_cache|staging|large_tracked|partially_resident"
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -V -R "^(agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget)$"
# negative control: Texture.hpp, ShaderResources.cpp, Texture.cpp from main
git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path>
ninja -C build -j32 -l32 agc_driver_recorder_tests agc_driver_sampled_cache_budget_tests
ctest --test-dir build --output-on-failure -R "^(agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget|agc_driver_sampled_cache_budget_without_storage_image_multisample)$"
ninja -C build -j32 -l32 agc_driver_native_multisample_depth_tests
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_native_depth_uniform_planes$"
# restore
git show 307f0479be47bc7bd49c21ae3aa506d8ee504a3b:<path> > <path>
ninja -C build -j32 -l32 agc_driver_native_multisample_depth_tests agc_driver_recorder_tests agc_driver_sampled_cache_budget_tests libs
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^(agc_driver_native_depth_uniform_planes|agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget)$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure, build, libs (script) ok
Script test run (2230 tests) no new failures and no timeouts. The 7 known failures (denormal/division tests, unwrap_self_…, vector_constant_factor_tininess) also fail on main
20 related tests (snapshot, sampled_cache, staging, large_tracked, partially_resident) 20/20 pass
agc_snapshot_read_into_staging passes in 0.36 s. lavapipe exposes BC, so every row runs, including the BC5 spare-pool rows and the 1D-array-as-rows row; none prints "not tested"
Validation layer, script comparison the layer loaded in 769 of 770 tests; the one new-VUID test is agc_driver_native_depth_uniform_planes (see below)
Validation layer, agc_snapshot_read_into_staging and agc_driver_sampled_cache_budget the layer was inserted, no Validation Error, no was not found
Worktree after restore git status --porcelain is empty
agc_snapshot_read_into_staging output (merged tree)
fast-cleared surface cleared on the GPU parks the snapshot vector it replaces and leaves the spare snapshot pool alone: passed
dropped snapshot read into its staging buffer, linear: passed
dropped snapshot read into its staging buffer, tiled: passed
dropped snapshot read into its staging buffer, padded linear: passed
dropped snapshot read into its staging buffer, partially committed: passed
dropped snapshot read into its staging buffer, 1D array laid out as rows of a 2D image: passed
dropped snapshot leaves the spare snapshot pool alone: passed
dropped snapshot expires idle spare snapshots: passed
Snapshot read into staging tests passed

The VUID-vkCmdDispatch-groupCountX-00386 in agc_driver_native_depth_uniform_planes does not come from this PR. The test came to main with c9987271e3, after the validation baseline d1ae628bc2, which is why the script reported it as "test not run on main". I rebuilt the test with main's versions of the three production files this PR changes and ran it under the validation layer. It printed the same VUID-vkCmdDispatch-groupCountX-00386 four times, which matches the merged tree. The PR does not touch dispatch code.

Negative control

I restored Texture.hpp, ShaderResources.cpp and Texture.cpp from main, kept the tests and rebuilt:

  • agc_snapshot_read_into_staging fails with AGC graphics: the dropped snapshot of the linear surface parked a vector in the spare pool.
  • agc_driver_sampled_cache_budget and _without_storage_image_multisample pass. That is expected: the rewritten recycleTests/spareAgeTests now park their spare through a fast-cleared BC5 snapshot, which uses the vector path both before and after this change.

After restoring the merged files and rebuilding, all three pass and the worktree is clean.

Findings

Blocking

None.

Non-blocking

  1. The description's Tested section and its "Not tested" list are older than the head.
    • The hardware results ("Head 0386e61741 on main 6a3afa4deb") predate three commits:
    • The "GPUs tested" line still says "on this head".
    • "Not tested" still lists "this PR on top of #10773 (I rebase it … when #10773 lands)". #10773 is already in main (88a4bed5d3), and the merge commit says it was resolved.
    • Suggestion: rerun the focused tests (including validation) on the RX 6700 XT at e9b72ae83a and update those lines, or state which head the hardware result is for. The tests on lavapipe here cover the current head.
  2. On devices without BC support, the spare-pool rows don't run. Those are the BC5-producer rows in agc_snapshot_read_into_staging, recycleTests and spareAgeTests (core/libs/prx/libSceAgcDriver/tests/execution/SampledCacheBudget.cpp:757, :774).
    • Each prints a "not tested" line and returns success.
    • lavapipe and desktop GPUs have BC, so CI still covers them. If the staging path is ever widened to clear keys, these tests also need a new producer, as NFSS10 already noted in the discussion.
    • No change needed now.

I checked the code and found nothing wrong:

  • Drop decision. It moves before the read (ShaderResources.cpp:1121) and is equivalent to main's post-upload drop at :1143 for Uncompressed keys. entry.generation is snapshotGeneration, and entry.untracked is set only when no write is pending.
  • Other key types. Non-Uncompressed keys and kept snapshots keep the vector and the spare pool.
  • Staging buffer contents. The pooled Buffer is fully written by ReadTextureSurface for Uncompressed keys, which the poisoned-buffer rows exercise, including the uncommitted-pages case.
  • Size check. Buffer::Bytes() returns exactly the requested size, so the size Require at Texture.cpp:400 holds. Constructing with a staging buffer and a clear together is refused.
  • Debt docs. The PR adds no code comments, so no debt-doc change is needed.
  • Perf evidence. The description carries summary lines from two commits (5fa2520ad95e, 85f41ae08dbc) and links to the traces.
  • Merge order. Depends on: #10773 is satisfied by main.

Not verified

  • Hardware GPUs: I had only lavapipe, so I relied on the author's and commenters' RX 6700 XT, NVIDIA and RDNA2 runs, which were on earlier heads.
  • Windows/MinGW: the ReadProcessMemory path of GuestMemory::ReadCommitted into a pooled Buffer.
  • The PPSA14363 page-turn numbers: I did not run the title, and the numbers come from an earlier revision (85f41ae08d), as the description says.
  • I did not open or check the trace files linked from the author's fork.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5749326694 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9884#pullrequestreview-5749326694). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T08:51:44Z. **Review:** APPROVED --- # Reviewed — approved Dropped `Uncompressed` snapshots are now read straight into a pooled staging `Buffer`. The merged tree builds and passes the related snapshot and sampled-cache tests on lavapipe. The new test fails on `main`'s production files and passes with the PR, and the validation layer reports no new VUIDs that come from this change. ## What I ran Head `e9b72ae83aa067744d220d8a33ae15a906e2ab20` merged into `main` `4f41f4c375f5abb487dbd184fbc150f31994d762` (merged tree `307f0479be47bc7bd49c21ae3aa506d8ee504a3b`), in a clean worktree. Debian 13 VM (Xeon Gold 6136), GCC 14.2.0, Release, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19). ``` git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...e9b72ae83aa067744d220d8a33ae15a906e2ab20 python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "snapshot|sampled_cache|staging|large_tracked|partially_resident" ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -V -R "^(agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget)$" # negative control: Texture.hpp, ShaderResources.cpp, Texture.cpp from main git show 4f41f4c375f5abb487dbd184fbc150f31994d762:<path> > <path> ninja -C build -j32 -l32 agc_driver_recorder_tests agc_driver_sampled_cache_budget_tests ctest --test-dir build --output-on-failure -R "^(agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget|agc_driver_sampled_cache_budget_without_storage_image_multisample)$" ninja -C build -j32 -l32 agc_driver_native_multisample_depth_tests env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^agc_driver_native_depth_uniform_planes$" # restore git show 307f0479be47bc7bd49c21ae3aa506d8ee504a3b:<path> > <path> ninja -C build -j32 -l32 agc_driver_native_multisample_depth_tests agc_driver_recorder_tests agc_driver_sampled_cache_budget_tests libs env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R "^(agc_driver_native_depth_uniform_planes|agc_snapshot_read_into_staging|agc_driver_sampled_cache_budget)$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure, build, `libs` (script) | ok | | Script test run (2230 tests) | no new failures and no timeouts. The 7 known failures (denormal/division tests, `unwrap_self_…`, `vector_constant_factor_tininess`) also fail on `main` | | 20 related tests (`snapshot`, `sampled_cache`, `staging`, `large_tracked`, `partially_resident`) | 20/20 pass | | `agc_snapshot_read_into_staging` | passes in 0.36 s. lavapipe exposes BC, so every row runs, including the BC5 spare-pool rows and the 1D-array-as-rows row; none prints "not tested" | | Validation layer, script comparison | the layer loaded in 769 of 770 tests; the one new-VUID test is `agc_driver_native_depth_uniform_planes` (see below) | | Validation layer, `agc_snapshot_read_into_staging` and `agc_driver_sampled_cache_budget` | the layer was inserted, no `Validation Error`, no `was not found` | | Worktree after restore | `git status --porcelain` is empty | <details><summary>agc_snapshot_read_into_staging output (merged tree)</summary> ``` fast-cleared surface cleared on the GPU parks the snapshot vector it replaces and leaves the spare snapshot pool alone: passed dropped snapshot read into its staging buffer, linear: passed dropped snapshot read into its staging buffer, tiled: passed dropped snapshot read into its staging buffer, padded linear: passed dropped snapshot read into its staging buffer, partially committed: passed dropped snapshot read into its staging buffer, 1D array laid out as rows of a 2D image: passed dropped snapshot leaves the spare snapshot pool alone: passed dropped snapshot expires idle spare snapshots: passed Snapshot read into staging tests passed ``` </details> **The `VUID-vkCmdDispatch-groupCountX-00386` in `agc_driver_native_depth_uniform_planes` does not come from this PR.** The test came to `main` with c9987271e3, after the validation baseline `d1ae628bc2`, which is why the script reported it as "test not run on main". I rebuilt the test with `main`'s versions of the three production files this PR changes and ran it under the validation layer. It printed the same `VUID-vkCmdDispatch-groupCountX-00386` four times, which matches the merged tree. The PR does not touch dispatch code. ## Negative control I restored `Texture.hpp`, `ShaderResources.cpp` and `Texture.cpp` from `main`, kept the tests and rebuilt: - `agc_snapshot_read_into_staging` **fails** with `AGC graphics: the dropped snapshot of the linear surface parked a vector in the spare pool`. - `agc_driver_sampled_cache_budget` and `_without_storage_image_multisample` pass. That is expected: the rewritten `recycleTests`/`spareAgeTests` now park their spare through a fast-cleared BC5 snapshot, which uses the vector path both before and after this change. After restoring the merged files and rebuilding, all three pass and the worktree is clean. ## Findings ### Blocking None. ### Non-blocking 1. **The description's Tested section and its "Not tested" list are older than the head.** - The hardware results ("Head `0386e61741` on `main` `6a3afa4deb`") predate three commits: - 181f0ab5e7 (BC5 producers and the GPU-clear guard row); - 38f795a674 (the merge of `main` with #10773 and #12246, which passes `layerRows` through the staging constructor); - e9b72ae83a (the 1D-array-as-rows row). - The "GPUs tested" line still says "on this head". - "Not tested" still lists "this PR on top of #10773 (I rebase it … when #10773 lands)". #10773 is already in `main` (88a4bed5d3), and the merge commit says it was resolved. - Suggestion: rerun the focused tests (including validation) on the RX 6700 XT at `e9b72ae83a` and update those lines, or state which head the hardware result is for. The tests on lavapipe here cover the current head. 2. **On devices without BC support, the spare-pool rows don't run.** Those are the BC5-producer rows in `agc_snapshot_read_into_staging`, `recycleTests` and `spareAgeTests` (`core/libs/prx/libSceAgcDriver/tests/execution/SampledCacheBudget.cpp:757`, `:774`). - Each prints a "not tested" line and returns success. - lavapipe and desktop GPUs have BC, so CI still covers them. If the staging path is ever widened to clear keys, these tests also need a new producer, as NFSS10 already noted in the discussion. - No change needed now. I checked the code and found nothing wrong: - **Drop decision.** It moves before the read (`ShaderResources.cpp:1121`) and is equivalent to `main`'s post-upload drop at `:1143` for `Uncompressed` keys. `entry.generation` is `snapshotGeneration`, and `entry.untracked` is set only when no write is pending. - **Other key types.** Non-`Uncompressed` keys and kept snapshots keep the vector and the spare pool. - **Staging buffer contents.** The pooled `Buffer` is fully written by `ReadTextureSurface` for `Uncompressed` keys, which the poisoned-buffer rows exercise, including the uncommitted-pages case. - **Size check.** `Buffer::Bytes()` returns exactly the requested size, so the size `Require` at `Texture.cpp:400` holds. Constructing with a staging buffer and a clear together is refused. - **Debt docs.** The PR adds no code comments, so no debt-doc change is needed. - **Perf evidence.** The description carries summary lines from two commits (`5fa2520ad95e`, `85f41ae08dbc`) and links to the traces. - **Merge order.** `Depends on: #10773` is satisfied by `main`. ## Not verified - Hardware GPUs: I had only lavapipe, so I relied on the author's and commenters' RX 6700 XT, NVIDIA and RDNA2 runs, which were on earlier heads. - Windows/MinGW: the `ReadProcessMemory` path of `GuestMemory::ReadCommitted` into a pooled `Buffer`. - The PPSA14363 page-turn numbers: I did not run the title, and the numbers come from an earlier revision (`85f41ae08d`), as the description says. - I did not open or check the trace files linked from the author's fork. <!-- anyps5-bots job=3197 head=e9b72ae83aa067744d220d8a33ae15a906e2ab20 -->
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!9884
No description provided.