Repository navigation
perf(agc): keep constant RAM dumps and unregistered labels on the GPU without draining - #9898
Conversation
…or the GPU A COPY_DATA, DMA_DATA or DUMP_CONST_RAM store of up to 64 KiB that the driver resolves while GPU work is open is recorded into the batch as a vkCmdUpdateBuffer into the host import, and its range becomes a pending write. The next draw's resource capture reads the dumped descriptor table through the flush hook, which submits the batch and waits for the GPU although the driver already holds the bytes. The recorder now keeps the bytes of stores wider than the 64-byte label table too, in record order, and flags them overwritten like table entries when later GPU work writes over them. Recorder::LookupStoredBytes composes a range from the newest store of each dword. It refuses a dword without a store, one a later GPU write covers, a label behind a completion action and a range under a queued label. Everything recorded before the store lands first and the store lands before anything recorded after it, so the bytes are what the next draw reads on the GPU. classifyPendingWrite answers KnownValue for such a range when the caller takes the bytes (captures, cached draw and dispatch validation), so the capture reads them without the wait. Callers that pass no buffer, and every other pending write, sync as before. APS5_NO_STORED_KNOWN_VALUES=1 turns the path off, and APS5_VERIFY_KNOWN_VALUES=1 checks each served word against the GPU's; the [capture] profile line now reports both counts. Monopoly Plus (CUSA03312) dumps 144- to 512-byte descriptor tables from constant RAM about 100 times per frame on its language screen, each followed by a draw whose capture waited about 1 to 2 ms for the GPU. That screen now runs at about 8.3 instead of 6.1 frames per second on an RX 9070 XT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A label or store into memory no host import covers made the recording thread wait for all recorded work and write it with the CPU (boykopovar#1458). VideoOut's buffer labels live in host memory no guest allocation covers, so every PS4 flip label drained the device under the GPU lock: the draw committer waited about 63 ms per frame and the queue worker waited for the committer at the next DUMP_CONST_RAM. Such memory is now imported for the batch that stores into it, when its pages are committed private read-write memory of one allocation and no guest range overlaps them. The GPU stores the label in stream order, as the console's CP does. Memory that fails those checks or the import keeps the wait. A DMA_DATA copy into host memory that no import covers waited for the batches that write its source and copied on the CPU unless something could still store over its destination, then drained the device. Such a label is now a GPU store in the open batch, so the copy also waits for the batches that store into its destination, then checks again. Only what still stores there after that wait (a storage image's write-back, a unit shadow, a label another queue has not recorded yet) drains. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A DUMP_CONST_RAM on the graphics queue drained the draw pipeline: the queue worker waited until the committer had recorded every queued draw, then recorded the dump's GPU store itself. The constant engine of a PS4 title dumps a descriptor table before many of its draws, so on the board of Monopoly Plus (CUSA03312) the worker drained about 5,300 times a second and waited for the committer about a third of the time. The worker now copies the dumped constant RAM words when it reaches the packet and queues their store as a pipeline item, which the committer records in stream order with the draws around it (Driver::commitStore, formerly commitDmaStore). The item keeps the bytes it stores. DrawPipeline::StoredBytes answers for a range from the newest queued item that writes it: its bytes when that item is a store covering the whole range, unknown when it is anything else. 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 the served words are checked against the stored ones. The other reads the worker makes before the commit already drain on an overlap with any queued write, the store's range included: cached variant validation, fill and dispatch inputs and predication. A WAIT_REG_MEM on a dumped word reads the queued value through PendingLabel. The vertex-table decode of a program with an AGC header read guest memory with no such check; it now drains and decodes again when its reads overlap a queued write. A dump of no words stores nothing and no longer drains. Dumps the worker cannot resolve, dumps outside writable guest memory, predicated dumps and dumps while labels are deferred take the old path. APS5_PIPELINE_DRAIN_DUMPS=1 restores the drain for every dump. agc_driver_queued_constant_ram_dump holds the committer while a draw, a dump, a draw, a second dump of the same table and a draw are queued. Each draw must read the table as of its place in the stream, the table must hold the second dump, and nothing may drain. A second case dumps a vertex attribute table under a draw whose AGC header reads it; the decode must wait for the dump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This pull request is labeled |
|
The source review did not reveal a concrete correctness defect in the recorded-byte lookup or unregistered-import lifetime path: queued reads return bytes only from a covering store item, and the import is retained by the batch. One required item remains for the |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@savvaniss thanks for this, and for the clear write-up per commit. I read all three on f137c98. The ordering argument holds for each against GPU work recorded around the store. One gap needs closing before we can take it, plus two smaller questions. 1. Recorded store bytes can go stale after a guest CPU write (commit 1). 2. Lifetime of an unregistered label target (commit 2). 3. Linux page checks (commit 2). Commit 3 looks right to me: the newest queued item must be a store covering the whole range, every no-buffer caller treats |
|
@savvaniss the exact-head CI on this PR fails What the test does: a compute dispatch writes My reading of the diff, which I have not reproduced: before your second commit, a label into such memory waited for all recorded work and was written by the CPU, so every earlier store had landed first. Now One direction that would keep your speed-up: use the GPU-store path only while no write-back is outstanding in the open batch, and otherwise wait and write from the CPU as before. Another is to write such a label only after the batch's write-backs. The choice is yours. To reproduce, build with a Vulkan device (lavapipe is enough) and run:
It would be worth running the other |
|
@savvaniss This PR now conflicts with main in |
Main's draw pipeline now counts queued writes, keeps retired items and drains the draw finisher before an enqueue; DrawPipeline::EnqueueStore goes through the same enqueue, and StoredBytes refuses a range the finisher still holds. boykopovar#7691's ordered vertex-table decode replaces this branch's drain in Draw.cpp. boykopovar#8180's completion stores apply to an unregistered host import as to any other: a label of 8 bytes or less recorded while a copied writer is listed is stored at reap, after the write-backs. APS5_PIPELINE_DMA is gone from ENVIRONMENT.md, as on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ack pending agc_driver_compute_pipeline_outside_gpu_mutex failed on Linux: its dispatch writes a buffer in host memory no import covers, which the driver holds as a CPU copy and writes back when the batch is reaped, and the WRITE_DATA after it went into an unregistered host import and was stored by the GPU, so the label was visible before the dispatch's result. With main's completion stores (boykopovar#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 clears a buffer label after its flip). The unregistered import is now made only while no copied writer is listed and no completion store is pending. Otherwise the label or store waits for the recorded work and is written by the CPU, as before this branch. UnregisteredLabelBehindWriteBack checks a label and a 16-byte store after a pending write-back and after a pending completion store, and that a 16-byte store with neither pending still goes to the GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tted A capture read a recorded store's bytes (Recorder::LookupStoredBytes) until the store's batch was retired. Once the batch is submitted the GPU may run it, a guest that sees one of its labels may write over the stored range with the CPU, and a capture before the reap then read the old bytes where memory held the new ones. Each batch now notes that its submit started before vkQueueSubmit, and the lookup refuses a table entry or wide store of such a batch, so the capture reads memory as it did before this branch. The note is an atomic read under the label table mutex: captures run without the GPU mutex, so the lookup does not query the batch's fence, which vkQueueSubmit uses on the committer thread. Stores of the open batch, which the GPU has not seen, are still served. agc_recorder_stored_bytes checks that both kinds of entry are refused after Submit; agc_driver_dumped_constant_capture rewrites a dumped constant once the label behind the dump has landed and expects the next draw to read the new value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows, UnregisteredHostImport takes only committed MEM_PRIVATE pages with PAGE_READWRITE in one allocation. On Linux it took any range whose host-pointer import succeeded, and an import does not have to fail for read-only, file-backed or shared pages: an implementation may wrap the pointer, and the store then faults or writes through to the file. Linux now reads /proc/self/maps and imports the range only when it lies inside one private anonymous read-write mapping (rw-p, inode 0). Other platforms without the file refuse, so the label waits as before. agc_driver_unregistered_label_on_gpu now also refuses a label in a mapped view of a section on Windows, and on Linux a read-only page, a private file mapping and a shared anonymous mapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recorder keeps both this branch's LookupStoredBytes and main's UnlandedOwnLabel, with both test groups in --completion-labels-only and the full recorder run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (4, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 480 tests)Skipped (45)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ AMD GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (9, not counted against this PR)Validated but not compared (4, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 480 tests)Skipped (55)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (4, not counted against this PR)Validated but not compared (4, not in the main baseline's validation pass)Validation IDs already present on main (5 IDs in 480 tests)Skipped (46)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Hi savvaniss, #9898 (head The merge builds, but your new Could you merge main and decide how variant validation should treat queued writes whose bytes are known (for example the same |
XairRrR
left a comment
There was a problem hiding this comment.
Reviewed — changes requested
This pull request does not merge cleanly into main (d1ae628): head a814af0 conflicts in
core/libs/prx/libSceAgcDriver/Execution/src/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lap a cached variant validateVariant drained the draw pipeline whenever a queued write overlapped the variant's runs. When every overlapping queued item is a store whose bytes the pipeline holds, the variant is now reported as differing, so the capture serves the queued bytes. Other overlaps, and APS5_VERIFY_KNOWN_VALUES, still drain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, that was the cause. Keeping the variant when its words match the queued store does not work: the data-word check after it reads guest memory, which still holds the old table, and draw 1 then wrote 64 instead of 255. On Windows with an RX 9070 XT, with the validation layer and |
XairRrR
left a comment
There was a problem hiding this comment.
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:
0bc7829562empties the thread-local reclaim vectors beforeEnqueuereturns, and addsagc_driver_draw_pipeline_retired_items.70d8cce27d(option B, as the maintainer chose) makesVideoOutDriver::OpencallAgcDriverWaitIdlebefore it replaces a closed port's configuration. It also reworksvideo_out_flip_reopenand adds entries to the debt files.4647d9c464adds aPROCMAP_QUERYioctl path for the Linux page check, falling back to the text parse.b8c3f25cdf:validateVariantreturnsDifferinginstead of draining when only queued stores overlap a cached variant. This answers oneandonlydean's report of 2026-11-03.- Merges of
main, the latestd1ae628bc2. The description and the author's reply were updated to match.
What I ran
- Head
b8c3f25cdf9de1f0ef2b9300a15964f738a33808,maind1ae628bc2f62459cce1e9872ba5632c938c71f2, 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_QUERYpath 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.cpprestored frommain, which removesb8c3f25cdf.agc_driver_queued_constant_ram_dumpthen 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 twoClearOnExitguards were replaced by the oldreclaim.clear()at the start ofEnqueue(a targeted revert: restoring the whole file frommainwould also removeStoredBytes).agc_driver_draw_pipeline_retired_itemsthen 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 --porcelainis empty. video_out_flip_reopenskips on this machine, so I did not revert the VideoOut wait.
Previous findings
- 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
0bc7829562matches the__call_tls_dtorsbacktrace from my last review. - The clears at
DrawPipeline.cpp:178and:312are covered by a new test that fails without them.
- Conflicts with
main: Resolved. The head merges cleanly intod1ae628bc2. Theneeds rebaselabel looks stale. - 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 callsAgcDriverWaitIdle(:430). It loops until the same closed configuration is seen twice, so a concurrentOpenis handled.- The limit is recorded in
docs/dev/debt/libSceVideoOut.md, and the AGC side indocs/dev/debt/libSceAgcDriver.md. video_out_flip_reopenskips here (no display). Its pass on Windows and its failure without the wait are as the author reports.
- Non-blocking 1, cost of the Linux page check: Resolved.
GuestBufferMemory.cpp:4486-4495usesPROCMAP_QUERYwithquery_flags0, so it asks for the VMA covering the address. It accepts read|write with no shared or exec bit and inode 0, and refuses onENOENT. This matches the text path'srw-p/inode-0 rule.- Not caching the per-label import is a reasonable choice for the lifetime reason the author gives; I accept it.
- 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
perfmerge is the maintainers' call. Nothing new from me.
- There is still no
New findings
Blocking
None.
Non-blocking
- 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:
QueuedWritesOverreturnsStoredfor any overlap where every queued item is a store, even a partial one.validateVariantthen reportsDifferingwithout 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.
- What happens:
- The dispatch path of the variant-validation change has no test.
b8c3f25cdfalso changesDispatchLookup's use ofvalidateVariant, but only the draw path is covered, byagc_driver_queued_constant_ram_dump. Consider a dispatch case that reads a queued dump through a cached dispatch variant.
Not verified
video_out_flip_reopenon this machine (it skips: no display for a Vulkan window). Its result is author-reported (Windows, AMD).- The
PROCMAP_QUERYfallback 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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validated but not compared (5, not in the main baseline's validation pass)Validation IDs already present on main (4 IDs in 512 tests)Skipped (48)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
@XairRrR thanks for the two non-blocking points. This PR merged before I got to them, so both are in #15703.
AI-assisted: yes (Claude Code) |
…s reason Since #9898, a cached variant whose runs only queued stores overlap is recaptured instead of drained, and validateVariant reported that as Differing, so the draw and dispatch caches counted those misses as changed content. It now returns QueuedStores. The draw cache counts it as DrawMiss::QueuedStores and the dispatch cache as queuedStores, both report it on its own, the dispatch trace names it, and the dispatch differing classification leaves it out. Nothing else changes. agc_driver_queued_constant_ram_dump checks that the draws count such a miss, and adds a dispatch whose cached variant reads a descriptor table that a queued DUMP_CONST_RAM rewrites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Get-fix#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,mainis merged in (lastb7488e1ff5, in3cd01b28ab) and the fixes follow, described under Follow-ups below.1. Captures read recorded store bytes instead of waiting for the GPU (Get-fix#10)
A PS4 title that uses the constant engine builds its descriptor tables in constant RAM and dumps them to memory with
DUMP_CONST_RAMbefore each draw. While GPU work is open,preparePacketMemoryresolves such a store (Pm4::ResolveStore, up to 64 KiB, alsoCOPY_DATAandDMA_DATA) andVulkanDevice::WriteLabelOnGpurecords it into the batch as avkCmdUpdateBufferinto 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:
LabelTableBytes(64). Wider stores were ranges only (wideLabels). They now keep their bytes and a record sequence too.markOverwrittenflags them like table entries when later GPU work writes over them, and they leave with their batch as before.Recorder::LookupStoredBytescomposes 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, since7aa3c8f63d, any store of a batch whose submit has started (see Follow-ups).Driver::classifyPendingWriteanswersKnownValuewith those bytes when the caller passes a buffer for them. Callers that do are the capture's word reads (ShaderMemory),captureStableandvalidateCaptured. 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=1turns the path off. WithAPS5_VERIFY_KNOWN_VALUES=1each 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#11, with its follow-up fix folded in)
A label or store into memory no host import covers (
WriteLabelOnGpureason 3) makes the recording thread wait for all recorded work (WaitIdle) and then write it with the CPU. c9ab6a7 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.
PatchFlipin libSceGnmDriver writes 1 toVideoOutBufferLabelAddress(handle) + index * 8withWRITE_DATAbefore the flip packet. That address isbufferLabelsinside VideoOut's host-side config object, and no guest allocation covers it. So once per frame the draw committer rancommitLabel, found no import and waited for the device under the GPU mutex. The queue worker then waited for the committer at the nextDUMP_CONST_RAM. This is the ~69 ms per frame that #10's numbers showed asDriver.Packet.device_lock: that timer mark covers the draw pipeline drain.This commit stores such labels on the GPU instead:
Graphics::UnregisteredHostImportimports 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 committedMEM_PRIVATEmemory with exactlyPAGE_READWRITEprotection in a single allocation.WriteLabelOnGpuuses that import whenHostImportForfinds none. It records the store into the open batch as for any imported label, andRecorder::Keeps the import with that batch so the buffer outlives the store.c14d8edb47Linux checks the pages too (one private anonymous read-write mapping in/proc/self/maps), and sincecd2e19f6f9the import is made only while no copied writer is listed and no completion store is pending.libSceAgcDriverdebt entry for unimported labels now names what still waits.Nothing depends on the title: any
RELEASE_MEM,WRITE_DATA,DMA_DATA,COPY_DATAorDUMP_CONST_RAMtarget 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
75bc9a49b7from Get-fix#11, which fixes a driver test the import broke. ADMA_DATAcopy 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, andagc_driver's copy behind a label into its destination drained.3.
DUMP_CONST_RAMis queued behind pipelined draws (Get-fix#21)A
DUMP_CONST_RAM(PM4 0x83) on the graphics queue drained the draw pipeline.keepsDrawPipelinedoes not keep 0x83, so the queue worker waited until the committer had recorded every queued draw, thenpreparePacketMemoryrecorded 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] pipelinedline 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:
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 fromcommitDmaStore).DrawPipeline::StoredBytesanswers 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::queryPendingWritegives 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. WithAPS5_VERIFY_KNOWN_VALUES=1it drains first, so each served word is checked against the stored one.The other reads the worker makes between the enqueue and the commit:
0x63/0x64/0x9fpackets already drain on an overlap with any queued write (DrawPipeline::Overlaps); the queued store's range is one.WAIT_REG_MEMon a dumped word reads the queued value throughDrawPipeline::PendingLabel, which reads the stored bytes of a store item as it does a label's.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 fix(agc): drain the draw pipeline before a vertex table read overtakes a queued write #7691 (DecodeOrderedVertexStageInfo) now does it, and the merge keepsmain's helper. PS4 programs have no AGC header, so this never runs for them.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=1restores the drain for every dump, likeAPS5_PIPELINE_DRAIN_FILLSfor fills.main's draw pipeline now also orders queued reads (Enqueue'sreads,HeldReads), counts queued writes and runs draws through the optional draw finisher (APS5_DRAW_PIPELINE).EnqueueStoregoes through the same enqueue, which drains a busy finisher first; a queued store item carries no reads; andStoredBytesrefuses a range the finisher still holds as well as anything a queued non-store item writes.Follow-ups after review and CI
71bcb4a8d2mergesmain9c6d153dec. The resolution keepsmain's draw pipeline, finisher and packet loop, and takesmain's ordered vertex-table decode (fix(agc): drain the draw pipeline before a vertex table read overtakes a queued write #7691) inDraw.cpp.WriteLabelOnGpukeeps the unregistered import ahead of fix(agc): store a label behind pending copied write-backs without draining #8180's completion stores.cd2e19f6f9fixes the Linux CI failure ofagc_driver_compute_pipeline_outside_gpu_mutex("the first dispatch stored 0"):WRITE_DATAafter it was stored by the GPU into an unregistered import, so the label was visible first.7aa3c8f63d(first review, point 1): recorded store bytes are refused once their batch's submit has started.submitStartedbeforevkQueueSubmit. 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,UnregisteredHostImportchecks 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:mainnow queues queue-0DMA_DATAby default (ce6865f). Its committed copy into host memory now waits for the batches that store into its destination, as the immediate path above does.agc_driverfailed without it.3cd01b28abmergesmainb7488e1ff5.0bc7829562fixes the heap corruption XairRrR found (agc_driver_queued_constant_ram_dumpaborting on Linux withfree(): chunks in smallbin corrupted):DrawPipeline::enqueueandDrawFinisher::Enqueueleft 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 topagePool(), 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 thatemplace_back, from__call_tls_dtors.APS5_PIPELINE_DRAIN_DUMPS=1only hid it, because the test then stops at its first assert, before that second enqueue.mainhas the same two vectors.Enqueuereturns, 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::Openwaits for the driver (AgcDriverWaitIdle) before it replaces a closed port's configuration.VideoOutConfig::bufferLabelsbefore the batch with PatchFlip's GPU store ran.Openchecks the port again afterwards, since anotherOpenmay have run meanwhile.sceVideoOutOpenreturns stalls the reopen with it. That limit is in thelibSceVideoOutdebt file.4647d9c464: the Linux page check uses thePROCMAP_QUERYioctl on/proc/self/maps(Linux 6.11 and later), and reads the file as text only when the ioctl fails.fb1551442bmergesmainde2ba4cecb. Two conflicts, both lines added on each side: the recorder tests'PATHlist inCMakeLists.txtand the argument dispatch intests/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
maind1ae628bc2, 3 Nov, and a variant-validation fix. Headb8c3f25cdf(mergef070b16201). Conflicts: the[capture]profile line inShaderMemory.cpp(main's line with this branch's known-value verified/mismatch counters), the option list intests/Recorder.cpp(both kept) and the WindowsPATHlist inagc_driver_recorder_tests.cmake(main's list plusagc_recorder_stored_bytes). After the merge,agc_driver_queued_constant_ram_dumpfailed on AMD as oneandonlydean reported: a later draw reused a cached variant andDriver::validateVariantdrained withDrainReason::Capture.b8c3f25cdf: when every queued item over the variant's runs is a store whose bytes the pipeline holds,validateVariantreturnsDifferingwithout draining, so the capture serves the queued bytes; other overlaps, andAPS5_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_dumpfails on the merge without the fix (1 capture drain) and passes 3/3 with it, and passes withAPS5_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_pipelinevariants of bda span, buffer load/store, copied writer, depth storage reuse, unsupported buffer type and write ranges,dumped_constant_capture, bothunregistered_label_*,agc_driver_recorder,agc_recorder_*,agc_queued_write_groups);agc_recorder_kept_byteswas not built. NoVUID-, 54 device lines all RX 9070 XT.check_conventions.pypassed. Not rerun: the same set onmain, Linux, the full suite, games, and a paired trace for the speed claim.Merge of
mainf2d874c1fd, 1 Nov. Heada814af06ee. The only conflict was in the Linux includes ofGuestBufferMemory.cpp:main's macOSudmabufstand-in and this branch's<linux/fs.h>(forPROCMAP_QUERY) are both kept, with<linux/fs.h>on the non-Apple side. On the RX 9070 XT, 13 of 13 pass with noVUID-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 compiledGuestBufferMemory.cppandPipelineJournal.cpponly (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=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, withctest -V, three times each, onmainb7488e1ff5and on this branch at4647d9c464. The current headfb1551442b(mainde2ba4cecbmerged) had the smaller rerun in the last row and the note under the table.Focused set:
agc_driver,agc_shader_memory,agc_driver_pm4and 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 andvideo_out_flip_*. That is 176 tests onmain, plus this branch's 6 on the branch.mainb7488e1ff5, each of 3 runs4647d9c464, runs 1 and 24647d9c464, run 3fb1551442b, each of 3 runsfb1551442b: the focused set without its 17video_out_flip_*tests, plusmain's newagc_recorder_command_buffer_release, which is the 166 above. Both tests behind the conflicts passed in all three runs:agc_recorder_stored_bytesandagc_recorder_command_buffer_release.video_out_flip_reopenandmain's newvideo_out_flip_padstatusran once and passed. Same environment, noVUID-or missing-layer lines, and every device line names the RX 9070 XT.fb1551442b: the other 16video_out_flip_*tests, the mutations below, anything on Linux, andmainde2ba4cecb, so themaincomparison is still theb7488e1ff5row.Notes on the runs at
4647d9c464:agc_driver_pm4_ringin run 3, after 0.05 s: "replace guest placeholder with private memory: Attempt to access invalid address", fromCommitin libc'sWindowsMappings.hppwhile 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.agc_driver_copied_writer_label_orderand its drain variant: the device'sminStorageBufferOffsetAlignmentof 4 binds the record in place.VUID-line orwas 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 atfb1551442b:agc_driver_dumped_constant_capture, dump read by the next captureAPS5_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 label7aa3c8f63d'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_bytes7aa3c8f63d'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_gpuMEM_PRIVATEcheck: "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!listedfor labels: "its store landed over the 0 the host stored once the GPU work was done" (reason 5)!listedfor stores: "held 0x6b6b0001 once the GPU ran its batch (reason 0), while the dispatch's record still held 0xc0001000"!storesPendingfor labels: "it landed over the 0 the host stored once the GPU work was done"!storesPendingfor 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_dumpAPS5_PIPELINE_DRAIN_DUMPS=1: "a DUMP_CONST_RAM drained the draw pipeline 1 times"agc_driver0a08a3b019: "a copy into host memory drained instead of syncing its source"agc_driver_draw_pipeline_retired_itemsDrawPipeline::enqueue: "a retired draw pipeline item stayed in the enqueuing thread's storage after Enqueue returned"; inDrawFinisher::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_mutexwith its slots inVirtualAllocmemory (MEM_PRIVATE, so it is imported) failed "the first dispatch stored 0" in 5 of 5 runs with the import behaving as atbd31efba93, and passed 5 of 5 withcd2e19f6f9. The test file in this pull request is unchanged. On Windows the test's own static arrays areMEM_IMAGEand take the wait.Linux, all at
4647d9c464, before the merge ofde2ba4cecb(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.agc_driver,agc_driver_compute_pipeline_outside_gpu_mutex,agc_driver_queued_constant_ram_dump,agc_driver_copied_writer_label_orderand its drain variant, and the Linux cases ofagc_driver_unregistered_label_on_gpu.video_out_flip_*tests includingvideo_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 merge3cd01b28ab, 5 runs gave 3 aborts withfree(): chunks in smallbin corrupted, 1 segfault and 1 pass. At4647d9c464, 20 of 20 pass.ANYPS5_ENABLE_ASAN=ON): at3cd01b28ab, a heap-use-after-free as described above. At4647d9c464, 0 errors inagc_driver_queued_constant_ram_dump(3 runs),agc_driver_draw_pipeline_retired_items, both unregistered label tests,agc_driver_dumped_constant_captureandagc_driver_compute_pipeline_outside_gpu_mutex.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.cppandcore/shader/recompiler/ShaderDiskCache.cpp, with their Linux-onlysizeofguards, compile.mainwas not built on Linux. The merge ofde2ba4cecbchanges neither file, nor a guard or guarded struct in AGC, and Linux was not compiled again atfb1551442b.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 themaincomparison 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 fromps4/limbo-gpuat93eeee0141(#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 forsceGnmDrawInitDefaultHardwareState200andsceGnmUpdate*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.9c5c8619f7, change2c09e4328d, both with fix(agc): PS4 display, textures and GCN instructions for CUSA03312 Get-fix/AnyPS5#1, fix(build): register relinker tests with CTest #2, Boot Demon's Souls to its first level: AGC recorder driver, runtime, audio, Bink fixes #5 and feat(random): implement sceRandomGetRandomNumber #8:shader_compile_and_linkms/framecapture_resourcesms/framedevice_lockms/frameSummary lines, written before the summary had
traceandwindow: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}}2c09e4328d, change684cb22e80, both with fix(agc): PS4 display, textures and GCN instructions for CUSA03312 Get-fix/AnyPS5#1, fix(build): register relinker tests with CTest #2, Boot Demon's Souls to its first level: AGC recorder driver, runtime, audio, Bink fixes #5, feat(random): implement sceRandomGetRandomNumber #8 and Feat/sce module load #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.device_lockms/framememory_waitms/framerender_fence_waitms/frameSummary 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.pyof the two tracesBase,
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 2c09e43, 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)
Threads (ms per frame)
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
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
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 684cb22, 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)
Threads (ms per frame)
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
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
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.DUMP_CONST_RAM, on Monopoly's idle match board (perf(agc): queue DUMP_CONST_RAM stores behind pipelined draws Get-fix/AnyPS5#21 has the full runs). Pair: base7cee08fdaf, change4dbf61346d, both with fix(agc): PS4 display, textures and GCN instructions for CUSA03312 Get-fix/AnyPS5#1, fix(build): register relinker tests with CTest #2, Boot Demon's Souls to its first level: AGC recorder driver, runtime, audio, Bink fixes #5 to feat(random): implement sceRandomGetRandomNumber #8, Feat/sce module load #10 to fix: correct sscanf %x signedness and avoid a substr copy #15, fix(libc): only call what() on std::exception types in DefaultTerminate #19 and a port of perf(agc): write DMA_DATA fills of an idle GDS without draining #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.pyof the two runs' summary filesBase,
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 7cee08f
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
Row 17, 241 to 256 s, is the window of the summary lines above.
tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pylists these:WriteLabelOnGpuand the debt entry next to this branch's. Whichever lands second has to keep the unregistered import's condition.GuestBufferMemory.cppon macOS and changes the include lines next to this branch's<linux/fs.h>, which then goes behind the same guard.[capture]report line inShaderMemory.cppthat this branch also changes.DrawPipeline.cpp.CMakeLists.txtor the recorder tests.None implements the same thing.
Merge of
maincc26ab4438, 1 Nov. Headbebaf6e59d. The only conflict waslibSceAgcDriver/CMakeLists.txt:mainmoved the AGC test registrations intotests/cmake, andtools/agc_test_split.py resolvemovedagc_recorder_stored_bytesto theagc_driver_recorder_testsfragment.agc_recorder_stored_bytes,agc_recorder_read_list,agc_driver_queued_constant_ram_dumpandagc_driver_graphicspass, 3 of 3 on the RX 9070 XT under the validation layer, noVUID-line. Not rerun: the other tests, Linux, games.Merge of
mainb415263451, 1 Nov. Head87e6918b69. Conflicts inRecorder.hpp,Recorder.cpp,tests/Recorder.cppanddocs/dev/debt/libSceVideoOut.md: this branch'sLookupStoredBytesandmain'sUnlandedOwnLabel(withmain'sANYPS5_PAD_IDENTIFYdebt 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'sagc_recorder_stored_bytes,agc_recorder_completion_labelsandagc_recorder_command_buffer_release,agc_driver,agc_driver_same_queue_label_waitand the label-order, constant-store, idle-store and unregistered-label tests with their variants,video_out_flip_reopenandvideo_out_flip_padstatus. 29 passed and 2 skipped (agc_driver_copied_writer_label_orderand its_drainvariant: this device'sminStorageBufferOffsetAlignmentis 4). NoVUID-line, and every selected-GPU line names the RX 9070 XT. Not rerun at this head: the othervideo_out_flip_*tests,agc_shader_memory,agc_driver_pm4and its variants, Linux, and any title. The speed numbers above were not remeasured.Merge of
main4f41f4c375, 3 Nov. Headf160886325. The only conflict was the WindowsPATHlist inagc_driver_recorder_tests.cmake: main's newagc_changed_copyand this branch'sagc_recorder_stored_bytesare 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, noVUID-line, no skip (agc_driver_queued_constant_ram_dump,agc_driver_draw_cache_reuseand its six variants,agc_driver_draw_pipeline_retired_items,agc_driver_dumped_constant_capture, bothagc_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
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code