perf(agc): keep constant RAM dumps and unregistered labels on the GPU without draining #9898

Merged
savvaniss merged 20 commits from upstream-pr/9898 into main 2026-11-03 19:10:46 +00:00
savvaniss commented 2026-10-22 20:49:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-22T20:49:54Z.


What

Get-fix/AnyPS5#10, #11 and #21, moved upstream as one pull request: each removes a wait the queue worker or the committer made for a store the GPU was about to make. None is PS4-only, so it goes straight on main. Each is its own commit, in this order: c8e2a98755, df808a4807, f137c98218. After review and CI, main is merged in (last b7488e1ff5, in 3cd01b28ab) and the fixes follow, described under Follow-ups below.

1. Captures read recorded store bytes instead of waiting for the GPU (Get-fix/AnyPS5#10)

A PS4 title that uses the constant engine builds its descriptor tables in constant RAM and dumps them to memory with DUMP_CONST_RAM before each draw. While GPU work is open, preparePacketMemory resolves such a store (Pm4::ResolveStore, up to 64 KiB, also COPY_DATA and DMA_DATA) and VulkanDevice::WriteLabelOnGpu records it into the batch as a vkCmdUpdateBuffer into the host import. The range is then a pending write. The next draw's resource capture reads the dumped table through the flush hook, which submits the batch and waits for the GPU, although the driver already holds the bytes it stored.

This commit lets a capture read those bytes instead of waiting:

  • The recorder's label table kept values only for stores up to LabelTableBytes (64). Wider stores were ranges only (wideLabels). They now keep their bytes and a record sequence too. markOverwritten flags them like table entries when later GPU work writes over them, and they leave with their batch as before.
  • Recorder::LookupStoredBytes composes a dword-aligned range from the newest recorded store of each dword. A table entry wins over wide stores, since a wide store erases the table entries it covers when it is noted. The lookup refuses a dword with no store, one a later GPU write covers, a label behind a completion action, any range under a queued label and, since 7aa3c8f63d, any store of a batch whose submit has started (see Follow-ups).
  • Driver::classifyPendingWrite answers KnownValue with those bytes when the caller passes a buffer for them. Callers that do are the capture's word reads (ShaderMemory), captureStable and validateCaptured. Callers that pass none, and every other pending write, sync as before. The store lands after everything recorded before it and before everything recorded after it, so its bytes are what the next draw reads on the GPU. An earlier CPU store to the range is overwritten by it there as well.
  • APS5_NO_STORED_KNOWN_VALUES=1 turns the path off. With APS5_VERIFY_KNOWN_VALUES=1 each served word is also read through the hook and compared. The [capture] profile line now reports those counts; before this they only reached the [copy] line, which a title without copy kernels never prints.

Nothing depends on the title: any resolved store, label or constant RAM dump that a capture reads is served the same way.

2. Labels in unregistered host memory are stored on the GPU (Get-fix/AnyPS5#11, with its follow-up fix folded in)

A label or store into memory no host import covers (WriteLabelOnGpu reason 3) makes the recording thread wait for all recorded work (WaitIdle) and then write it with the CPU. c9ab6a72a5 chose that over a store at batch reap because a later label stored on the GPU could become visible first (#1458).

VideoOut's buffer labels hit that path on every PS4 flip. PatchFlip in libSceGnmDriver writes 1 to VideoOutBufferLabelAddress(handle) + index * 8 with WRITE_DATA before the flip packet. That address is bufferLabels inside VideoOut's host-side config object, and no guest allocation covers it. So once per frame the draw committer ran commitLabel, found no import and waited for the device under the GPU mutex. The queue worker then waited for the committer at the next DUMP_CONST_RAM. This is the ~69 ms per frame that #10's numbers showed as Driver.Packet.device_lock: that timer mark covers the draw pipeline drain.

This commit stores such labels on the GPU instead:

  • Graphics::UnregisteredHostImport imports the pages holding the label's bytes, rounded to the device's import alignment. It does so only when no guest allocation range overlaps them and, on Windows, every page is committed MEM_PRIVATE memory with exactly PAGE_READWRITE protection in a single allocation.
  • WriteLabelOnGpu uses that import when HostImportFor finds none. It records the store into the open batch as for any imported label, and Recorder::Keeps the import with that batch so the buffer outlives the store.
  • The GPU stores the label in stream order after the work before it, as the console's CP does. A later label cannot become visible first, and nothing waits.
  • Memory that fails the checks (image or mapped sections, read-only, guard or no-access pages, ranges spanning allocations, partly registered pages) or whose import fails still returns reason 3 and waits as today. Since c14d8edb47 Linux checks the pages too (one private anonymous read-write mapping in /proc/self/maps), and since cd2e19f6f9 the import is made only while no copied writer is listed and no completion store is pending.
  • The libSceAgcDriver debt entry for unimported labels now names what still waits.

Nothing depends on the title: any RELEASE_MEM, WRITE_DATA, DMA_DATA, COPY_DATA or DUMP_CONST_RAM target in host memory outside the guest registry takes this path (VideoOut's buffer labels, a label on a native thread stack).

The commit also carries the follow-up 75bc9a49b7 from Get-fix/AnyPS5#11, which fixes a driver test the import broke. A DMA_DATA copy over 64 KiB into host memory that no import covers waits for the batches that write its source (Recorder::SyncThrough) and copies on the CPU, unless something can still store over its destination; then it drains the device. Before the first commit, a label into such memory was written by the CPU after a drain, so nothing was pending there. Now that label is a GPU store in the open batch, and agc_driver's copy behind a label into its destination drained.

  • The copy now waits for the batches that store into its destination, as it already did for its source, and then checks again.
  • Only what still stores there after that wait drains as before: a storage image's write-back, a unit shadow, or a label another queue has not recorded yet.

3. DUMP_CONST_RAM is queued behind pipelined draws (Get-fix/AnyPS5#21)

A DUMP_CONST_RAM (PM4 0x83) on the graphics queue drained the draw pipeline. keepsDrawPipeline does not keep 0x83, so the queue worker waited until the committer had recorded every queued draw, then preparePacketMemory recorded the dump's GPU store itself. A PS4 title's constant engine dumps a descriptor table before many of its draws. On the board of Monopoly Plus (CUSA03312), APS5_PROFILE_DRAW's [draw] pipelined line counted 4,700 to 5,400 drains a second, nearly all by opcode 0x83, and the worker waited 3.0 to 3.5 s of every 10 s in them.

This commit queues the dump instead:

  • The worker copies the dumped constant RAM words when it reaches the packet (Pm4::ResolveStore, as before) and queues their store as a pipeline item (Driver::enqueueConstantRamDump). The committer records it in stream order with the draws around it through the same store path as a queued DMA_DATA store (Driver::commitStore, renamed from commitDmaStore).
  • The item keeps the bytes it stores. DrawPipeline::StoredBytes answers for a range from the newest queued item that writes it: that item's bytes when it is a store covering the whole range, unknown when it is any other item.
  • Driver::queryPendingWrite gives a capture those bytes as known values instead of draining, and drains as before when the answer is unknown. A page under a queued store is read word by word without draining. With APS5_VERIFY_KNOWN_VALUES=1 it drains first, so each served word is checked against the stored one.

The other reads the worker makes between the enqueue and the commit:

  • Cached draw and dispatch variant validation, fill inputs, dispatch inputs, predication and the 0x63/0x64/0x9f packets already drain on an overlap with any queued write (DrawPipeline::Overlaps); the queued store's range is one.
  • A WAIT_REG_MEM on a dumped word reads the queued value through DrawPipeline::PendingLabel, which reads the stored bytes of a store item as it does a label's.
  • The vertex-table decode of a program with an AGC header (Graphics::DecodeVertexStageInfo, attribute words and vertex V#s) drains and decodes again when its reads overlap a queued write. This branch first added that drain itself; main's #7691 (DecodeOrderedVertexStageInfo) now does it, and the merge keeps main's helper. PS4 programs have no AGC header, so this never runs for them.
  • Raw shader code and user-data callee code are read at addresses from registers, as with queued draws and fills before; a dump is not expected over shader code.

Dumps the worker cannot resolve, dumps outside writable guest memory, predicated dumps and dumps while labels are deferred take the old path. A dump of no words stores nothing and no longer drains. APS5_PIPELINE_DRAIN_DUMPS=1 restores the drain for every dump, like APS5_PIPELINE_DRAIN_FILLS for fills.

main's draw pipeline now also orders queued reads (Enqueue's reads, HeldReads), counts queued writes and runs draws through the optional draw finisher (APS5_DRAW_PIPELINE). EnqueueStore goes through the same enqueue, which drains a busy finisher first; a queued store item carries no reads; and StoredBytes refuses a range the finisher still holds as well as anything a queued non-store item writes.

Follow-ups after review and CI

  • 71bcb4a8d2 merges main 9c6d153dec. The resolution keeps main's draw pipeline, finisher and packet loop, and takes main's ordered vertex-table decode (#7691) in Draw.cpp. WriteLabelOnGpu keeps the unregistered import ahead of #8180's completion stores.
  • cd2e19f6f9 fixes the Linux CI failure of agc_driver_compute_pipeline_outside_gpu_mutex ("the first dispatch stored 0"):
    • Cause: the dispatch writes memory no import covers, which the driver holds as a CPU copy and writes back at the reap. The WRITE_DATA after it was stored by the GPU into an unregistered import, so the label was visible first.
    • Through #8180 such a label would instead be stored at the reap, where it can land over a store the host made once the GPU work was done. VideoOut stores 0 into the previous buffer's label after a flip.
    • Fix: the unregistered import is now made only while no copied writer is listed and no completion store is pending. Otherwise the label waits and is written by the CPU, as before this branch.
  • 7aa3c8f63d (first review, point 1): recorded store bytes are refused once their batch's submit has started.
    • Before, a guest that waited for a label behind a dump could rewrite the dumped range with the CPU, and a capture before the reap read the old bytes.
    • Each batch sets an atomic submitStarted before vkQueueSubmit. The lookup does not query the fence: captures run without the GPU mutex, and a label in the middle of a batch is visible before its fence signals.
  • c14d8edb47 (first review, point 3): on Linux, UnregisteredHostImport checks that the range lies inside one private anonymous read-write mapping (rw-p, inode 0). An import does not fail for every such page: AMD's Windows driver imports a mapped view of a section.
  • 0a08a3b019: main now queues queue-0 DMA_DATA by default (ce6865fc0d). Its committed copy into host memory now waits for the batches that store into its destination, as the immediate path above does. agc_driver failed without it.
  • 3cd01b28ab merges main b7488e1ff5.
  • 0bc7829562 fixes the heap corruption XairRrR found (agc_driver_queued_constant_ram_dump aborting on Linux with free(): chunks in smallbin corrupted):
    • Cause: DrawPipeline::enqueue and DrawFinisher::Enqueue left retired items in a thread-local vector until the thread's next enqueue. At thread exit that vector is destroyed with the thread's other thread-locals, in reverse order of construction. ~ShaderMemory, reached from a retired draw item, returns its pages to pagePool(), also a thread-local on Linux. If the pool was constructed after the vector it is already gone, and the page goes into its freed buffer. ASan on the unfixed tree reports a heap-use-after-free at that emplace_back, from __call_tls_dtors.
    • This is destruction order at thread exit, not a lifetime problem during play, and it is not specific to queued dumps. The test's main thread enqueues and first touches the pool at its second enqueue. APS5_PIPELINE_DRAIN_DUMPS=1 only hid it, because the test then stops at its first assert, before that second enqueue. main has the same two vectors.
    • Fix: both vectors are emptied before Enqueue returns, after the lock is released, so nothing is left in them at thread exit. They keep their storage.
  • 70d8cce27d (first review, point 2, option B as chosen on this pull request): VideoOutDriver::Open waits for the driver (AgcDriverWaitIdle) before it replaces a closed port's configuration.
    • Without it, a close and reopen with a flip in flight could free VideoOutConfig::bufferLabels before the batch with PatchFlip's GPU store ran.
    • The wait runs without the driver mutex, and Open checks the port again afterwards, since another Open may have run meanwhile.
    • A queue stalled on something the title does only after sceVideoOutOpen returns stalls the reopen with it. That limit is in the libSceVideoOut debt file.
  • 4647d9c464: the Linux page check uses the PROCMAP_QUERY ioctl on /proc/self/maps (Linux 6.11 and later), and reads the file as text only when the ioctl fails.
  • fb1551442b merges main de2ba4cecb. Two conflicts, both lines added on each side: the recorder tests' PATH list in CMakeLists.txt and the argument dispatch in tests/Recorder.cpp. Both sides are kept.

The per-label import is not cached: an import that outlived its batch would pin memory its owner may free, and host memory has no hook to invalidate it. On the RX 9070 XT a label into unregistered memory costs about 300 us (a registered one 0.4 us), against the ~63 ms wait it replaces. The Linux check takes 0.4 us with the ioctl at any depth; the text fallback takes up to 11 ms at 20,000 mappings (about 0.6 us per mapping ahead of the label's).

Tested

Merge of main d1ae628bc2, 3 Nov, and a variant-validation fix. Head b8c3f25cdf (merge f070b16201). Conflicts: the [capture] profile line in ShaderMemory.cpp (main's line with this branch's known-value verified/mismatch counters), the option list in tests/Recorder.cpp (both kept) and the Windows PATH list in agc_driver_recorder_tests.cmake (main's list plus agc_recorder_stored_bytes). After the merge, agc_driver_queued_constant_ram_dump failed on AMD as oneandonlydean reported: a later draw reused a cached variant and Driver::validateVariant drained with DrainReason::Capture. b8c3f25cdf: when every queued item over the variant's runs is a store whose bytes the pipeline holds, validateVariant returns Differing without draining, so the capture serves the queued bytes; other overlaps, and APS5_VERIFY_KNOWN_VALUES, still drain. Comparing the queued bytes with the variant and keeping it when they matched was tried first and is wrong: the later data-word check reads guest memory that still holds the old table, and draw 1 wrote 64 instead of 255. Windows, WinLibs GCC, Release, AMD RX 9070 XT, validation layer, ANYPS5_NO_SHADER_CACHE=1: agc_driver_queued_constant_ram_dump fails on the merge without the fix (1 capture drain) and passes 3/3 with it, and passes with APS5_VERIFY_KNOWN_VALUES=1; 49/49 of the focused set pass (draw_cache_relocation*, draw_cache_reuse*, draw_data_hit_user_words*, dispatch_data_hit_words, draw_pipeline_*, the *_draw_pipeline variants of bda span, buffer load/store, copied writer, depth storage reuse, unsupported buffer type and write ranges, dumped_constant_capture, both unregistered_label_*, agc_driver_recorder, agc_recorder_*, agc_queued_write_groups); agc_recorder_kept_bytes was not built. No VUID-, 54 device lines all RX 9070 XT. check_conventions.py passed. Not rerun: the same set on main, Linux, the full suite, games, and a paired trace for the speed claim.

Merge of main f2d874c1fd, 1 Nov. Head a814af06ee. The only conflict was in the Linux includes of GuestBufferMemory.cpp: main's macOS udmabuf stand-in and this branch's <linux/fs.h> (for PROCMAP_QUERY) are both kept, with <linux/fs.h> on the non-Apple side. On the RX 9070 XT, 13 of 13 pass with no VUID- line and every device line naming it: agc_driver, agc_driver_pm4, agc_shader_memory, agc_driver_compute_pipeline_outside_gpu_mutex, agc_driver_draw_pipeline_retired_items, agc_driver_dumped_constant_capture, agc_driver_queued_constant_ram_dump, agc_driver_unregistered_label_behind_write_back, agc_driver_unregistered_label_on_gpu, agc_driver_vertex_table_read_order, agc_recorder_stored_bytes, agc_recorder_command_buffer_release, video_out_flip_reopen. Linux: WSL Ubuntu, g++ 15.2.0 compiled GuestBufferMemory.cpp and PipelineJournal.cpp only (the merge changed no struct under the size guards); nothing was linked or run there. Not rerun: the rest of the focused set, each test only once rather than three times, macOS, games.

Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004), Vulkan SDK 1.4.363.0. Every run used ANYPS5_GPU=AMD, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with ctest -V, three times each, on main b7488e1ff5 and on this branch at 4647d9c464. The current head fb1551442b (main de2ba4cecb merged) had the smaller rerun in the last row and the note under the table.

  • Focused set: agc_driver, agc_shader_memory, agc_driver_pm4 and its mode and replay tests, agc_driver_compute_pipeline_outside_gpu_mutex, every pipelined, label, constant-store, copied-writer and DMA test with their draw-pipeline variants, agc_driver_vertex_table_read_order, the recorder tests and video_out_flip_*. That is 176 tests on main, plus this branch's 6 on the branch.

    tests passed skipped failed
    main b7488e1ff5, each of 3 runs 176 174 2 0
    branch 4647d9c464, runs 1 and 2 182 180 2 0
    branch 4647d9c464, run 3 182 179 2 1
    head fb1551442b, each of 3 runs 166 164 2 0
    • Rerun at fb1551442b: the focused set without its 17 video_out_flip_* tests, plus main's new agc_recorder_command_buffer_release, which is the 166 above. Both tests behind the conflicts passed in all three runs: agc_recorder_stored_bytes and agc_recorder_command_buffer_release. video_out_flip_reopen and main's new video_out_flip_padstatus ran once and passed. Same environment, no VUID- or missing-layer lines, and every device line names the RX 9070 XT.
    • Not rerun at fb1551442b: the other 16 video_out_flip_* tests, the mutations below, anything on Linux, and main de2ba4cecb, so the main comparison is still the b7488e1ff5 row.

    Notes on the runs at 4647d9c464:

    • The one failure is agc_driver_pm4_ring in run 3, after 0.05 s: "replace guest placeholder with private memory: Attempt to access invalid address", from Commit in libc's WindowsMappings.hpp while the process sets up the guest arena. This branch does not touch libc. I repeated the test 40 times on each build: 40 of 40 on both. I have not found the cause.
    • The skips are agc_driver_copied_writer_label_order and its drain variant: the device's minStorageBufferOffsetAlignment of 4 binds the record in place.
    • No log contains a VUID- line or was not found but was requested by env var VK_INSTANCE_LAYERS, and every device line names the RX 9070 XT.
  • New and changed tests, each failing without its part of the change. Every row was run on 4647d9c464, 3 of 3 runs, and not repeated at fb1551442b:

    test without
    agc_driver_dumped_constant_capture, dump read by the next capture with APS5_NO_STORED_KNOWN_VALUES=1: "the capture of the draw after a constant RAM dump recorded on the GPU waited for the GPU instead of reading the dumped words"
    agc_driver_dumped_constant_capture, CPU write after the dump's label 7aa3c8f63d's wide-store check, or the flag: "the draw after the guest rewrote a dumped constant to 0.5 once the label behind the dump had landed wrote 255"
    agc_recorder_stored_bytes 7aa3c8f63d's wide-store check: "a wide store is served after its batch was submitted"; its table check: "a label-table store is served after its batch was submitted"
    agc_driver_unregistered_label_on_gpu no unregistered import: "a label in unregistered host memory returned reason 3 instead of 0"; no MEM_PRIVATE check: "a label in a mapped view of a section returned reason 0 instead of 3"
    agc_driver_unregistered_label_behind_write_back, 8-byte label after a write-back !listed for labels: "its store landed over the 0 the host stored once the GPU work was done" (reason 5)
    the same, 16-byte store after a write-back !listed for stores: "held 0x6b6b0001 once the GPU ran its batch (reason 0), while the dispatch's record still held 0xc0001000"
    the same, 8-byte label after a completion store !storesPending for labels: "it landed over the 0 the host stored once the GPU work was done"
    the same, 16-byte store after a completion store !storesPending for stores: "held 0x1 once the GPU ran its batch (reason 0), while the earlier label in registered memory, stored when its batch is reaped, still held 0x0"
    agc_driver_queued_constant_ram_dump with APS5_PIPELINE_DRAIN_DUMPS=1: "a DUMP_CONST_RAM drained the draw pipeline 1 times"
    agc_driver 0a08a3b019: "a copy into host memory drained instead of syncing its source"
    agc_driver_draw_pipeline_retired_items the clear in DrawPipeline::enqueue: "a retired draw pipeline item stayed in the enqueuing thread's storage after Enqueue returned"; in DrawFinisher::Enqueue: "a finished draw finisher job stayed..."
    video_out_flip_reopen (a flip and a label store of the old configuration gated behind the queue) 70d8cce27d's wait: "reopen replaced the port's configuration while a flip and a label store of the previous one were in flight"
  • The CI failure, reproduced on the RX 9070 XT: a local copy of agc_driver_compute_pipeline_outside_gpu_mutex with its slots in VirtualAlloc memory (MEM_PRIVATE, so it is imported) failed "the first dispatch stored 0" in 5 of 5 runs with the import behaving as at bd31efba93, and passed 5 of 5 with cd2e19f6f9. The test file in this pull request is unchanged. On Windows the test's own static arrays are MEM_IMAGE and take the wait.

  • Linux, all at 4647d9c464, before the merge of de2ba4cecb (WSL Ubuntu, g++ 15.2, Release, Unix Makefiles, lavapipe with LLVM 21.1.8, no validation layer installed). I bypassed two configure checks in that copy only, for the XRandR and audio development files; nothing else differs from that commit.

    • Ran: the focused set as it exists on Linux, 157 tests: 133 passed, 24 skipped, 0 failed. Passed there include agc_driver, agc_driver_compute_pipeline_outside_gpu_mutex, agc_driver_queued_constant_ram_dump, agc_driver_copied_writer_label_order and its drain variant, and the Linux cases of agc_driver_unregistered_label_on_gpu.
    • Skipped there: all 16 video_out_flip_* tests including video_out_flip_reopen (SDL has no X11 or Wayland in that copy, so no Vulkan window), and 8 tests whose device needs are not met on lavapipe (host imports of watched memory, deferred settles, a pipeline cache). So the VideoOut reopen test has not run on Linux.
    • agc_driver_queued_constant_ram_dump: at the unfixed merge 3cd01b28ab, 5 runs gave 3 aborts with free(): chunks in smallbin corrupted, 1 segfault and 1 pass. At 4647d9c464, 20 of 20 pass.
    • ASan (ANYPS5_ENABLE_ASAN=ON): at 3cd01b28ab, a heap-use-after-free as described above. At 4647d9c464, 0 errors in agc_driver_queued_constant_ram_dump (3 runs), agc_driver_draw_pipeline_retired_items, both unregistered label tests, agc_driver_dumped_constant_capture and agc_driver_compute_pipeline_outside_gpu_mutex.
    • The page check, both paths, in a harness against real mappings: heap, private anonymous, read-only, a range into a read-only page, PROT_NONE, shared anonymous, a private file mapping, the stack and an unmapped address. 0 failures on either path. The text fallback has run only there, since this kernel (6.18) has the ioctl.
    • Graphics/src/PipelineJournal.cpp and core/shader/recompiler/ShaderDiskCache.cpp, with their Linux-only sizeof guards, compile. main was not built on Linux. The merge of de2ba4cecb changes neither file, nor a guard or guarded struct in AGC, and Linux was not compiled again at fb1551442b.

The numbers below were measured before the follow-ups. Since then, recorded store bytes are served only while their batch is open, and an unregistered label waits while a copied writer or completion store is pending. Each can bring back part of a wait the numbers show removed. No game was run for this update, and the title still needs #9432 to run on main, so this is not the main comparison MarcZX10 and XairRrR ask for.

Monopoly Plus (CUSA03312). The title doesn't run on main: it needs #9430 to #9432. As agreed on #6977, these numbers come from ps4/limbo-gpu at 93eeee0141 (#6977's head then), with and without the change, on the local stack the title needs to start: the Get-fix pull requests named with each pair, and local stand-ins for sceGnmDrawInitDefaultHardwareState200 and sceGnmUpdate*Shader. The base and change commits named with each pair are commits of that local stack, which isn't published. Base and change alternated on the same machine and scene.

  1. Captures, on the language screen. Pair: base 9c5c8619f7, change 2c09e4328d, both with Get-fix/AnyPS5#1, #2, #5 and #8:
build fps frame p50 GPU busy ms/present shader_compile_and_link ms/frame capture_resources ms/frame device_lock ms/frame
base 6.08, 6.06, 6.07 163.6 to 164.5 ms 97.6 to 97.8 142.3 to 142.4 112.0 to 112.9 not in the top eight
change 8.33, 8.23, 8.36 119.1 to 121.5 ms 89.6 to 91.0 35.5 to 37.1 not in the top eight 67.7 to 69.2

Summary lines, written before the summary had trace and window:
Base: {"commit":"9c5c8619f7ab","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":92,"frame_ms":{"p50":163.553,"p90":169.755,"p99":179.944},"gpu_busy_ms_per_present":97.573,"top_phases_ms_per_frame":{"Driver.Packet":162.891,"Driver.Packet.draw":151.459,"Driver.Draw":151.119,"Driver.Draw.shader_compile_and_link":142.416,"Shader.DrawStage":140.547,"Shader.DrawStage.capture_resources":112.045,"Shader.DrawStage.prepared_invocation":17.515,"Shader.DrawStage.materialize":10.915}}
Change: {"commit":"2c09e4328dc6","dirty":false,"env":{...same...},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","presents":125,"frame_ms":{"p50":119.541,"p90":122.234,"p99":126.64},"gpu_busy_ms_per_present":90.018,"top_phases_ms_per_frame":{"Driver.Packet":118.492,"Driver.Packet.device_lock":69.187,"Driver.Packet.draw":44.439,"Driver.Draw":44.12,"Driver.Draw.shader_compile_and_link":35.537,"Shader.DrawStage":33.836,"Shader.DrawStage.prepared_invocation":16.829,"Shader.DrawStage.materialize":9.906}}

  1. Labels, on the language screen. Pair: base 2c09e4328d, change 684cb22e80, both with Get-fix/AnyPS5#1, #2, #5, #8 and #10. The fps stays the same, because the screen was GPU-bound then. The committer's ~63 ms per flip under the GPU mutex is gone.
build fps frame p50 GPU busy ms/present device_lock ms/frame memory_wait ms/frame presenter render_fence_wait ms/frame
base 8.34, 8.26, 8.37 119.2 to 121.0 ms 90.2 to 91.0 68.7 to 70.0 not in the top eight not in the top eight
change 8.33, 8.32, 8.30 120.1 to 120.4 ms 90.6 to 90.9 not in the top eight 63.9 to 64.1 57.6 to 57.8

Summary lines, written before the summary had window. The two traces they name are no longer on the machine that recorded them, so they cannot be attached; the digest below is what remains:
Base: {"commit":"2c09e4328dc6","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":126,"frame_ms":{"p50":119.365,"p90":120.376,"p99":141.206,"max":141.665},"gpu_busy_ms_per_present":90.208,"top_phases_ms_per_frame":{"Driver.Packet":118.356,"Driver.Packet.device_lock":68.705,"Driver.Packet.draw":44.898,"Driver.Draw":44.572,"Driver.Draw.shader_compile_and_link":36.066,"Shader.DrawStage":34.068,"Shader.DrawStage.prepared_invocation":16.661,"Shader.DrawStage.materialize":10.099},"trace_dropped":true,"trace":"aps5-trace-2c09e4328dc6-27408.json.gz"}
Change: {"commit":"684cb22e80c4","dirty":false,"env":{...same...},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":125,"frame_ms":{"p50":120.123,"p90":121.942,"p99":123.349,"max":124.271},"gpu_busy_ms_per_present":90.867,"top_phases_ms_per_frame":{"Driver.Packet":118.599,"Driver.Packet.memory_wait":63.895,"Driver.Present":63.634,"Driver.Present.render_fence_wait":57.711,"Vulkan.Retire":57.71,"Vulkan.Retire.wait":57.702,"Driver.Packet.draw":44.046,"Driver.Draw":43.716},"trace_dropped":true,"trace":"aps5-trace-684cb22e80c4-28284.json.gz"}

tools/trace_digest.py of the two traces

Base, aps5-trace-2c09e4328dc6-27408:

seconds 120:15 from present 1906: 126 presents, frame p50 119.4 / p90 120.4 / p99 141.2 / max 141.7 ms, GPU busy 90.2 ms per present
AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 2c09e4328dc6, dropped: yes

{"commit":"2c09e4328dc6","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"seconds 120:15","first_present":1906,"ms":15104.707},"presents":126,"frame_ms":{"p50":119.365,"p90":120.376,"p99":141.206,"max":141.665},"gpu_busy_ms_per_present":90.208,"worker_busy_pct":{"queue worker 0x0":98.822},"top_phases_ms_per_frame":{"Driver.Packet":118.356,"Driver.Packet.device_lock":68.705,"Driver.Packet.draw":44.898,"Driver.Draw":44.572,"Driver.Draw.shader_compile_and_link":36.066,"Shader.DrawStage":34.068,"Shader.DrawStage.prepared_invocation":16.661,"Shader.DrawStage.materialize":10.099},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.584,"events_lost":335566,"totals_full":false}},"trace":"aps5-trace-2c09e4328dc6-27408.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 2010: 141.7 ms at 12457 ms: batch (gpu) 92.7, Driver.Present (presenter) 0.6, Driver.Present.queue_present (presenter) 0.3, Vulkan.QueuePresent (presenter) 0.3
  • present 1975: 141.2 ms at 8238 ms: batch (gpu) 92.1, Driver.Present (presenter) 0.5, Driver.Present.acquire_image (presenter) 0.2, Vulkan.Acquire (presenter) 0.2
  • present 2000: 130.4 ms at 11250 ms: batch (gpu) 91.0, Driver.Present (presenter) 0.6, Driver.Present.acquire_image (presenter) 0.3, Vulkan.Acquire (presenter) 0.3

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 49.7 (41 %) 0.1 (0 %) 70.1 22.0 Driver.Packet 49.8, Driver.EndSubmission 0.0
presenter 0.3 (0 %) 0.1 (0 %) 119.5 0.0 Driver.Present 0.4
gpu 90.2 (75 %) 0.0 (0 %) 29.7 0.0 batch 90.2

Largest slices (ms per frame, inclusive, all threads): batch 90.2, Driver.Packet 49.8, Driver.Packet.device_lock 29.7, Driver.Packet.draw 19.4, Driver.Draw 19.3, Driver.Draw.shader_compile_and_link 15.5, Shader.DrawStage 10.4, Shader.DrawStage.prepared_invocation 3.9

Longest waits

  • Vulkan.Acquire.acquire_fence_wait (presenter) 0.8 ms at 7399 ms, present 1968
  • Driver.Packet.memory_wait (queue worker 0x0) 0.6 ms at 4656 ms, present 1945
  • Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 2989 ms, present 1931
  • Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 3586 ms, present 1936
  • Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 6563 ms, present 1961
  • Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 1434 ms, present 1918
  • Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 2153 ms, present 1924
  • Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 836 ms, present 1913

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

  • batch 26579: 21.9 ms at 9759 ms, present 1987: GPU no ranges; recorded by no CPU slices
  • batch 26553: 21.8 ms at 9640 ms, present 1986: GPU no ranges; recorded by no CPU slices
  • batch 26469: 20.9 ms at 9283 ms, present 1983: GPU no ranges; recorded by no CPU slices

Change, aps5-trace-684cb22e80c4-28284:

seconds 120:15 from present 1897: 125 presents, frame p50 120.1 / p90 121.9 / p99 123.3 / max 124.3 ms, GPU busy 90.9 ms per present
AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 684cb22e80c4, dropped: yes

{"commit":"684cb22e80c4","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"seconds 120:15","first_present":1897,"ms":15014.801},"presents":125,"frame_ms":{"p50":120.123,"p90":121.942,"p99":123.349,"max":124.271},"gpu_busy_ms_per_present":90.867,"worker_busy_pct":{"queue worker 0x0":98.818},"top_phases_ms_per_frame":{"Driver.Packet":118.599,"Driver.Packet.memory_wait":63.895,"Driver.Present":63.634,"Driver.Present.render_fence_wait":57.711,"Vulkan.Retire":57.71,"Vulkan.Retire.wait":57.702,"Driver.Packet.draw":44.046,"Driver.Draw":43.716},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.736,"events_lost":323367,"totals_full":false}},"trace":"aps5-trace-684cb22e80c4-28284.json.gz"}

Slowest frames (largest slices inside each, inclusive)

  • present 1954: 124.3 ms at 6868 ms: batch (gpu) 94.4, Driver.Present (presenter) 62.3, Driver.Present.render_fence_wait (presenter) 55.8, Vulkan.Retire (presenter) 55.8
  • present 1997: 123.3 ms at 12019 ms: batch (gpu) 94.4, Driver.Present (presenter) 63.6, Driver.Present.render_fence_wait (presenter) 59.5, Vulkan.Retire (presenter) 59.5
  • present 1910: 122.9 ms at 1566 ms: Driver.Packet (queue worker 0x0) 117.1, batch (gpu) 92.2, Driver.Packet.memory_wait (queue worker 0x0) 65.6, Driver.Present (presenter) 64.6

Threads (ms per frame)

thread busy wait untraced in slices < 20 us largest
queue worker 0x0 22.7 (19 %) 28.7 (24 %) 68.7 22.3 Driver.Packet 51.3, Driver.EndSubmission 0.0
presenter 0.2 (0 %) 63.4 (53 %) 56.5 0.0 Driver.Present 63.6
gpu 90.8 (76 %) 0.0 (0 %) 29.4 0.0 batch 90.8

Largest slices (ms per frame, inclusive, all threads): batch 90.8, Driver.Present 63.6, Driver.Present.render_fence_wait 57.7, Vulkan.Retire 57.7, Vulkan.Retire.wait 57.7, Driver.Packet 51.3, Driver.Packet.memory_wait 28.7, Driver.Packet.draw 19.8

Longest waits

  • Driver.Packet.memory_wait (queue worker 0x0) 66.0 ms at 2289 ms, present 1916
  • Driver.Packet.memory_wait (queue worker 0x0) 65.6 ms at 1566 ms, present 1910
  • Driver.Packet.memory_wait (queue worker 0x0) 65.6 ms at 3615 ms, present 1927
  • Driver.Packet.memory_wait (queue worker 0x0) 65.4 ms at 1087 ms, present 1906
  • Driver.Packet.memory_wait (queue worker 0x0) 65.3 ms at 0 ms, present 1897
  • Driver.Packet.memory_wait (queue worker 0x0) 65.2 ms at 1807 ms, present 1912
  • Driver.Packet.memory_wait (queue worker 0x0) 65.0 ms at 3975 ms, present 1930
  • Driver.Packet.memory_wait (queue worker 0x0) 65.0 ms at 844 ms, present 1904

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

  • batch 25196: 22.1 ms at 11074 ms, present 1989: GPU no ranges; recorded by no CPU slices
  • batch 25249: 21.4 ms at 11312 ms, present 1991: GPU no ranges; recorded by no CPU slices
  • batch 25141: 21.2 ms at 10832 ms, present 1987: GPU no ranges; recorded by no CPU slices

In each trace the queue worker's event buffer filled 6.6 to 6.7 s into the 15 s window (trace_dropped_threads). Its later slices are missing from the trace, so the thread, slice and wait lists cover only that part of the queue worker's time.

  1. DUMP_CONST_RAM, on Monopoly's idle match board (Get-fix/AnyPS5#21 has the full runs). Pair: base 7cee08fdaf, change 4dbf61346d, both with Get-fix/AnyPS5#1, #2, #5 to #8, #10 to #15, #19 and a port of #9385. The board goes from 3.8 to 5.5 fps with alternating builds, and from 5.0 to 6.9 fps when the drain is toggled within one run.

Summary lines. These runs set no APS5_TRACE_SECONDS, so they wrote no traces; the digest below reads their summary files:
Base (7cee08fdaf):

{"commit":"7cee08fdaf5c","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"summary_every 15","first_present":3614,"ms":15055.351},"interval_start_s":241.412,"interval_end_s":256.468,"presents":59,"frame_ms":{"p50":254.65,"p90":261.307,"p99":267.663,"max":267.663},"gpu_busy_ms_per_present":41.305,"worker_busy_pct":{"queue worker 0x0":97.469},"top_phases_ms_per_frame":{"Driver.Packet":248.319,"Driver.Packet.draw":127.681,"Driver.Draw":126.316,"Driver.Packet.device_lock":94.639,"Driver.Draw.shader_compile_and_link":77.928,"Shader.DrawStage":71.931,"Shader.DrawStage.capture_resources":33.627,"Driver.Draw.draw_enqueued":32.303},"trace_dropped":false,"trace":""}

Change (4dbf61346d):

{"commit":"4dbf61346d53","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"summary_every 15","first_present":4141,"ms":15149.009},"interval_start_s":241.023,"interval_end_s":256.173,"presents":87,"frame_ms":{"p50":174.393,"p90":176.669,"p99":178.739,"max":178.739},"gpu_busy_ms_per_present":35.611,"worker_busy_pct":{"queue worker 0x0":96.217},"top_phases_ms_per_frame":{"Driver.Packet":167.135,"Driver.Packet.draw":139.377,"Driver.Draw":137.917,"Driver.Draw.shader_compile_and_link":81.631,"Shader.DrawStage":75.593,"Driver.Draw.draw_enqueued":40.305,"Shader.DrawStage.capture_resources":34.981,"Shader.DrawStage.materialize":29.453},"trace_dropped":false,"trace":""}
tools/trace_digest.py of the two runs' summary files

Base, 7cee08fdaf:

20 intervals, 0.0 to 302.0 s, 3852 presents
AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 7cee08fdaf5c

# seconds presents p50 p90 p99 max GPU busy busiest worker largest phase
1 0-15 887 16.7 16.9 17.0 192.5 1.5 99 % Driver.Packet 16.7
2 15-30 477 35.5 37.1 39.7 973.4 9.9 97 % Driver.Packet 30.5
3 30-45 412 36.0 37.5 41.5 109.5 13.7 96 % Driver.Packet 34.8
4 45-60 421 35.7 37.4 39.6 41.0 13.3 96 % Driver.Packet 34.2
5 60-75 379 38.7 47.1 51.3 112.0 13.6 96 % Driver.Packet 38.1
6 75-90 437 35.4 42.7 258.0 942.6 8.4 97 % Driver.Packet 33.4
7 90-105 65 248.7 259.8 491.9 491.9 37.8 97 % Driver.Packet 227.6
8 105-120 60 252.7 258.9 260.9 260.9 38.6 97 % Driver.Packet 245.9
9 120-136 59 254.7 261.6 265.9 265.9 38.5 97 % Driver.Packet 247.8
10 136-151 60 252.5 257.6 262.2 262.2 38.8 97 % Driver.Packet 245.5
11 151-166 60 253.0 260.1 278.8 278.8 40.0 97 % Driver.Packet 246.7
12 166-181 59 254.2 265.0 274.2 274.2 38.8 97 % Driver.Packet 248.4
13 181-196 59 254.5 260.8 266.2 266.2 39.2 97 % Driver.Packet 248.8
14 196-211 60 252.3 256.0 260.5 260.5 40.1 97 % Driver.Packet 245.4
15 211-226 60 254.0 258.9 264.2 264.2 42.0 97 % Driver.Packet 247.1
16 226-241 59 254.4 260.2 265.4 265.4 41.8 97 % Driver.Packet 247.8
17 241-256 59 254.7 261.3 267.7 267.7 41.3 97 % Driver.Packet 248.3
18 256-272 60 254.7 261.7 266.4 266.4 41.6 97 % Driver.Packet 247.1
19 272-287 59 255.2 262.2 266.5 266.5 40.9 97 % Driver.Packet 249.1
20 287-302 60 254.2 259.6 262.8 262.8 41.3 97 % Driver.Packet 246.9
p99 ms  .____+@+++++++++++++  0-491.9
gpu ms  .:---:%%%%@%%@@@@@@@  0-42.0

Change, 4dbf61346d:

20 intervals, 0.0 to 301.3 s, 4485 presents
AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 4dbf61346d53

# seconds presents p50 p90 p99 max GPU busy busiest worker largest phase
1 0-15 885 16.7 16.9 17.0 193.4 1.6 99 % Driver.Packet 16.7
2 15-30 506 32.6 34.0 35.4 950.5 10.6 97 % Driver.Packet 28.6
3 30-45 462 32.1 33.5 35.0 103.7 14.1 95 % Driver.Packet 30.8
4 45-60 475 31.6 32.6 33.8 34.0 13.7 95 % Driver.Packet 30.1
5 60-75 458 32.5 34.1 35.8 107.8 14.1 96 % Driver.Packet 31.2
6 75-90 487 32.2 33.9 159.4 824.9 9.6 96 % Driver.Packet 29.8
7 90-105 90 171.8 178.6 384.6 384.6 36.2 96 % Driver.Packet 161.2
8 105-120 86 174.8 178.0 183.1 183.1 35.8 96 % Driver.Packet 168.1
9 120-135 87 172.8 177.2 180.4 180.4 35.8 96 % Driver.Packet 165.7
10 135-150 87 173.3 176.4 179.9 179.9 36.3 96 % Driver.Packet 166.3
11 150-166 86 175.6 178.3 186.4 186.4 35.9 96 % Driver.Packet 168.6
12 166-181 86 174.9 177.4 182.0 182.0 35.9 96 % Driver.Packet 167.9
13 181-196 87 173.8 176.2 179.1 179.1 36.8 96 % Driver.Packet 166.6
14 196-211 84 177.5 190.9 200.3 200.3 36.5 96 % Driver.Packet 173.1
15 211-226 88 172.1 175.7 177.6 177.6 36.6 96 % Driver.Packet 165.5
16 226-241 87 172.9 175.8 177.8 177.8 36.6 96 % Driver.Packet 165.9
17 241-256 87 174.4 176.7 178.7 178.7 35.6 96 % Driver.Packet 167.1
18 256-271 86 175.3 178.4 183.0 183.0 35.3 96 % Driver.Packet 168.1
19 271-286 85 177.4 180.4 184.9 184.9 35.8 96 % Driver.Packet 170.3
20 286-301 86 175.0 177.8 180.2 180.2 35.5 96 % Driver.Packet 168.0
p99 ms  .____=@======+======  0-384.6
gpu ms  .----:@@@@@@@@@@@@@@  0-36.8

Row 17, 241 to 256 s, is the window of the summary lines above.

  • tools/check_conventions.py --base origin/main passes.

  • tools/pr_overlap.py lists these:

    • #11995 (josealissonbr) holds small labels behind completions that store guest memory, in WriteLabelOnGpu and the debt entry next to this branch's. Whichever lands second has to keep the unregistered import's condition.
    • #11447 (iamthehimansh) builds GuestBufferMemory.cpp on macOS and changes the include lines next to this branch's <linux/fs.h>, which then goes behind the same guard.
    • #12616 (Raghav314) changes the [capture] report line in ShaderMemory.cpp that this branch also changes.
    • #11346 (milescoviello) changes the neighbouring debt lines.
    • #9508 changes a neighbouring line of DrawPipeline.cpp.
    • The rest (#6182, #9565, #9875, #12921, #13251) share single lines of CMakeLists.txt or the recorder tests.

    None implements the same thing.

Merge of main cc26ab4438, 1 Nov. Head bebaf6e59d. The only conflict was libSceAgcDriver/CMakeLists.txt: main moved the AGC test registrations into tests/cmake, and tools/agc_test_split.py resolve moved agc_recorder_stored_bytes to the agc_driver_recorder_tests fragment. agc_recorder_stored_bytes, agc_recorder_read_list, agc_driver_queued_constant_ram_dump and agc_driver_graphics pass, 3 of 3 on the RX 9070 XT under the validation layer, no VUID- line. Not rerun: the other tests, Linux, games.

Merge of main b415263451, 1 Nov. Head 87e6918b69. Conflicts in Recorder.hpp, Recorder.cpp, tests/Recorder.cpp and docs/dev/debt/libSceVideoOut.md: this branch's LookupStoredBytes and main's UnlandedOwnLabel (with main's ANYPS5_PAD_IDENTIFY debt lines) sit side by side, and both test groups stay in the recorder runs. Windows, RX 9070 XT, same environment as above, one run of a focused set of 31: the recorder's agc_recorder_stored_bytes, agc_recorder_completion_labels and agc_recorder_command_buffer_release, agc_driver, agc_driver_same_queue_label_wait and the label-order, constant-store, idle-store and unregistered-label tests with their variants, video_out_flip_reopen and video_out_flip_padstatus. 29 passed and 2 skipped (agc_driver_copied_writer_label_order and its _drain variant: this device's minStorageBufferOffsetAlignment is 4). No VUID- line, and every selected-GPU line names the RX 9070 XT. Not rerun at this head: the other video_out_flip_* tests, agc_shader_memory, agc_driver_pm4 and its variants, Linux, and any title. The speed numbers above were not remeasured.

Merge of main 4f41f4c375, 3 Nov. Head f160886325. The only conflict was the Windows PATH list in agc_driver_recorder_tests.cmake: main's new agc_changed_copy and this branch's agc_recorder_stored_bytes are both kept. Windows, WinLibs GCC, Release, RX 9070 XT, ANYPS5_GPU=AMD ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: 19 of 19 pass, 3 of 3 runs, no VUID- line, no skip (agc_driver_queued_constant_ram_dump, agc_driver_draw_cache_reuse and its six variants, agc_driver_draw_pipeline_retired_items, agc_driver_dumped_constant_capture, both agc_driver_unregistered_label_*, agc_driver_vertex_table_read_order, agc_driver_compute_pipeline_outside_gpu_mutex, agc_driver_pm4, agc_recorder_stored_bytes, agc_changed_copy, agc_driver, video_out_flip_reopen). Not rerun: the rest of the recorder set, Linux, games.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: CUSA03312 #7198
  • GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300; lavapipe (LLVM 21.1.8) on Linux for the subset under Tested
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4973932245 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9898). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-22T20:49:54Z. --- ### What Get-fix/AnyPS5#10, #11 and #21, moved upstream as one pull request: each removes a wait the queue worker or the committer made for a store the GPU was about to make. None is PS4-only, so it goes straight on `main`. Each is its own commit, in this order: `c8e2a98755`, `df808a4807`, `f137c98218`. After review and CI, `main` is merged in (last `b7488e1ff5`, in `3cd01b28ab`) and the fixes follow, described under **Follow-ups** below. **1. Captures read recorded store bytes instead of waiting for the GPU** (Get-fix/AnyPS5#10) A PS4 title that uses the constant engine builds its descriptor tables in constant RAM and dumps them to memory with `DUMP_CONST_RAM` before each draw. While GPU work is open, `preparePacketMemory` resolves such a store (`Pm4::ResolveStore`, up to 64 KiB, also `COPY_DATA` and `DMA_DATA`) and `VulkanDevice::WriteLabelOnGpu` records it into the batch as a `vkCmdUpdateBuffer` into the host import. The range is then a pending write. The next draw's resource capture reads the dumped table through the flush hook, which submits the batch and waits for the GPU, although the driver already holds the bytes it stored. This commit lets a capture read those bytes instead of waiting: - The recorder's label table kept values only for stores up to `LabelTableBytes` (64). Wider stores were ranges only (`wideLabels`). They now keep their bytes and a record sequence too. `markOverwritten` flags them like table entries when later GPU work writes over them, and they leave with their batch as before. - `Recorder::LookupStoredBytes` composes a dword-aligned range from the newest recorded store of each dword. A table entry wins over wide stores, since a wide store erases the table entries it covers when it is noted. The lookup refuses a dword with no store, one a later GPU write covers, a label behind a completion action, any range under a queued label and, since `7aa3c8f63d`, any store of a batch whose submit has started (see **Follow-ups**). - `Driver::classifyPendingWrite` answers `KnownValue` with those bytes when the caller passes a buffer for them. Callers that do are the capture's word reads (`ShaderMemory`), `captureStable` and `validateCaptured`. Callers that pass none, and every other pending write, sync as before. The store lands after everything recorded before it and before everything recorded after it, so its bytes are what the next draw reads on the GPU. An earlier CPU store to the range is overwritten by it there as well. - `APS5_NO_STORED_KNOWN_VALUES=1` turns the path off. With `APS5_VERIFY_KNOWN_VALUES=1` each served word is also read through the hook and compared. The `[capture]` profile line now reports those counts; before this they only reached the `[copy]` line, which a title without copy kernels never prints. Nothing depends on the title: any resolved store, label or constant RAM dump that a capture reads is served the same way. **2. Labels in unregistered host memory are stored on the GPU** (Get-fix/AnyPS5#11, with its follow-up fix folded in) A label or store into memory no host import covers (`WriteLabelOnGpu` reason 3) makes the recording thread wait for all recorded work (`WaitIdle`) and then write it with the CPU. c9ab6a72a5 chose that over a store at batch reap because a later label stored on the GPU could become visible first (#1458). VideoOut's buffer labels hit that path on every PS4 flip. `PatchFlip` in libSceGnmDriver writes 1 to `VideoOutBufferLabelAddress(handle) + index * 8` with `WRITE_DATA` before the flip packet. That address is `bufferLabels` inside VideoOut's host-side config object, and no guest allocation covers it. So once per frame the draw committer ran `commitLabel`, found no import and waited for the device under the GPU mutex. The queue worker then waited for the committer at the next `DUMP_CONST_RAM`. This is the ~69 ms per frame that #10's numbers showed as `Driver.Packet.device_lock`: that timer mark covers the draw pipeline drain. This commit stores such labels on the GPU instead: - `Graphics::UnregisteredHostImport` imports the pages holding the label's bytes, rounded to the device's import alignment. It does so only when no guest allocation range overlaps them and, on Windows, every page is committed `MEM_PRIVATE` memory with exactly `PAGE_READWRITE` protection in a single allocation. - `WriteLabelOnGpu` uses that import when `HostImportFor` finds none. It records the store into the open batch as for any imported label, and `Recorder::Keep`s the import with that batch so the buffer outlives the store. - The GPU stores the label in stream order after the work before it, as the console's CP does. A later label cannot become visible first, and nothing waits. - Memory that fails the checks (image or mapped sections, read-only, guard or no-access pages, ranges spanning allocations, partly registered pages) or whose import fails still returns reason 3 and waits as today. Since `c14d8edb47` Linux checks the pages too (one private anonymous read-write mapping in `/proc/self/maps`), and since `cd2e19f6f9` the import is made only while no copied writer is listed and no completion store is pending. - The `libSceAgcDriver` debt entry for unimported labels now names what still waits. Nothing depends on the title: any `RELEASE_MEM`, `WRITE_DATA`, `DMA_DATA`, `COPY_DATA` or `DUMP_CONST_RAM` target in host memory outside the guest registry takes this path (VideoOut's buffer labels, a label on a native thread stack). The commit also carries the follow-up `75bc9a49b7` from Get-fix/AnyPS5#11, which fixes a driver test the import broke. A `DMA_DATA` copy over 64 KiB into host memory that no import covers waits for the batches that write its source (`Recorder::SyncThrough`) and copies on the CPU, unless something can still store over its destination; then it drains the device. Before the first commit, a label into such memory was written by the CPU after a drain, so nothing was pending there. Now that label is a GPU store in the open batch, and `agc_driver`'s copy behind a label into its destination drained. - The copy now waits for the batches that store into its destination, as it already did for its source, and then checks again. - Only what still stores there after that wait drains as before: a storage image's write-back, a unit shadow, or a label another queue has not recorded yet. **3. `DUMP_CONST_RAM` is queued behind pipelined draws** (Get-fix/AnyPS5#21) A `DUMP_CONST_RAM` (PM4 0x83) on the graphics queue drained the draw pipeline. `keepsDrawPipeline` does not keep 0x83, so the queue worker waited until the committer had recorded every queued draw, then `preparePacketMemory` recorded the dump's GPU store itself. A PS4 title's constant engine dumps a descriptor table before many of its draws. On the board of Monopoly Plus (CUSA03312), `APS5_PROFILE_DRAW`'s `[draw] pipelined` line counted 4,700 to 5,400 drains a second, nearly all by opcode 0x83, and the worker waited 3.0 to 3.5 s of every 10 s in them. This commit queues the dump instead: - The worker copies the dumped constant RAM words when it reaches the packet (`Pm4::ResolveStore`, as before) and queues their store as a pipeline item (`Driver::enqueueConstantRamDump`). The committer records it in stream order with the draws around it through the same store path as a queued DMA_DATA store (`Driver::commitStore`, renamed from `commitDmaStore`). - The item keeps the bytes it stores. `DrawPipeline::StoredBytes` answers for a range from the newest queued item that writes it: that item's bytes when it is a store covering the whole range, unknown when it is any other item. - `Driver::queryPendingWrite` gives a capture those bytes as known values instead of draining, and drains as before when the answer is unknown. A page under a queued store is read word by word without draining. With `APS5_VERIFY_KNOWN_VALUES=1` it drains first, so each served word is checked against the stored one. The other reads the worker makes between the enqueue and the commit: - Cached draw and dispatch variant validation, fill inputs, dispatch inputs, predication and the `0x63`/`0x64`/`0x9f` packets already drain on an overlap with any queued write (`DrawPipeline::Overlaps`); the queued store's range is one. - A `WAIT_REG_MEM` on a dumped word reads the queued value through `DrawPipeline::PendingLabel`, which reads the stored bytes of a store item as it does a label's. - The vertex-table decode of a program with an AGC header (`Graphics::DecodeVertexStageInfo`, attribute words and vertex V#s) drains and decodes again when its reads overlap a queued write. This branch first added that drain itself; `main`'s #7691 (`DecodeOrderedVertexStageInfo`) now does it, and the merge keeps `main`'s helper. PS4 programs have no AGC header, so this never runs for them. - Raw shader code and user-data callee code are read at addresses from registers, as with queued draws and fills before; a dump is not expected over shader code. Dumps the worker cannot resolve, dumps outside writable guest memory, predicated dumps and dumps while labels are deferred take the old path. A dump of no words stores nothing and no longer drains. `APS5_PIPELINE_DRAIN_DUMPS=1` restores the drain for every dump, like `APS5_PIPELINE_DRAIN_FILLS` for fills. `main`'s draw pipeline now also orders queued reads (`Enqueue`'s `reads`, `HeldReads`), counts queued writes and runs draws through the optional draw finisher (`APS5_DRAW_PIPELINE`). `EnqueueStore` goes through the same enqueue, which drains a busy finisher first; a queued store item carries no reads; and `StoredBytes` refuses a range the finisher still holds as well as anything a queued non-store item writes. **Follow-ups after review and CI** - `71bcb4a8d2` merges `main` `9c6d153dec`. The resolution keeps `main`'s draw pipeline, finisher and packet loop, and takes `main`'s ordered vertex-table decode (#7691) in `Draw.cpp`. `WriteLabelOnGpu` keeps the unregistered import ahead of #8180's completion stores. - `cd2e19f6f9` fixes the Linux CI failure of `agc_driver_compute_pipeline_outside_gpu_mutex` ("the first dispatch stored 0"): - Cause: the dispatch writes memory no import covers, which the driver holds as a CPU copy and writes back at the reap. The `WRITE_DATA` after it was stored by the GPU into an unregistered import, so the label was visible first. - Through #8180 such a label would instead be stored at the reap, where it can land over a store the host made once the GPU work was done. VideoOut stores 0 into the previous buffer's label after a flip. - Fix: the unregistered import is now made only while no copied writer is listed and no completion store is pending. Otherwise the label waits and is written by the CPU, as before this branch. - `7aa3c8f63d` (first review, point 1): recorded store bytes are refused once their batch's submit has started. - Before, a guest that waited for a label behind a dump could rewrite the dumped range with the CPU, and a capture before the reap read the old bytes. - Each batch sets an atomic `submitStarted` before `vkQueueSubmit`. The lookup does not query the fence: captures run without the GPU mutex, and a label in the middle of a batch is visible before its fence signals. - `c14d8edb47` (first review, point 3): on Linux, `UnregisteredHostImport` checks that the range lies inside one private anonymous read-write mapping (`rw-p`, inode 0). An import does not fail for every such page: AMD's Windows driver imports a mapped view of a section. - `0a08a3b019`: `main` now queues queue-0 `DMA_DATA` by default (ce6865fc0d). Its committed copy into host memory now waits for the batches that store into its destination, as the immediate path above does. `agc_driver` failed without it. - `3cd01b28ab` merges `main` `b7488e1ff5`. - `0bc7829562` fixes the heap corruption XairRrR found (`agc_driver_queued_constant_ram_dump` aborting on Linux with `free(): chunks in smallbin corrupted`): - Cause: `DrawPipeline::enqueue` and `DrawFinisher::Enqueue` left retired items in a thread-local vector until the thread's next enqueue. At thread exit that vector is destroyed with the thread's other thread-locals, in reverse order of construction. `~ShaderMemory`, reached from a retired draw item, returns its pages to `pagePool()`, also a thread-local on Linux. If the pool was constructed after the vector it is already gone, and the page goes into its freed buffer. ASan on the unfixed tree reports a heap-use-after-free at that `emplace_back`, from `__call_tls_dtors`. - This is destruction order at thread exit, not a lifetime problem during play, and it is not specific to queued dumps. The test's main thread enqueues and first touches the pool at its second enqueue. `APS5_PIPELINE_DRAIN_DUMPS=1` only hid it, because the test then stops at its first assert, before that second enqueue. `main` has the same two vectors. - Fix: both vectors are emptied before `Enqueue` returns, after the lock is released, so nothing is left in them at thread exit. They keep their storage. - `70d8cce27d` (first review, point 2, option B as chosen on this pull request): `VideoOutDriver::Open` waits for the driver (`AgcDriverWaitIdle`) before it replaces a closed port's configuration. - Without it, a close and reopen with a flip in flight could free `VideoOutConfig::bufferLabels` before the batch with PatchFlip's GPU store ran. - The wait runs without the driver mutex, and `Open` checks the port again afterwards, since another `Open` may have run meanwhile. - A queue stalled on something the title does only after `sceVideoOutOpen` returns stalls the reopen with it. That limit is in the `libSceVideoOut` debt file. - `4647d9c464`: the Linux page check uses the `PROCMAP_QUERY` ioctl on `/proc/self/maps` (Linux 6.11 and later), and reads the file as text only when the ioctl fails. - `fb1551442b` merges `main` `de2ba4cecb`. Two conflicts, both lines added on each side: the recorder tests' `PATH` list in `CMakeLists.txt` and the argument dispatch in `tests/Recorder.cpp`. Both sides are kept. The per-label import is not cached: an import that outlived its batch would pin memory its owner may free, and host memory has no hook to invalidate it. On the RX 9070 XT a label into unregistered memory costs about 300 us (a registered one 0.4 us), against the ~63 ms wait it replaces. The Linux check takes 0.4 us with the ioctl at any depth; the text fallback takes up to 11 ms at 20,000 mappings (about 0.6 us per mapping ahead of the label's). ### Tested **Merge of `main` `d1ae628bc2`, 3 Nov, and a variant-validation fix.** Head `b8c3f25cdf` (merge `f070b16201`). Conflicts: the `[capture]` profile line in `ShaderMemory.cpp` (main's line with this branch's known-value verified/mismatch counters), the option list in `tests/Recorder.cpp` (both kept) and the Windows `PATH` list in `agc_driver_recorder_tests.cmake` (main's list plus `agc_recorder_stored_bytes`). After the merge, `agc_driver_queued_constant_ram_dump` failed on AMD as oneandonlydean reported: a later draw reused a cached variant and `Driver::validateVariant` drained with `DrainReason::Capture`. `b8c3f25cdf`: when every queued item over the variant's runs is a store whose bytes the pipeline holds, `validateVariant` returns `Differing` without draining, so the capture serves the queued bytes; other overlaps, and `APS5_VERIFY_KNOWN_VALUES`, still drain. Comparing the queued bytes with the variant and keeping it when they matched was tried first and is wrong: the later data-word check reads guest memory that still holds the old table, and draw 1 wrote 64 instead of 255. Windows, WinLibs GCC, Release, AMD RX 9070 XT, validation layer, `ANYPS5_NO_SHADER_CACHE=1`: `agc_driver_queued_constant_ram_dump` fails on the merge without the fix (1 capture drain) and passes 3/3 with it, and passes with `APS5_VERIFY_KNOWN_VALUES=1`; 49/49 of the focused set pass (`draw_cache_relocation*`, `draw_cache_reuse*`, `draw_data_hit_user_words*`, `dispatch_data_hit_words`, `draw_pipeline_*`, the `*_draw_pipeline` variants of bda span, buffer load/store, copied writer, depth storage reuse, unsupported buffer type and write ranges, `dumped_constant_capture`, both `unregistered_label_*`, `agc_driver_recorder`, `agc_recorder_*`, `agc_queued_write_groups`); `agc_recorder_kept_bytes` was not built. No `VUID-`, 54 device lines all RX 9070 XT. `check_conventions.py` passed. Not rerun: the same set on `main`, Linux, the full suite, games, and a paired trace for the speed claim. **Merge of `main` `f2d874c1fd`, 1 Nov.** Head `a814af06ee`. The only conflict was in the Linux includes of `GuestBufferMemory.cpp`: `main`'s macOS `udmabuf` stand-in and this branch's `<linux/fs.h>` (for `PROCMAP_QUERY`) are both kept, with `<linux/fs.h>` on the non-Apple side. On the RX 9070 XT, 13 of 13 pass with no `VUID-` line and every device line naming it: `agc_driver`, `agc_driver_pm4`, `agc_shader_memory`, `agc_driver_compute_pipeline_outside_gpu_mutex`, `agc_driver_draw_pipeline_retired_items`, `agc_driver_dumped_constant_capture`, `agc_driver_queued_constant_ram_dump`, `agc_driver_unregistered_label_behind_write_back`, `agc_driver_unregistered_label_on_gpu`, `agc_driver_vertex_table_read_order`, `agc_recorder_stored_bytes`, `agc_recorder_command_buffer_release`, `video_out_flip_reopen`. Linux: WSL Ubuntu, g++ 15.2.0 compiled `GuestBufferMemory.cpp` and `PipelineJournal.cpp` only (the merge changed no struct under the size guards); nothing was linked or run there. Not rerun: the rest of the focused set, each test only once rather than three times, macOS, games. Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT (driver 32.0.31041.1004), Vulkan SDK 1.4.363.0. Every run used `ANYPS5_GPU=AMD`, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, with `ctest -V`, three times each, on `main` `b7488e1ff5` and on this branch at `4647d9c464`. The current head `fb1551442b` (`main` `de2ba4cecb` merged) had the smaller rerun in the last row and the note under the table. - Focused set: `agc_driver`, `agc_shader_memory`, `agc_driver_pm4` and its mode and replay tests, `agc_driver_compute_pipeline_outside_gpu_mutex`, every pipelined, label, constant-store, copied-writer and DMA test with their draw-pipeline variants, `agc_driver_vertex_table_read_order`, the recorder tests and `video_out_flip_*`. That is 176 tests on `main`, plus this branch's 6 on the branch. | | tests | passed | skipped | failed | |---|---|---|---|---| | `main` `b7488e1ff5`, each of 3 runs | 176 | 174 | 2 | 0 | | branch `4647d9c464`, runs 1 and 2 | 182 | 180 | 2 | 0 | | branch `4647d9c464`, run 3 | 182 | 179 | 2 | 1 | | head `fb1551442b`, each of 3 runs | 166 | 164 | 2 | 0 | - Rerun at `fb1551442b`: the focused set without its 17 `video_out_flip_*` tests, plus `main`'s new `agc_recorder_command_buffer_release`, which is the 166 above. Both tests behind the conflicts passed in all three runs: `agc_recorder_stored_bytes` and `agc_recorder_command_buffer_release`. `video_out_flip_reopen` and `main`'s new `video_out_flip_padstatus` ran once and passed. Same environment, no `VUID-` or missing-layer lines, and every device line names the RX 9070 XT. - Not rerun at `fb1551442b`: the other 16 `video_out_flip_*` tests, the mutations below, anything on Linux, and `main` `de2ba4cecb`, so the `main` comparison is still the `b7488e1ff5` row. Notes on the runs at `4647d9c464`: - The one failure is `agc_driver_pm4_ring` in run 3, after 0.05 s: "replace guest placeholder with private memory: Attempt to access invalid address", from `Commit` in libc's `WindowsMappings.hpp` while the process sets up the guest arena. This branch does not touch libc. I repeated the test 40 times on each build: 40 of 40 on both. I have not found the cause. - The skips are `agc_driver_copied_writer_label_order` and its drain variant: the device's `minStorageBufferOffsetAlignment` of 4 binds the record in place. - No log contains a `VUID-` line or `was not found but was requested by env var VK_INSTANCE_LAYERS`, and every device line names the RX 9070 XT. - New and changed tests, each failing without its part of the change. Every row was run on `4647d9c464`, 3 of 3 runs, and not repeated at `fb1551442b`: | test | without | |---|---| | `agc_driver_dumped_constant_capture`, dump read by the next capture | with `APS5_NO_STORED_KNOWN_VALUES=1`: "the capture of the draw after a constant RAM dump recorded on the GPU waited for the GPU instead of reading the dumped words" | | `agc_driver_dumped_constant_capture`, CPU write after the dump's label | `7aa3c8f63d`'s wide-store check, or the flag: "the draw after the guest rewrote a dumped constant to 0.5 once the label behind the dump had landed wrote 255" | | `agc_recorder_stored_bytes` | `7aa3c8f63d`'s wide-store check: "a wide store is served after its batch was submitted"; its table check: "a label-table store is served after its batch was submitted" | | `agc_driver_unregistered_label_on_gpu` | no unregistered import: "a label in unregistered host memory returned reason 3 instead of 0"; no `MEM_PRIVATE` check: "a label in a mapped view of a section returned reason 0 instead of 3" | | `agc_driver_unregistered_label_behind_write_back`, 8-byte label after a write-back | `!listed` for labels: "its store landed over the 0 the host stored once the GPU work was done" (reason 5) | | the same, 16-byte store after a write-back | `!listed` for stores: "held 0x6b6b0001 once the GPU ran its batch (reason 0), while the dispatch's record still held 0xc0001000" | | the same, 8-byte label after a completion store | `!storesPending` for labels: "it landed over the 0 the host stored once the GPU work was done" | | the same, 16-byte store after a completion store | `!storesPending` for stores: "held 0x1 once the GPU ran its batch (reason 0), while the earlier label in registered memory, stored when its batch is reaped, still held 0x0" | | `agc_driver_queued_constant_ram_dump` | with `APS5_PIPELINE_DRAIN_DUMPS=1`: "a DUMP_CONST_RAM drained the draw pipeline 1 times" | | `agc_driver` | `0a08a3b019`: "a copy into host memory drained instead of syncing its source" | | `agc_driver_draw_pipeline_retired_items` | the clear in `DrawPipeline::enqueue`: "a retired draw pipeline item stayed in the enqueuing thread's storage after Enqueue returned"; in `DrawFinisher::Enqueue`: "a finished draw finisher job stayed..." | | `video_out_flip_reopen` (a flip and a label store of the old configuration gated behind the queue) | `70d8cce27d`'s wait: "reopen replaced the port's configuration while a flip and a label store of the previous one were in flight" | - The CI failure, reproduced on the RX 9070 XT: a local copy of `agc_driver_compute_pipeline_outside_gpu_mutex` with its slots in `VirtualAlloc` memory (`MEM_PRIVATE`, so it is imported) failed "the first dispatch stored 0" in 5 of 5 runs with the import behaving as at `bd31efba93`, and passed 5 of 5 with `cd2e19f6f9`. The test file in this pull request is unchanged. On Windows the test's own static arrays are `MEM_IMAGE` and take the wait. - Linux, all at `4647d9c464`, before the merge of `de2ba4cecb` (WSL Ubuntu, g++ 15.2, Release, Unix Makefiles, lavapipe with LLVM 21.1.8, no validation layer installed). I bypassed two configure checks in that copy only, for the XRandR and audio development files; nothing else differs from that commit. - Ran: the focused set as it exists on Linux, 157 tests: 133 passed, 24 skipped, 0 failed. Passed there include `agc_driver`, `agc_driver_compute_pipeline_outside_gpu_mutex`, `agc_driver_queued_constant_ram_dump`, `agc_driver_copied_writer_label_order` and its drain variant, and the Linux cases of `agc_driver_unregistered_label_on_gpu`. - Skipped there: all 16 `video_out_flip_*` tests including `video_out_flip_reopen` (SDL has no X11 or Wayland in that copy, so no Vulkan window), and 8 tests whose device needs are not met on lavapipe (host imports of watched memory, deferred settles, a pipeline cache). **So the VideoOut reopen test has not run on Linux.** - `agc_driver_queued_constant_ram_dump`: at the unfixed merge `3cd01b28ab`, 5 runs gave 3 aborts with `free(): chunks in smallbin corrupted`, 1 segfault and 1 pass. At `4647d9c464`, 20 of 20 pass. - ASan (`ANYPS5_ENABLE_ASAN=ON`): at `3cd01b28ab`, a heap-use-after-free as described above. At `4647d9c464`, 0 errors in `agc_driver_queued_constant_ram_dump` (3 runs), `agc_driver_draw_pipeline_retired_items`, both unregistered label tests, `agc_driver_dumped_constant_capture` and `agc_driver_compute_pipeline_outside_gpu_mutex`. - The page check, both paths, in a harness against real mappings: heap, private anonymous, read-only, a range into a read-only page, `PROT_NONE`, shared anonymous, a private file mapping, the stack and an unmapped address. 0 failures on either path. The text fallback has run only there, since this kernel (6.18) has the ioctl. - `Graphics/src/PipelineJournal.cpp` and `core/shader/recompiler/ShaderDiskCache.cpp`, with their Linux-only `sizeof` guards, compile. `main` was not built on Linux. The merge of `de2ba4cecb` changes neither file, nor a guard or guarded struct in AGC, and Linux was not compiled again at `fb1551442b`. The numbers below were measured before the follow-ups. Since then, recorded store bytes are served only while their batch is open, and an unregistered label waits while a copied writer or completion store is pending. Each can bring back part of a wait the numbers show removed. No game was run for this update, and the title still needs #9432 to run on `main`, so this is not the `main` comparison MarcZX10 and XairRrR ask for. **Monopoly Plus (CUSA03312).** The title doesn't run on `main`: it needs #9430 to #9432. As agreed on #6977, these numbers come from `ps4/limbo-gpu` at `93eeee0141` (#6977's head then), with and without the change, on the local stack the title needs to start: the Get-fix pull requests named with each pair, and local stand-ins for `sceGnmDrawInitDefaultHardwareState200` and `sceGnmUpdate*Shader`. The base and change commits named with each pair are commits of that local stack, which isn't published. Base and change alternated on the same machine and scene. 1. Captures, on the language screen. Pair: base `9c5c8619f7`, change `2c09e4328d`, both with Get-fix/AnyPS5#1, #2, #5 and #8: | build | fps | frame p50 | GPU busy ms/present | `shader_compile_and_link` ms/frame | `capture_resources` ms/frame | `device_lock` ms/frame | |---|---|---|---|---|---|---| | base | 6.08, 6.06, 6.07 | 163.6 to 164.5 ms | 97.6 to 97.8 | 142.3 to 142.4 | 112.0 to 112.9 | not in the top eight | | change | 8.33, 8.23, 8.36 | 119.1 to 121.5 ms | 89.6 to 91.0 | 35.5 to 37.1 | not in the top eight | 67.7 to 69.2 | Summary lines, written before the summary had `trace` and `window`: Base: `{"commit":"9c5c8619f7ab","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":92,"frame_ms":{"p50":163.553,"p90":169.755,"p99":179.944},"gpu_busy_ms_per_present":97.573,"top_phases_ms_per_frame":{"Driver.Packet":162.891,"Driver.Packet.draw":151.459,"Driver.Draw":151.119,"Driver.Draw.shader_compile_and_link":142.416,"Shader.DrawStage":140.547,"Shader.DrawStage.capture_resources":112.045,"Shader.DrawStage.prepared_invocation":17.515,"Shader.DrawStage.materialize":10.915}}` Change: `{"commit":"2c09e4328dc6","dirty":false,"env":{...same...},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","presents":125,"frame_ms":{"p50":119.541,"p90":122.234,"p99":126.64},"gpu_busy_ms_per_present":90.018,"top_phases_ms_per_frame":{"Driver.Packet":118.492,"Driver.Packet.device_lock":69.187,"Driver.Packet.draw":44.439,"Driver.Draw":44.12,"Driver.Draw.shader_compile_and_link":35.537,"Shader.DrawStage":33.836,"Shader.DrawStage.prepared_invocation":16.829,"Shader.DrawStage.materialize":9.906}}` 2. Labels, on the language screen. Pair: base `2c09e4328d`, change `684cb22e80`, both with Get-fix/AnyPS5#1, #2, #5, #8 and #10. The fps stays the same, because the screen was GPU-bound then. The committer's ~63 ms per flip under the GPU mutex is gone. | build | fps | frame p50 | GPU busy ms/present | `device_lock` ms/frame | `memory_wait` ms/frame | presenter `render_fence_wait` ms/frame | |---|---|---|---|---|---|---| | base | 8.34, 8.26, 8.37 | 119.2 to 121.0 ms | 90.2 to 91.0 | 68.7 to 70.0 | not in the top eight | not in the top eight | | change | 8.33, 8.32, 8.30 | 120.1 to 120.4 ms | 90.6 to 90.9 | not in the top eight | 63.9 to 64.1 | 57.6 to 57.8 | Summary lines, written before the summary had `window`. The two traces they name are no longer on the machine that recorded them, so they cannot be attached; the digest below is what remains: Base: `{"commit":"2c09e4328dc6","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":126,"frame_ms":{"p50":119.365,"p90":120.376,"p99":141.206,"max":141.665},"gpu_busy_ms_per_present":90.208,"top_phases_ms_per_frame":{"Driver.Packet":118.356,"Driver.Packet.device_lock":68.705,"Driver.Packet.draw":44.898,"Driver.Draw":44.572,"Driver.Draw.shader_compile_and_link":36.066,"Shader.DrawStage":34.068,"Shader.DrawStage.prepared_invocation":16.661,"Shader.DrawStage.materialize":10.099},"trace_dropped":true,"trace":"aps5-trace-2c09e4328dc6-27408.json.gz"}` Change: `{"commit":"684cb22e80c4","dirty":false,"env":{...same...},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","presents":125,"frame_ms":{"p50":120.123,"p90":121.942,"p99":123.349,"max":124.271},"gpu_busy_ms_per_present":90.867,"top_phases_ms_per_frame":{"Driver.Packet":118.599,"Driver.Packet.memory_wait":63.895,"Driver.Present":63.634,"Driver.Present.render_fence_wait":57.711,"Vulkan.Retire":57.71,"Vulkan.Retire.wait":57.702,"Driver.Packet.draw":44.046,"Driver.Draw":43.716},"trace_dropped":true,"trace":"aps5-trace-684cb22e80c4-28284.json.gz"}` <details><summary><code>tools/trace_digest.py</code> of the two traces</summary> Base, `aps5-trace-2c09e4328dc6-27408`: **seconds 120:15** from present 1906: 126 presents, frame p50 119.4 / p90 120.4 / p99 141.2 / max 141.7 ms, GPU busy 90.2 ms per present AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 2c09e4328dc6, dropped: yes ```json {"commit":"2c09e4328dc6","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"seconds 120:15","first_present":1906,"ms":15104.707},"presents":126,"frame_ms":{"p50":119.365,"p90":120.376,"p99":141.206,"max":141.665},"gpu_busy_ms_per_present":90.208,"worker_busy_pct":{"queue worker 0x0":98.822},"top_phases_ms_per_frame":{"Driver.Packet":118.356,"Driver.Packet.device_lock":68.705,"Driver.Packet.draw":44.898,"Driver.Draw":44.572,"Driver.Draw.shader_compile_and_link":36.066,"Shader.DrawStage":34.068,"Shader.DrawStage.prepared_invocation":16.661,"Shader.DrawStage.materialize":10.099},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.584,"events_lost":335566,"totals_full":false}},"trace":"aps5-trace-2c09e4328dc6-27408.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 2010: 141.7 ms at 12457 ms: batch (gpu) 92.7, Driver.Present (presenter) 0.6, Driver.Present.queue_present (presenter) 0.3, Vulkan.QueuePresent (presenter) 0.3 - present 1975: 141.2 ms at 8238 ms: batch (gpu) 92.1, Driver.Present (presenter) 0.5, Driver.Present.acquire_image (presenter) 0.2, Vulkan.Acquire (presenter) 0.2 - present 2000: 130.4 ms at 11250 ms: batch (gpu) 91.0, Driver.Present (presenter) 0.6, Driver.Present.acquire_image (presenter) 0.3, Vulkan.Acquire (presenter) 0.3 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 49.7 (41 %) | 0.1 (0 %) | 70.1 | 22.0 | Driver.Packet 49.8, Driver.EndSubmission 0.0 | | presenter | 0.3 (0 %) | 0.1 (0 %) | 119.5 | 0.0 | Driver.Present 0.4 | | gpu | 90.2 (75 %) | 0.0 (0 %) | 29.7 | 0.0 | batch 90.2 | **Largest slices** (ms per frame, inclusive, all threads): batch 90.2, Driver.Packet 49.8, Driver.Packet.device_lock 29.7, Driver.Packet.draw 19.4, Driver.Draw 19.3, Driver.Draw.shader_compile_and_link 15.5, Shader.DrawStage 10.4, Shader.DrawStage.prepared_invocation 3.9 **Longest waits** - Vulkan.Acquire.acquire_fence_wait (presenter) 0.8 ms at 7399 ms, present 1968 - Driver.Packet.memory_wait (queue worker 0x0) 0.6 ms at 4656 ms, present 1945 - Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 2989 ms, present 1931 - Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 3586 ms, present 1936 - Driver.Packet.memory_wait (queue worker 0x0) 0.5 ms at 6563 ms, present 1961 - Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 1434 ms, present 1918 - Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 2153 ms, present 1924 - Driver.Packet.memory_wait (queue worker 0x0) 0.4 ms at 836 ms, present 1913 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 26579: 21.9 ms at 9759 ms, present 1987: GPU no ranges; recorded by no CPU slices - batch 26553: 21.8 ms at 9640 ms, present 1986: GPU no ranges; recorded by no CPU slices - batch 26469: 20.9 ms at 9283 ms, present 1983: GPU no ranges; recorded by no CPU slices Change, `aps5-trace-684cb22e80c4-28284`: **seconds 120:15** from present 1897: 125 presents, frame p50 120.1 / p90 121.9 / p99 123.3 / max 124.3 ms, GPU busy 90.9 ms per present AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 684cb22e80c4, dropped: yes ```json {"commit":"684cb22e80c4","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:15","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"seconds 120:15","first_present":1897,"ms":15014.801},"presents":125,"frame_ms":{"p50":120.123,"p90":121.942,"p99":123.349,"max":124.271},"gpu_busy_ms_per_present":90.867,"worker_busy_pct":{"queue worker 0x0":98.818},"top_phases_ms_per_frame":{"Driver.Packet":118.599,"Driver.Packet.memory_wait":63.895,"Driver.Present":63.634,"Driver.Present.render_fence_wait":57.711,"Vulkan.Retire":57.71,"Vulkan.Retire.wait":57.702,"Driver.Packet.draw":44.046,"Driver.Draw":43.716},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":6.736,"events_lost":323367,"totals_full":false}},"trace":"aps5-trace-684cb22e80c4-28284.json.gz"} ``` **Slowest frames** (largest slices inside each, inclusive) - present 1954: 124.3 ms at 6868 ms: batch (gpu) 94.4, Driver.Present (presenter) 62.3, Driver.Present.render_fence_wait (presenter) 55.8, Vulkan.Retire (presenter) 55.8 - present 1997: 123.3 ms at 12019 ms: batch (gpu) 94.4, Driver.Present (presenter) 63.6, Driver.Present.render_fence_wait (presenter) 59.5, Vulkan.Retire (presenter) 59.5 - present 1910: 122.9 ms at 1566 ms: Driver.Packet (queue worker 0x0) 117.1, batch (gpu) 92.2, Driver.Packet.memory_wait (queue worker 0x0) 65.6, Driver.Present (presenter) 64.6 **Threads** (ms per frame) | thread | busy | wait | untraced | in slices < 20 us | largest | |---|---|---|---|---|---| | queue worker 0x0 | 22.7 (19 %) | 28.7 (24 %) | 68.7 | 22.3 | Driver.Packet 51.3, Driver.EndSubmission 0.0 | | presenter | 0.2 (0 %) | 63.4 (53 %) | 56.5 | 0.0 | Driver.Present 63.6 | | gpu | 90.8 (76 %) | 0.0 (0 %) | 29.4 | 0.0 | batch 90.8 | **Largest slices** (ms per frame, inclusive, all threads): batch 90.8, Driver.Present 63.6, Driver.Present.render_fence_wait 57.7, Vulkan.Retire 57.7, Vulkan.Retire.wait 57.7, Driver.Packet 51.3, Driver.Packet.memory_wait 28.7, Driver.Packet.draw 19.8 **Longest waits** - Driver.Packet.memory_wait (queue worker 0x0) 66.0 ms at 2289 ms, present 1916 - Driver.Packet.memory_wait (queue worker 0x0) 65.6 ms at 1566 ms, present 1910 - Driver.Packet.memory_wait (queue worker 0x0) 65.6 ms at 3615 ms, present 1927 - Driver.Packet.memory_wait (queue worker 0x0) 65.4 ms at 1087 ms, present 1906 - Driver.Packet.memory_wait (queue worker 0x0) 65.3 ms at 0 ms, present 1897 - Driver.Packet.memory_wait (queue worker 0x0) 65.2 ms at 1807 ms, present 1912 - Driver.Packet.memory_wait (queue worker 0x0) 65.0 ms at 3975 ms, present 1930 - Driver.Packet.memory_wait (queue worker 0x0) 65.0 ms at 844 ms, present 1904 **Largest GPU batches** (GPU ranges inside, and the CPU slices that recorded each, inclusive) - batch 25196: 22.1 ms at 11074 ms, present 1989: GPU no ranges; recorded by no CPU slices - batch 25249: 21.4 ms at 11312 ms, present 1991: GPU no ranges; recorded by no CPU slices - batch 25141: 21.2 ms at 10832 ms, present 1987: GPU no ranges; recorded by no CPU slices In each trace the queue worker's event buffer filled 6.6 to 6.7 s into the 15 s window (`trace_dropped_threads`). Its later slices are missing from the trace, so the thread, slice and wait lists cover only that part of the queue worker's time. </details> 3. `DUMP_CONST_RAM`, on Monopoly's idle match board (Get-fix/AnyPS5#21 has the full runs). Pair: base `7cee08fdaf`, change `4dbf61346d`, both with Get-fix/AnyPS5#1, #2, #5 to #8, #10 to #15, #19 and a port of #9385. The board goes from 3.8 to 5.5 fps with alternating builds, and from 5.0 to 6.9 fps when the drain is toggled within one run. Summary lines. These runs set no `APS5_TRACE_SECONDS`, so they wrote no traces; the digest below reads their summary files: Base (`7cee08fdaf`): ```json {"commit":"7cee08fdaf5c","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"summary_every 15","first_present":3614,"ms":15055.351},"interval_start_s":241.412,"interval_end_s":256.468,"presents":59,"frame_ms":{"p50":254.65,"p90":261.307,"p99":267.663,"max":267.663},"gpu_busy_ms_per_present":41.305,"worker_busy_pct":{"queue worker 0x0":97.469},"top_phases_ms_per_frame":{"Driver.Packet":248.319,"Driver.Packet.draw":127.681,"Driver.Draw":126.316,"Driver.Packet.device_lock":94.639,"Driver.Draw.shader_compile_and_link":77.928,"Shader.DrawStage":71.931,"Shader.DrawStage.capture_resources":33.627,"Driver.Draw.draw_enqueued":32.303},"trace_dropped":false,"trace":""} ``` Change (`4dbf61346d`): ```json {"commit":"4dbf61346d53","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_RESIDENT_LINEAR":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"15"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.8.1 (LLPC)","os":"Windows 10.0.26300","resolution":"1920x1080","window":{"spec":"summary_every 15","first_present":4141,"ms":15149.009},"interval_start_s":241.023,"interval_end_s":256.173,"presents":87,"frame_ms":{"p50":174.393,"p90":176.669,"p99":178.739,"max":178.739},"gpu_busy_ms_per_present":35.611,"worker_busy_pct":{"queue worker 0x0":96.217},"top_phases_ms_per_frame":{"Driver.Packet":167.135,"Driver.Packet.draw":139.377,"Driver.Draw":137.917,"Driver.Draw.shader_compile_and_link":81.631,"Shader.DrawStage":75.593,"Driver.Draw.draw_enqueued":40.305,"Shader.DrawStage.capture_resources":34.981,"Shader.DrawStage.materialize":29.453},"trace_dropped":false,"trace":""} ``` <details><summary><code>tools/trace_digest.py</code> of the two runs' summary files</summary> Base, `7cee08fdaf`: **20 intervals**, 0.0 to 302.0 s, 3852 presents AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 7cee08fdaf5c | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase | |---|---|---|---|---|---|---|---|---|---| | 1 | 0-15 | 887 | 16.7 | 16.9 | 17.0 | 192.5 | 1.5 | 99 % | Driver.Packet 16.7 | | 2 | 15-30 | 477 | 35.5 | 37.1 | 39.7 | 973.4 | 9.9 | 97 % | Driver.Packet 30.5 | | 3 | 30-45 | 412 | 36.0 | 37.5 | 41.5 | 109.5 | 13.7 | 96 % | Driver.Packet 34.8 | | 4 | 45-60 | 421 | 35.7 | 37.4 | 39.6 | 41.0 | 13.3 | 96 % | Driver.Packet 34.2 | | 5 | 60-75 | 379 | 38.7 | 47.1 | 51.3 | 112.0 | 13.6 | 96 % | Driver.Packet 38.1 | | 6 | 75-90 | 437 | 35.4 | 42.7 | 258.0 | 942.6 | 8.4 | 97 % | Driver.Packet 33.4 | | 7 | 90-105 | 65 | 248.7 | 259.8 | 491.9 | 491.9 | 37.8 | 97 % | Driver.Packet 227.6 | | 8 | 105-120 | 60 | 252.7 | 258.9 | 260.9 | 260.9 | 38.6 | 97 % | Driver.Packet 245.9 | | 9 | 120-136 | 59 | 254.7 | 261.6 | 265.9 | 265.9 | 38.5 | 97 % | Driver.Packet 247.8 | | 10 | 136-151 | 60 | 252.5 | 257.6 | 262.2 | 262.2 | 38.8 | 97 % | Driver.Packet 245.5 | | 11 | 151-166 | 60 | 253.0 | 260.1 | 278.8 | 278.8 | 40.0 | 97 % | Driver.Packet 246.7 | | 12 | 166-181 | 59 | 254.2 | 265.0 | 274.2 | 274.2 | 38.8 | 97 % | Driver.Packet 248.4 | | 13 | 181-196 | 59 | 254.5 | 260.8 | 266.2 | 266.2 | 39.2 | 97 % | Driver.Packet 248.8 | | 14 | 196-211 | 60 | 252.3 | 256.0 | 260.5 | 260.5 | 40.1 | 97 % | Driver.Packet 245.4 | | 15 | 211-226 | 60 | 254.0 | 258.9 | 264.2 | 264.2 | 42.0 | 97 % | Driver.Packet 247.1 | | 16 | 226-241 | 59 | 254.4 | 260.2 | 265.4 | 265.4 | 41.8 | 97 % | Driver.Packet 247.8 | | 17 | 241-256 | 59 | 254.7 | 261.3 | 267.7 | 267.7 | 41.3 | 97 % | Driver.Packet 248.3 | | 18 | 256-272 | 60 | 254.7 | 261.7 | 266.4 | 266.4 | 41.6 | 97 % | Driver.Packet 247.1 | | 19 | 272-287 | 59 | 255.2 | 262.2 | 266.5 | 266.5 | 40.9 | 97 % | Driver.Packet 249.1 | | 20 | 287-302 | 60 | 254.2 | 259.6 | 262.8 | 262.8 | 41.3 | 97 % | Driver.Packet 246.9 | ``` p99 ms .____+@+++++++++++++ 0-491.9 gpu ms .:---:%%%%@%%@@@@@@@ 0-42.0 ``` Change, `4dbf61346d`: **20 intervals**, 0.0 to 301.3 s, 4485 presents AMD Radeon RX 9070 XT, AMD proprietary driver 26.8.1 (LLPC), Windows 10.0.26300, 1920x1080, commit 4dbf61346d53 | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase | |---|---|---|---|---|---|---|---|---|---| | 1 | 0-15 | 885 | 16.7 | 16.9 | 17.0 | 193.4 | 1.6 | 99 % | Driver.Packet 16.7 | | 2 | 15-30 | 506 | 32.6 | 34.0 | 35.4 | 950.5 | 10.6 | 97 % | Driver.Packet 28.6 | | 3 | 30-45 | 462 | 32.1 | 33.5 | 35.0 | 103.7 | 14.1 | 95 % | Driver.Packet 30.8 | | 4 | 45-60 | 475 | 31.6 | 32.6 | 33.8 | 34.0 | 13.7 | 95 % | Driver.Packet 30.1 | | 5 | 60-75 | 458 | 32.5 | 34.1 | 35.8 | 107.8 | 14.1 | 96 % | Driver.Packet 31.2 | | 6 | 75-90 | 487 | 32.2 | 33.9 | 159.4 | 824.9 | 9.6 | 96 % | Driver.Packet 29.8 | | 7 | 90-105 | 90 | 171.8 | 178.6 | 384.6 | 384.6 | 36.2 | 96 % | Driver.Packet 161.2 | | 8 | 105-120 | 86 | 174.8 | 178.0 | 183.1 | 183.1 | 35.8 | 96 % | Driver.Packet 168.1 | | 9 | 120-135 | 87 | 172.8 | 177.2 | 180.4 | 180.4 | 35.8 | 96 % | Driver.Packet 165.7 | | 10 | 135-150 | 87 | 173.3 | 176.4 | 179.9 | 179.9 | 36.3 | 96 % | Driver.Packet 166.3 | | 11 | 150-166 | 86 | 175.6 | 178.3 | 186.4 | 186.4 | 35.9 | 96 % | Driver.Packet 168.6 | | 12 | 166-181 | 86 | 174.9 | 177.4 | 182.0 | 182.0 | 35.9 | 96 % | Driver.Packet 167.9 | | 13 | 181-196 | 87 | 173.8 | 176.2 | 179.1 | 179.1 | 36.8 | 96 % | Driver.Packet 166.6 | | 14 | 196-211 | 84 | 177.5 | 190.9 | 200.3 | 200.3 | 36.5 | 96 % | Driver.Packet 173.1 | | 15 | 211-226 | 88 | 172.1 | 175.7 | 177.6 | 177.6 | 36.6 | 96 % | Driver.Packet 165.5 | | 16 | 226-241 | 87 | 172.9 | 175.8 | 177.8 | 177.8 | 36.6 | 96 % | Driver.Packet 165.9 | | 17 | 241-256 | 87 | 174.4 | 176.7 | 178.7 | 178.7 | 35.6 | 96 % | Driver.Packet 167.1 | | 18 | 256-271 | 86 | 175.3 | 178.4 | 183.0 | 183.0 | 35.3 | 96 % | Driver.Packet 168.1 | | 19 | 271-286 | 85 | 177.4 | 180.4 | 184.9 | 184.9 | 35.8 | 96 % | Driver.Packet 170.3 | | 20 | 286-301 | 86 | 175.0 | 177.8 | 180.2 | 180.2 | 35.5 | 96 % | Driver.Packet 168.0 | ``` p99 ms .____=@======+====== 0-384.6 gpu ms .----:@@@@@@@@@@@@@@ 0-36.8 ``` Row 17, 241 to 256 s, is the window of the summary lines above. </details> - `tools/check_conventions.py --base origin/main` passes. - `tools/pr_overlap.py` lists these: - #11995 (josealissonbr) holds small labels behind completions that store guest memory, in `WriteLabelOnGpu` and the debt entry next to this branch's. Whichever lands second has to keep the unregistered import's condition. - #11447 (iamthehimansh) builds `GuestBufferMemory.cpp` on macOS and changes the include lines next to this branch's `<linux/fs.h>`, which then goes behind the same guard. - #12616 (Raghav314) changes the `[capture]` report line in `ShaderMemory.cpp` that this branch also changes. - #11346 (milescoviello) changes the neighbouring debt lines. - #9508 changes a neighbouring line of `DrawPipeline.cpp`. - The rest (#6182, #9565, #9875, #12921, #13251) share single lines of `CMakeLists.txt` or the recorder tests. None implements the same thing. **Merge of `main` `cc26ab4438`, 1 Nov.** Head `bebaf6e59d`. The only conflict was `libSceAgcDriver/CMakeLists.txt`: `main` moved the AGC test registrations into `tests/cmake`, and `tools/agc_test_split.py resolve` moved `agc_recorder_stored_bytes` to the `agc_driver_recorder_tests` fragment. `agc_recorder_stored_bytes`, `agc_recorder_read_list`, `agc_driver_queued_constant_ram_dump` and `agc_driver_graphics` pass, 3 of 3 on the RX 9070 XT under the validation layer, no `VUID-` line. Not rerun: the other tests, Linux, games. **Merge of `main` `b415263451`, 1 Nov.** Head `87e6918b69`. Conflicts in `Recorder.hpp`, `Recorder.cpp`, `tests/Recorder.cpp` and `docs/dev/debt/libSceVideoOut.md`: this branch's `LookupStoredBytes` and `main`'s `UnlandedOwnLabel` (with `main`'s `ANYPS5_PAD_IDENTIFY` debt lines) sit side by side, and both test groups stay in the recorder runs. Windows, RX 9070 XT, same environment as above, one run of a focused set of 31: the recorder's `agc_recorder_stored_bytes`, `agc_recorder_completion_labels` and `agc_recorder_command_buffer_release`, `agc_driver`, `agc_driver_same_queue_label_wait` and the label-order, constant-store, idle-store and unregistered-label tests with their variants, `video_out_flip_reopen` and `video_out_flip_padstatus`. 29 passed and 2 skipped (`agc_driver_copied_writer_label_order` and its `_drain` variant: this device's `minStorageBufferOffsetAlignment` is 4). No `VUID-` line, and every selected-GPU line names the RX 9070 XT. Not rerun at this head: the other `video_out_flip_*` tests, `agc_shader_memory`, `agc_driver_pm4` and its variants, Linux, and any title. The speed numbers above were not remeasured. **Merge of `main` `4f41f4c375`, 3 Nov.** Head `f160886325`. The only conflict was the Windows `PATH` list in `agc_driver_recorder_tests.cmake`: main's new `agc_changed_copy` and this branch's `agc_recorder_stored_bytes` are both kept. Windows, WinLibs GCC, Release, RX 9070 XT, `ANYPS5_GPU=AMD ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: 19 of 19 pass, 3 of 3 runs, no `VUID-` line, no skip (`agc_driver_queued_constant_ram_dump`, `agc_driver_draw_cache_reuse` and its six variants, `agc_driver_draw_pipeline_retired_items`, `agc_driver_dumped_constant_capture`, both `agc_driver_unregistered_label_*`, `agc_driver_vertex_table_read_order`, `agc_driver_compute_pipeline_outside_gpu_mutex`, `agc_driver_pm4`, `agc_recorder_stored_bytes`, `agc_changed_copy`, `agc_driver`, `video_out_flip_reopen`). Not rerun: the rest of the recorder set, Linux, games. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: CUSA03312 #7198 - [x] GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.31041.1004, Windows 11 Pro 26300; lavapipe (LLVM 21.1.8) on Linux for the subset under Tested - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
XairRrR commented 2026-10-29 03:25:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T03:25:47Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

On current main (Linux, NVIDIA) the new test agc_driver_queued_constant_ram_dump aborts in every run with heap corruption. The PR also conflicts with main, and the VideoOut use-after-free that a maintainer asked to fix with option B is still open on this head.

What I ran

  • Head: 0a08a3b019ccac0cd15dbf78339a79f9746e7e54
  • main: 3a2b91981651569163768854a1fcdc7193b6667b (the branch is based on 9c6d153dec, 3,794 commits behind)
  • Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree.

git merge of the head into main conflicts in two files (see Blocking 1). Both conflicts are mechanical. To build and test the change against current main, I resolved them locally: main's lines, plus this branch's agc_recorder_stored_bytes entry and APS5_PIPELINE_DRAIN_DUMPS row. Everything below ran on that resolved merge.

git fetch origin main pull/9898/head:refs/review/9898
git checkout --detach origin/main
git merge --no-ff --no-edit refs/review/9898      # conflicts: CMakeLists.txt, ENVIRONMENT.md -> resolved by hand
git diff --check origin/main...refs/review/9898
python3 tools/check_conventions.py --base origin/main
cmake build && cmake --build build -j10 --target <the 24 test executables below> \
  agc_driver_dumped_constant_capture_tests agc_driver_queued_constant_ram_dump_tests \
  agc_driver_unregistered_label_behind_write_back_tests agc_driver_unregistered_label_on_gpu_tests libs
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 -j4 -V -R '<60 tests: agc_driver, agc_shader_memory,
  agc_recorder_stored_bytes, agc_recorder_read_list, agc_driver_pm4*, every *label*, *dma*, *pipelined* AGC test,
  agc_driver_copied_writer*, agc_driver_constant_store*, agc_driver_compute_pipeline_outside_gpu_mutex,
  agc_driver_vertex_table_read_order*, and the 4 new execution tests>'
# repeats of the failing test, with and without the validation layer (5 + 5)
ctest --test-dir build -R '^agc_driver_queued_constant_ram_dump$' --output-on-failure
# localisation
APS5_PIPELINE_DRAIN_DUMPS=1 | APS5_NO_STORED_KNOWN_VALUES=1 | APS5_VERIFY_KNOWN_VALUES=1  build/tests/agc_driver_queued_constant_ram_dump_tests
gdb -batch -ex run -ex 'call (int)fflush(0)' -ex bt build/tests/agc_driver_queued_constant_ram_dump_tests
LD_PRELOAD=libc_malloc_debug.so.0 MALLOC_CHECK_=3 gdb ... build/tests/agc_driver_queued_constant_ram_dump_tests
# negative control by flag
APS5_NO_STORED_KNOWN_VALUES=1 build/tests/agc_driver_dumped_constant_capture_tests

Results

Check Result
Merge into main 3a2b919816 Conflicts in core/libs/prx/libSceAgcDriver/CMakeLists.txt and docs/dev/ENVIRONMENT.md
git diff --check clean
tools/check_conventions.py --base origin/main All conventions checks passed.
Build (affected tests + libs, resolved merge) OK, exit 0
Focused set, 60 tests, validation layer 59 passed, 1 failed: agc_driver_queued_constant_ram_dump (Subprocess aborted)
agc_driver_queued_constant_ram_dump repeats aborted 10 of 10 (5 with the validation layer, 5 without): free(): chunks in smallbin corrupted
New tests agc_recorder_stored_bytes, agc_driver_dumped_constant_capture, agc_driver_unregistered_label_on_gpu, agc_driver_unregistered_label_behind_write_back Passed. Each printed its pass line and none skipped. This includes the Linux cases of unregistered_label_on_gpu (read-only page, private file mapping, shared anonymous mapping), which the description says first run in CI.
agc_driver_compute_pipeline_outside_gpu_mutex (the earlier CI failure) Passed
agc_driver, agc_driver_copied_writer_* Passed, including agc_driver_copied_writer_label_order, which this device does not skip
VUID- lines in the merged-tree log 0
was not found but was requested by env var VK_INSTANCE_LAYERS 0; every device line names the RTX 4070 Ti SUPER
Test duration Longest 6.1 s; the whole set took 13.9 s with -j4
agc_driver_queued_constant_ram_dump, ctest
26/60 Test #1349: agc_driver_queued_constant_ram_dump .........................Subprocess aborted***Exception:   1.20 sec
1349: free(): chunks in smallbin corrupted
98% tests passed, 1 tests failed out of 60
Localisation

Under gdb, with stdout flushed at the abort, both cases of the test print their success line first, and the abort follows on another thread as it exits:

three draws around two queued constant RAM dumps read 2 dumped words without draining the draw pipeline
the vertex table decode of a draw waited for the queued dump of its attribute table
free(): chunks in smallbin corrupted
Thread 17 "agc_driver_queu" received signal SIGABRT, Aborted.
#2  abort () from libc.so.6
#4-#7 (malloc internals) from libc.so.6
#8  ?? () from libstdc++.so.6
#9  ?? () from libc.so.6   (thread start/exit)

With libc_malloc_debug.so and MALLOC_CHECK_=3, the invalid free shows up at process exit instead, while thread-local storage is destroyed. It happens in a retired DrawPipeline::Item vector, which is the thread-local reclaim vector that DrawPipeline::enqueue swaps retired items into:

free(): invalid pointer
#6  free () from libc_malloc_debug.so.0
#7  AgcDriver::ShaderMemory::~ShaderMemory()
#8  Driver::finishDraw(...)::{lambda()#9}::~PerformanceTimer()
#9  std::_Sp_counted_base<>::_M_release()
#10 std::_Function_handler<void (), Driver::finishDraw(...)::{lambda()#10}>::_M_manager
#11 std::vector<DrawPipeline::Item>::~vector()
#12 __call_tls_dtors () from libc.so.6
#14 exit ()
variant outcome
default abort, free(): chunks in smallbin corrupted (2 of 2)
APS5_NO_STORED_KNOWN_VALUES=1 same abort (2 of 2)
APS5_VERIFY_KNOWN_VALUES=1 same abort (2 of 2)
APS5_PIPELINE_DRAIN_DUMPS=1 (old path) no abort; clean failure a DUMP_CONST_RAM drained the draw pipeline 1 times (2 of 2), as expected

Negative control

I did not restore the production files from main and rebuild. A second libSceAgcDriver rebuild did not fit the time I had. Instead I used the switches the PR adds, which put back main's behaviour on the path each test covers:

  • APS5_NO_STORED_KNOWN_VALUES=1: agc_driver_dumped_constant_capture fails with "the capture of the draw after a constant RAM dump recorded on the GPU waited for the GPU instead of reading the dumped words" (exit 1).
  • APS5_PIPELINE_DRAIN_DUMPS=1: agc_driver_queued_constant_ram_dump fails with "a DUMP_CONST_RAM drained the draw pipeline 1 times".

Both match the description's table. I did not reproduce the per-condition negative controls for UnregisteredLabelBehindWriteBack and UnregisteredLabelOnGpu.

Findings

Blocking

  1. agc_driver_queued_constant_ram_dump aborts with heap corruption on Linux, every run (core/libs/prx/libSceAgcDriver/tests/execution/QueuedConstantRamDump.cpp). Both cases pass their assertions, then the process dies with free(): chunks in smallbin corrupted: 10 of 10 runs, with and without the validation layer. The abort goes away only with APS5_PIPELINE_DRAIN_DUMPS=1, so it is tied to the queued-dump path (Driver::enqueueConstantRamDump → DrawPipeline::EnqueueStore), not to the stored-known-values lookup. The malloc-debug backtrace points at teardown: a DrawPipeline::Item holding a finishDraw lambda, and through it a ShaderMemory, is freed from the thread-local reclaim vector in DrawPipeline::enqueue during __call_tls_dtors, which is after AgcDriverShutdown_nid_postfix(). I have not established whether this is a production lifetime bug that only teardown exposes, or a test teardown problem (the test enqueues a held item on its own thread and then shuts the driver down). Either way, the test fails as merged, and a heap corruption should be understood before the path is enabled by default. Please run it under ASan on Linux, or with libc_malloc_debug as above, and fix whichever side it is. Your Windows runs were on the 9c6d153dec base, so this may also come from main's newer draw pipeline or finisher code.

  2. The PR conflicts with current main.

    • core/libs/prx/libSceAgcDriver/CMakeLists.txt, in the if(WIN32) set_tests_properties(agc_recorder_read_list ...) list: main added agc_driver_recorder and agc_repeat_storage_guard, and this branch adds agc_recorder_stored_bytes.
    • docs/dev/ENVIRONMENT.md: main extended the APS5_PIPELINE_DISPATCH row, and this branch adds the APS5_PIPELINE_DRAIN_DUMPS row after it.

    Both resolutions are mechanical. The base is far behind, though, so please merge or rebase and rerun the focused set. Finding 1 is what that set shows on current main.

  3. The VideoOut buffer-label use-after-free is still open, and the fix the maintainer chose is not on this head. Your reply laid out the gap, and on 2026-10-25 the maintainer chose option B: Open waits for the previous configuration's outstanding GPU work, plus a close/reopen regression test. 0a08a3b019 predates that answer. I checked the path on the merged tree:

    • UnregisteredHostImport (Graphics/src/GuestBufferMemory.cpp:4238) imports the pages of VideoOutConfig::bufferLabels (libSceVideoOut/include/VideoOutDriver.hpp:155).
    • WriteLabelOnGpu keeps only the Vulkan import with the batch (Execution/src/VulkanDevice.cpp:2520, :2534), not the heap object behind it.
    • VideoOutDriver::Open replaces contexts[handle] (libSceVideoOut/src/VideoOutDriver.cpp:386-402), and processFlip releases a request on a closed config at :579, :596 and :638 without waiting for the GPU.

    So a close and reopen with a flip in flight can free the config before the batch holding PatchFlip's 8-byte store runs. On main, the CPU writes that label after WaitIdle. This is a new memory-safety regression on a reachable path, so it belongs in this PR, not in a debt entry. The new debt text at docs/dev/debt/libSceAgcDriver.md:163 does not mention it either.

Non-blocking

  1. Linux page check cost. privateAnonymousReadWrite (Graphics/src/GuestBufferMemory.cpp:4214) opens and parses all of /proc/self/maps on every label into unregistered memory, and UnregisteredHostImport creates a new host-pointer import (vkAllocateMemory + vkCreateBuffer) for each one. Both happen inside WriteLabelOnGpu, under the GPU mutex, at least once per PS4 flip. A relinked title can have thousands of mappings. Consider caching the import per page (or the checked range), keyed by the mapping, or show in a trace that the cost is negligible.

  2. Perf evidence. I agree with MarcZX10's earlier point and have nothing new to add. The measurements come from an unpublished local stack on another base, and the body says they predate the follow-ups, which may bring back part of the removed waits. The second pair's traces are announced as "will be attached by hand", but I don't see them on the PR. CONTRIBUTING asks for both traces.

Not verified

  • The PR head on its own 9c6d153dec base. I only built and tested the resolved merge into current main.
  • The main-only run of the focused tests. The merged-tree log has zero VUID- lines, so the change adds none on this GPU.
  • A negative control made by restoring the production files from main. I used the PR's own switches instead (see above).
  • Windows, AMD, and lavapipe. Whether the abort in Blocking 1 happens on Windows on current main.
  • The root cause of the heap corruption.
  • No game was run.

To get this to a good state

  1. Merge or rebase onto current main and resolve the two conflicts.
  2. Find and fix the heap corruption that makes agc_driver_queued_constant_ram_dump abort on Linux. Report an ASan or malloc-debug run of that test.
  3. Implement option B: VideoOutDriver::Open waits for the previous config's outstanding GPU work before replacing it. Add a close/reopen regression test with a label store in flight.
  4. Rerun the focused set on the new head, with the validation layer, on main and on the change, and update the Tested section.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692490406 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9898#pullrequestreview-5692490406). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-29T03:25:47Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested On current `main` (Linux, NVIDIA) the new test `agc_driver_queued_constant_ram_dump` aborts in every run with heap corruption. The PR also conflicts with `main`, and the VideoOut use-after-free that a maintainer asked to fix with option B is still open on this head. ## What I ran - Head: `0a08a3b019ccac0cd15dbf78339a79f9746e7e54` - `main`: `3a2b91981651569163768854a1fcdc7193b6667b` (the branch is based on `9c6d153dec`, 3,794 commits behind) - Machine: Arch Linux 7.2.11-zen, GCC 16.2.1, Release, Ninja, Intel Core i9-14900KF, NVIDIA GeForce RTX 4070 Ti SUPER (driver 615.78.08), in a clean worktree. `git merge` of the head into `main` conflicts in two files (see Blocking 1). Both conflicts are mechanical. To build and test the change against current `main`, I resolved them locally: `main`'s lines, plus this branch's `agc_recorder_stored_bytes` entry and `APS5_PIPELINE_DRAIN_DUMPS` row. Everything below ran on that resolved merge. ```sh git fetch origin main pull/9898/head:refs/review/9898 git checkout --detach origin/main git merge --no-ff --no-edit refs/review/9898 # conflicts: CMakeLists.txt, ENVIRONMENT.md -> resolved by hand git diff --check origin/main...refs/review/9898 python3 tools/check_conventions.py --base origin/main cmake build && cmake --build build -j10 --target <the 24 test executables below> \ agc_driver_dumped_constant_capture_tests agc_driver_queued_constant_ram_dump_tests \ agc_driver_unregistered_label_behind_write_back_tests agc_driver_unregistered_label_on_gpu_tests libs 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 -j4 -V -R '<60 tests: agc_driver, agc_shader_memory, agc_recorder_stored_bytes, agc_recorder_read_list, agc_driver_pm4*, every *label*, *dma*, *pipelined* AGC test, agc_driver_copied_writer*, agc_driver_constant_store*, agc_driver_compute_pipeline_outside_gpu_mutex, agc_driver_vertex_table_read_order*, and the 4 new execution tests>' # repeats of the failing test, with and without the validation layer (5 + 5) ctest --test-dir build -R '^agc_driver_queued_constant_ram_dump$' --output-on-failure # localisation APS5_PIPELINE_DRAIN_DUMPS=1 | APS5_NO_STORED_KNOWN_VALUES=1 | APS5_VERIFY_KNOWN_VALUES=1 build/tests/agc_driver_queued_constant_ram_dump_tests gdb -batch -ex run -ex 'call (int)fflush(0)' -ex bt build/tests/agc_driver_queued_constant_ram_dump_tests LD_PRELOAD=libc_malloc_debug.so.0 MALLOC_CHECK_=3 gdb ... build/tests/agc_driver_queued_constant_ram_dump_tests # negative control by flag APS5_NO_STORED_KNOWN_VALUES=1 build/tests/agc_driver_dumped_constant_capture_tests ``` ## Results | Check | Result | |---|---| | Merge into `main` `3a2b919816` | **Conflicts** in `core/libs/prx/libSceAgcDriver/CMakeLists.txt` and `docs/dev/ENVIRONMENT.md` | | `git diff --check` | clean | | `tools/check_conventions.py --base origin/main` | `All conventions checks passed.` | | Build (affected tests + `libs`, resolved merge) | OK, exit 0 | | Focused set, 60 tests, validation layer | 59 passed, **1 failed**: `agc_driver_queued_constant_ram_dump` (Subprocess aborted) | | `agc_driver_queued_constant_ram_dump` repeats | **aborted 10 of 10** (5 with the validation layer, 5 without): `free(): chunks in smallbin corrupted` | | New tests `agc_recorder_stored_bytes`, `agc_driver_dumped_constant_capture`, `agc_driver_unregistered_label_on_gpu`, `agc_driver_unregistered_label_behind_write_back` | Passed. Each printed its pass line and none skipped. This includes the Linux cases of `unregistered_label_on_gpu` (read-only page, private file mapping, shared anonymous mapping), which the description says first run in CI. | | `agc_driver_compute_pipeline_outside_gpu_mutex` (the earlier CI failure) | Passed | | `agc_driver`, `agc_driver_copied_writer_*` | Passed, including `agc_driver_copied_writer_label_order`, which this device does not skip | | `VUID-` lines in the merged-tree log | 0 | | `was not found but was requested by env var VK_INSTANCE_LAYERS` | 0; every device line names the RTX 4070 Ti SUPER | | Test duration | Longest 6.1 s; the whole set took 13.9 s with `-j4` | <details><summary>agc_driver_queued_constant_ram_dump, ctest</summary> ``` 26/60 Test #1349: agc_driver_queued_constant_ram_dump .........................Subprocess aborted***Exception: 1.20 sec 1349: free(): chunks in smallbin corrupted 98% tests passed, 1 tests failed out of 60 ``` </details> <details><summary>Localisation</summary> Under gdb, with stdout flushed at the abort, both cases of the test print their success line first, and the abort follows on another thread as it exits: ``` three draws around two queued constant RAM dumps read 2 dumped words without draining the draw pipeline the vertex table decode of a draw waited for the queued dump of its attribute table free(): chunks in smallbin corrupted Thread 17 "agc_driver_queu" received signal SIGABRT, Aborted. #2 abort () from libc.so.6 #4-#7 (malloc internals) from libc.so.6 #8 ?? () from libstdc++.so.6 #9 ?? () from libc.so.6 (thread start/exit) ``` With `libc_malloc_debug.so` and `MALLOC_CHECK_=3`, the invalid free shows up at process exit instead, while thread-local storage is destroyed. It happens in a retired `DrawPipeline::Item` vector, which is the thread-local reclaim vector that `DrawPipeline::enqueue` swaps retired items into: ``` free(): invalid pointer #6 free () from libc_malloc_debug.so.0 #7 AgcDriver::ShaderMemory::~ShaderMemory() #8 Driver::finishDraw(...)::{lambda()#9}::~PerformanceTimer() #9 std::_Sp_counted_base<>::_M_release() #10 std::_Function_handler<void (), Driver::finishDraw(...)::{lambda()#10}>::_M_manager #11 std::vector<DrawPipeline::Item>::~vector() #12 __call_tls_dtors () from libc.so.6 #14 exit () ``` | variant | outcome | |---|---| | default | abort, `free(): chunks in smallbin corrupted` (2 of 2) | | `APS5_NO_STORED_KNOWN_VALUES=1` | same abort (2 of 2) | | `APS5_VERIFY_KNOWN_VALUES=1` | same abort (2 of 2) | | `APS5_PIPELINE_DRAIN_DUMPS=1` (old path) | no abort; clean failure `a DUMP_CONST_RAM drained the draw pipeline 1 times` (2 of 2), as expected | </details> ## Negative control I did not restore the production files from `main` and rebuild. A second `libSceAgcDriver` rebuild did not fit the time I had. Instead I used the switches the PR adds, which put back `main`'s behaviour on the path each test covers: - `APS5_NO_STORED_KNOWN_VALUES=1`: `agc_driver_dumped_constant_capture` fails with "the capture of the draw after a constant RAM dump recorded on the GPU waited for the GPU instead of reading the dumped words" (exit 1). - `APS5_PIPELINE_DRAIN_DUMPS=1`: `agc_driver_queued_constant_ram_dump` fails with "a DUMP_CONST_RAM drained the draw pipeline 1 times". Both match the description's table. I did not reproduce the per-condition negative controls for `UnregisteredLabelBehindWriteBack` and `UnregisteredLabelOnGpu`. ## Findings ### Blocking 1. **`agc_driver_queued_constant_ram_dump` aborts with heap corruption on Linux, every run** (`core/libs/prx/libSceAgcDriver/tests/execution/QueuedConstantRamDump.cpp`). Both cases pass their assertions, then the process dies with `free(): chunks in smallbin corrupted`: 10 of 10 runs, with and without the validation layer. The abort goes away only with `APS5_PIPELINE_DRAIN_DUMPS=1`, so it is tied to the queued-dump path (`Driver::enqueueConstantRamDump` → `DrawPipeline::EnqueueStore`), not to the stored-known-values lookup. The malloc-debug backtrace points at teardown: a `DrawPipeline::Item` holding a `finishDraw` lambda, and through it a `ShaderMemory`, is freed from the thread-local reclaim vector in `DrawPipeline::enqueue` during `__call_tls_dtors`, which is after `AgcDriverShutdown_nid_postfix()`. I have not established whether this is a production lifetime bug that only teardown exposes, or a test teardown problem (the test enqueues a held item on its own thread and then shuts the driver down). Either way, the test fails as merged, and a heap corruption should be understood before the path is enabled by default. Please run it under ASan on Linux, or with `libc_malloc_debug` as above, and fix whichever side it is. Your Windows runs were on the `9c6d153dec` base, so this may also come from `main`'s newer draw pipeline or finisher code. 2. **The PR conflicts with current `main`.** - `core/libs/prx/libSceAgcDriver/CMakeLists.txt`, in the `if(WIN32)` `set_tests_properties(agc_recorder_read_list ...)` list: `main` added `agc_driver_recorder` and `agc_repeat_storage_guard`, and this branch adds `agc_recorder_stored_bytes`. - `docs/dev/ENVIRONMENT.md`: `main` extended the `APS5_PIPELINE_DISPATCH` row, and this branch adds the `APS5_PIPELINE_DRAIN_DUMPS` row after it. Both resolutions are mechanical. The base is far behind, though, so please merge or rebase and rerun the focused set. Finding 1 is what that set shows on current `main`. 3. **The VideoOut buffer-label use-after-free is still open, and the fix the maintainer chose is not on this head.** Your reply laid out the gap, and on 2026-10-25 the maintainer chose option B: `Open` waits for the previous configuration's outstanding GPU work, plus a close/reopen regression test. `0a08a3b019` predates that answer. I checked the path on the merged tree: - `UnregisteredHostImport` (`Graphics/src/GuestBufferMemory.cpp:4238`) imports the pages of `VideoOutConfig::bufferLabels` (`libSceVideoOut/include/VideoOutDriver.hpp:155`). - `WriteLabelOnGpu` keeps only the Vulkan import with the batch (`Execution/src/VulkanDevice.cpp:2520`, `:2534`), not the heap object behind it. - `VideoOutDriver::Open` replaces `contexts[handle]` (`libSceVideoOut/src/VideoOutDriver.cpp:386-402`), and `processFlip` releases a request on a closed config at `:579`, `:596` and `:638` without waiting for the GPU. So a close and reopen with a flip in flight can free the config before the batch holding PatchFlip's 8-byte store runs. On `main`, the CPU writes that label after `WaitIdle`. This is a new memory-safety regression on a reachable path, so it belongs in this PR, not in a debt entry. The new debt text at `docs/dev/debt/libSceAgcDriver.md:163` does not mention it either. ### Non-blocking 1. **Linux page check cost.** `privateAnonymousReadWrite` (`Graphics/src/GuestBufferMemory.cpp:4214`) opens and parses all of `/proc/self/maps` on every label into unregistered memory, and `UnregisteredHostImport` creates a new host-pointer import (`vkAllocateMemory` + `vkCreateBuffer`) for each one. Both happen inside `WriteLabelOnGpu`, under the GPU mutex, at least once per PS4 flip. A relinked title can have thousands of mappings. Consider caching the import per page (or the checked range), keyed by the mapping, or show in a trace that the cost is negligible. 2. **Perf evidence.** I agree with MarcZX10's earlier point and have nothing new to add. The measurements come from an unpublished local stack on another base, and the body says they predate the follow-ups, which may bring back part of the removed waits. The second pair's traces are announced as "will be attached by hand", but I don't see them on the PR. CONTRIBUTING asks for both traces. ## Not verified - The PR head on its own `9c6d153dec` base. I only built and tested the resolved merge into current `main`. - The `main`-only run of the focused tests. The merged-tree log has zero `VUID-` lines, so the change adds none on this GPU. - A negative control made by restoring the production files from `main`. I used the PR's own switches instead (see above). - Windows, AMD, and lavapipe. Whether the abort in Blocking 1 happens on Windows on current `main`. - The root cause of the heap corruption. - No game was run. ## To get this to a good state 1. Merge or rebase onto current `main` and resolve the two conflicts. 2. Find and fix the heap corruption that makes `agc_driver_queued_constant_ram_dump` abort on Linux. Report an ASan or malloc-debug run of that test. 3. Implement option B: `VideoOutDriver::Open` waits for the previous config's outstanding GPU work before replacing it. Add a close/reopen regression test with a label store in flight. 4. Rerun the focused set on the new head, with the validation layer, on `main` and on the change, and update the Tested section.
XairRrR commented 2026-11-03 06:52:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T06:52:20Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

This pull request does not merge cleanly into main (d1ae628bc2): head a814af06ee conflicts in

  • core/libs/prx/libSceAgcDriver/Execution/src/ShaderMemory.cpp
  • core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
  • core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake

Please rebase it onto current main. I will review the change once it merges cleanly.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5748215347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9898#pullrequestreview-5748215347). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T06:52:20Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested This pull request does not merge cleanly into `main` (d1ae628bc2f62459cce1e9872ba5632c938c71f2): head a814af06eea95d51748bcc209817e1791134ff2d conflicts in - `core/libs/prx/libSceAgcDriver/Execution/src/ShaderMemory.cpp` - `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` - `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_recorder_tests.cmake` Please rebase it onto current `main`. I will review the change once it merges cleanly. <!-- anyps5-bots job=2967 head=a814af06eea95d51748bcc209817e1791134ff2d -->
XairRrR commented 2026-11-03 07:51:17 +00:00 (Migrated from github.com)

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

Review: APPROVED


Re-checked — approved

The three blocking findings from my last review are resolved: heap corruption, conflicts with main, and the VideoOut use-after-free. The new commits are the retired-item clears (0bc7829562), the wait in VideoOut Open (70d8cce27d), PROCMAP_QUERY (4647d9c464), the variant-validation recapture (b8c3f25cdf) and merges of main up to d1ae628bc2. They build and pass here, and the negative controls for the new and changed tests fail as expected.

What changed since my last review

Since 0a08a3b019:

  • 0bc7829562 empties the thread-local reclaim vectors before Enqueue returns, and adds agc_driver_draw_pipeline_retired_items.
  • 70d8cce27d (option B, as the maintainer chose) makes VideoOutDriver::Open call AgcDriverWaitIdle before it replaces a closed port's configuration. It also reworks video_out_flip_reopen and adds entries to the debt files.
  • 4647d9c464 adds a PROCMAP_QUERY ioctl path for the Linux page check, falling back to the text parse.
  • b8c3f25cdf: validateVariant returns Differing instead of draining when only queued stores overlap a cached variant. This answers oneandonlydean's report of 2026-11-03.
  • Merges of main, the latest d1ae628bc2. The description and the author's reply were updated to match.

What I ran

  • Head b8c3f25cdf9de1f0ef2b9300a15964f738a33808, main d1ae628bc2f62459cce1e9872ba5632c938c71f2, merged with --no-ff (no conflicts).
  • Machine: Debian 13 VM, 32 vCPU Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19), kernel 6.12, so the PROCMAP_QUERY path is the one exercised.
git diff --check d1ae628bc2f62459cce1e9872ba5632c938c71f2...b8c3f25cdf9de1f0ef2b9300a15964f738a33808
python3 tools/check_conventions.py --base d1ae628bc2f62459cce1e9872ba5632c938c71f2
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 -j8 --test-load 32 -V -R "queued_constant_ram_dump|retired_items|dumped_constant_capture|unregistered_label|stored_bytes|video_out_flip_reopen|compute_pipeline_outside|draw_cache_reuse|vertex_table_read_order|^agc_driver_pm4$|^agc_driver$"
ctest --test-dir build --repeat until-fail:20 -R "^agc_driver_queued_constant_ram_dump$" --output-on-failure
# negative control (below), then restore and rebuild
ninja -C build -j32 -l32 agc_driver_draw_pipeline_retired_items_tests agc_driver_queued_constant_ram_dump_tests
ctest --test-dir build -R "^(agc_driver_draw_pipeline_retired_items|agc_driver_queued_constant_ram_dump)$" --output-on-failure
git status --porcelain
Check Result
git diff --check clean
check_conventions.py All conventions checks passed.
Script build + selected tests (build.json) build OK; 2204 ran, 0 new failures, 0 timeouts; 7 known failures that also fail on main
Script validation comparison 770/771 tests with the layer loaded, layer never reported missing, 0 new VUID- vs main
Focused set, validation layer 17 passed, 1 skipped (video_out_flip_reopen: no display for a Vulkan window, SDL offscreen); 0 VUID- lines, 0 missing-layer lines
agc_driver_queued_constant_ram_dump, 20 repeats 20/20 pass, no abort
Longest test in the focused set agc_driver 11.7 s

Negative control

  • VariantValidation.cpp restored from main, which removes b8c3f25cdf. agc_driver_queued_constant_ram_dump then fails with "a capture after a queued dump drained the draw pipeline 1 times instead of reading the queued bytes". That is the failure oneandonlydean reported.
  • In DrawPipeline.cpp, the two ClearOnExit guards were replaced by the old reclaim.clear() at the start of Enqueue (a targeted revert: restoring the whole file from main would also remove StoredBytes). agc_driver_draw_pipeline_retired_items then fails with "a retired draw pipeline item stayed in the enqueuing thread's storage after Enqueue returned".
  • I restored both files from the merged tree and rebuilt; both tests pass again, and git status --porcelain is empty.
  • video_out_flip_reopen skips on this machine, so I did not revert the VideoOut wait.

Previous findings

  1. Heap corruption in agc_driver_queued_constant_ram_dump: Resolved.
    • I did not reproduce the abort here, so I relied on the outcome: 20/20 repeats pass on Linux.
    • The cause in 0bc7829562 matches the __call_tls_dtors backtrace from my last review.
    • The clears at DrawPipeline.cpp:178 and :312 are covered by a new test that fails without them.
  2. Conflicts with main: Resolved. The head merges cleanly into d1ae628bc2. The needs rebase label looks stale.
  3. VideoOut buffer-label use-after-free: Resolved (code read; the test is author-reported).
    • VideoOutDriver::Open (core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp:411-438) releases the driver mutex and calls AgcDriverWaitIdle (:430). It loops until the same closed configuration is seen twice, so a concurrent Open is handled.
    • The limit is recorded in docs/dev/debt/libSceVideoOut.md, and the AGC side in docs/dev/debt/libSceAgcDriver.md.
    • video_out_flip_reopen skips here (no display). Its pass on Windows and its failure without the wait are as the author reports.
  4. Non-blocking 1, cost of the Linux page check: Resolved.
    • GuestBufferMemory.cpp:4486-4495 uses PROCMAP_QUERY with query_flags 0, so it asks for the VMA covering the address. It accepts read|write with no shared or exec bit and inode 0, and refuses on ENOENT. This matches the text path's rw-p/inode-0 rule.
    • Not caching the per-label import is a reasonable choice for the lifetime reason the author gives; I accept it.
  5. Non-blocking 2, perf evidence: Still open.
    • There is still no main/change pair on current upstream, and no traces: the author says they were lost.
    • The description now says that the numbers predate the follow-ups.
    • Whether this blocks a perf merge is the maintainers' call. Nothing new from me.

New findings

Blocking

None.

Non-blocking

  1. A queued store over a cached variant now always counts as a cache miss (core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/VariantValidation.cpp:113-116).
    • What happens: QueuedWritesOver returns Stored for any overlap where every queued item is a store, even a partial one. validateVariant then reports Differing without looking at the bytes.
    • Why it matters: in the pattern this PR targets (the same descriptor table dumped before every draw), each such draw recaptures instead of reusing the variant. These misses are counted, and in the dispatch path traced, as "captured memory changed" (DispatchLookup.cpp:171-174). The draw-cache statistics then mix them with real content changes.
    • Correctness: it is correct, since the capture serves the queued bytes. The author explains why comparing against the queued bytes alone failed: the data-word check reads stale guest memory.
    • Suggested fix: report these misses under their own outcome or counter, so profiles can tell them apart. The cost of the recapture is not measured.
  2. The dispatch path of the variant-validation change has no test. b8c3f25cdf also changes DispatchLookup's use of validateVariant, but only the draw path is covered, by agc_driver_queued_constant_ram_dump. Consider a dispatch case that reads a queued dump through a cached dispatch variant.

Not verified

  • video_out_flip_reopen on this machine (it skips: no display for a Vulkan window). Its result is author-reported (Windows, AMD).
  • The PROCMAP_QUERY fallback text path. This kernel has the ioctl.
  • Windows, any non-lavapipe GPU, and any title. The speed claims and the cost of recapturing instead of reusing a variant.
  • ASan runs. My Linux evidence for the heap fix is 20 clean repeats plus the negative control of the new test.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5748732044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9898#pullrequestreview-5748732044). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T07:51:17Z. **Review:** APPROVED --- # Re-checked — approved The three blocking findings from my last review are resolved: heap corruption, conflicts with `main`, and the VideoOut use-after-free. The new commits are the retired-item clears (`0bc7829562`), the wait in VideoOut `Open` (`70d8cce27d`), `PROCMAP_QUERY` (`4647d9c464`), the variant-validation recapture (`b8c3f25cdf`) and merges of `main` up to `d1ae628bc2`. They build and pass here, and the negative controls for the new and changed tests fail as expected. ## What changed since my last review Since `0a08a3b019`: - `0bc7829562` empties the thread-local reclaim vectors before `Enqueue` returns, and adds `agc_driver_draw_pipeline_retired_items`. - `70d8cce27d` (option B, as the maintainer chose) makes `VideoOutDriver::Open` call `AgcDriverWaitIdle` before it replaces a closed port's configuration. It also reworks `video_out_flip_reopen` and adds entries to the debt files. - `4647d9c464` adds a `PROCMAP_QUERY` ioctl path for the Linux page check, falling back to the text parse. - `b8c3f25cdf`: `validateVariant` returns `Differing` instead of draining when only queued stores overlap a cached variant. This answers oneandonlydean's report of 2026-11-03. - Merges of `main`, the latest `d1ae628bc2`. The description and the author's reply were updated to match. ## What I ran - Head `b8c3f25cdf9de1f0ef2b9300a15964f738a33808`, `main` `d1ae628bc2f62459cce1e9872ba5632c938c71f2`, merged with `--no-ff` (no conflicts). - Machine: Debian 13 VM, 32 vCPU Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19), kernel 6.12, so the `PROCMAP_QUERY` path is the one exercised. ```sh git diff --check d1ae628bc2f62459cce1e9872ba5632c938c71f2...b8c3f25cdf9de1f0ef2b9300a15964f738a33808 python3 tools/check_conventions.py --base d1ae628bc2f62459cce1e9872ba5632c938c71f2 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 -j8 --test-load 32 -V -R "queued_constant_ram_dump|retired_items|dumped_constant_capture|unregistered_label|stored_bytes|video_out_flip_reopen|compute_pipeline_outside|draw_cache_reuse|vertex_table_read_order|^agc_driver_pm4$|^agc_driver$" ctest --test-dir build --repeat until-fail:20 -R "^agc_driver_queued_constant_ram_dump$" --output-on-failure # negative control (below), then restore and rebuild ninja -C build -j32 -l32 agc_driver_draw_pipeline_retired_items_tests agc_driver_queued_constant_ram_dump_tests ctest --test-dir build -R "^(agc_driver_draw_pipeline_retired_items|agc_driver_queued_constant_ram_dump)$" --output-on-failure git status --porcelain ``` | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | `All conventions checks passed.` | | Script build + selected tests (build.json) | build OK; 2204 ran, 0 new failures, 0 timeouts; 7 known failures that also fail on `main` | | Script validation comparison | 770/771 tests with the layer loaded, layer never reported missing, 0 new `VUID-` vs `main` | | Focused set, validation layer | 17 passed, 1 skipped (`video_out_flip_reopen`: no display for a Vulkan window, SDL `offscreen`); 0 `VUID-` lines, 0 missing-layer lines | | `agc_driver_queued_constant_ram_dump`, 20 repeats | 20/20 pass, no abort | | Longest test in the focused set | `agc_driver` 11.7 s | ## Negative control - `VariantValidation.cpp` restored from `main`, which removes `b8c3f25cdf`. `agc_driver_queued_constant_ram_dump` then fails with "a capture after a queued dump drained the draw pipeline 1 times instead of reading the queued bytes". That is the failure oneandonlydean reported. - In `DrawPipeline.cpp`, the two `ClearOnExit` guards were replaced by the old `reclaim.clear()` at the start of `Enqueue` (a targeted revert: restoring the whole file from `main` would also remove `StoredBytes`). `agc_driver_draw_pipeline_retired_items` then fails with "a retired draw pipeline item stayed in the enqueuing thread's storage after Enqueue returned". - I restored both files from the merged tree and rebuilt; both tests pass again, and `git status --porcelain` is empty. - `video_out_flip_reopen` skips on this machine, so I did not revert the VideoOut wait. ## Previous findings 1. **Heap corruption in `agc_driver_queued_constant_ram_dump`: Resolved.** - I did not reproduce the abort here, so I relied on the outcome: 20/20 repeats pass on Linux. - The cause in `0bc7829562` matches the `__call_tls_dtors` backtrace from my last review. - The clears at `DrawPipeline.cpp:178` and `:312` are covered by a new test that fails without them. 2. **Conflicts with `main`: Resolved.** The head merges cleanly into `d1ae628bc2`. The `needs rebase` label looks stale. 3. **VideoOut buffer-label use-after-free: Resolved (code read; the test is author-reported).** - `VideoOutDriver::Open` (`core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp:411-438`) releases the driver mutex and calls `AgcDriverWaitIdle` (`:430`). It loops until the same closed configuration is seen twice, so a concurrent `Open` is handled. - The limit is recorded in `docs/dev/debt/libSceVideoOut.md`, and the AGC side in `docs/dev/debt/libSceAgcDriver.md`. - `video_out_flip_reopen` skips here (no display). Its pass on Windows and its failure without the wait are as the author reports. 4. **Non-blocking 1, cost of the Linux page check: Resolved.** - `GuestBufferMemory.cpp:4486-4495` uses `PROCMAP_QUERY` with `query_flags` 0, so it asks for the VMA covering the address. It accepts read|write with no shared or exec bit and inode 0, and refuses on `ENOENT`. This matches the text path's `rw-p`/inode-0 rule. - Not caching the per-label import is a reasonable choice for the lifetime reason the author gives; I accept it. 5. **Non-blocking 2, perf evidence: Still open.** - There is still no `main`/change pair on current upstream, and no traces: the author says they were lost. - The description now says that the numbers predate the follow-ups. - Whether this blocks a `perf` merge is the maintainers' call. Nothing new from me. ## New findings ### Blocking None. ### Non-blocking 1. **A queued store over a cached variant now always counts as a cache miss** (`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/VariantValidation.cpp:113-116`). - What happens: `QueuedWritesOver` returns `Stored` for any overlap where every queued item is a store, even a partial one. `validateVariant` then reports `Differing` without looking at the bytes. - Why it matters: in the pattern this PR targets (the same descriptor table dumped before every draw), each such draw recaptures instead of reusing the variant. These misses are counted, and in the dispatch path traced, as "captured memory changed" (`DispatchLookup.cpp:171-174`). The draw-cache statistics then mix them with real content changes. - Correctness: it is correct, since the capture serves the queued bytes. The author explains why comparing against the queued bytes alone failed: the data-word check reads stale guest memory. - Suggested fix: report these misses under their own outcome or counter, so profiles can tell them apart. The cost of the recapture is not measured. 2. **The dispatch path of the variant-validation change has no test.** `b8c3f25cdf` also changes `DispatchLookup`'s use of `validateVariant`, but only the draw path is covered, by `agc_driver_queued_constant_ram_dump`. Consider a dispatch case that reads a queued dump through a cached dispatch variant. ## Not verified - `video_out_flip_reopen` on this machine (it skips: no display for a Vulkan window). Its result is author-reported (Windows, AMD). - The `PROCMAP_QUERY` fallback text path. This kernel has the ioctl. - Windows, any non-lavapipe GPU, and any title. The speed claims and the cost of recapturing instead of reusing a variant. - ASan runs. My Linux evidence for the heap fix is 20 clean repeats plus the negative control of the new test. <!-- anyps5-bots job=3170 head=b8c3f25cdf9de1f0ef2b9300a15964f738a33808 -->
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!9898
No description provided.