perf(agc): record DMA_DATA copies to and from the GDS on the GPU in queue order #2156
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2156"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by orbz22 on 2026-10-09T10:14:26Z.
What
Small DMA_DATA copies between the GDS and memory either drained the device or waited for the GPU:
ResolveStorerefused a GDS destination, so the packet fell through to the drain and the CPU copy.Titles move GDS counters in and out of memory with such packets between dispatches (append/consume counters, ordered counts). Each one cost a drain or a wait on the queue's worker.
This change:
Pm4::DecodeGdsCopyrecognises a DMA_DATA with the GDS on at least one side and memory or the GDS on the other. It requires:The GDS side maps to
GdsAddress() + offset, the guest memory that backs the GDS here.preparePacketMemoryrecords such a copy withVulkanDevice::CopyMemoryOnGpu: avkCmdCopyBufferbetween the two host imports, in the open batch, in queue order.CopyBufferuses.DumpSamplesOnGpualready uses.ResolveStorenow accepts a GDS destination for an immediate source (a fill of GDS counters) inside the GDS. It goes through the label store path like any other immediate DMA_DATA.Why not
CopyBuffer(the path #439 uses for large memory-to-memory copies): its completion-store test counts any pending label in a range as a completion store whenever completion labels exist anywhere. GDS ranges that labels write on the GPU then wait for their batch (SyncThrough). In PPSA01325 that took 2919 syncs in one run, and queue 0x3d still spent ~1.75 s per 10 s in DMA_DATA (numbers below). Changing that test would change every buffer copy, so it is left alone here.The selector values come from DMA_DATA's control dword:
SRC_SELbits 30:29 andDST_SELbits 21:20 (0 memory, 1 GDS, 2 immediate data for the source, 3 memory through L2).Pm4.cppalready decodes them (dmaSource,dmaDestination,DmaSelectGds). They matchS_411_SRC_SEL/V_411_GDS/V_411_DATA/V_411_SRC_ADDR_TC_L2andS_411_DST_SEL/V_411_DST_ADDR_TC_L2in Mesa'ssrc/amd/common/sid.h.Tested
Windows 11, WinLibs GCC 15.2, RTX 3060 Laptop.
New
agc_driver_gds_dma_copy_tests(tests/execution/GdsDmaCopy.cpp), run twice:ds_append/ds_consume(full and partial EXEC).Both memory results must hold the expected counters. The memory side is a registered, host-imported guest block.
CopyMemoryOnGpu. With itsvkCmdCopyBufferremoved, the test fails:GDS counter 0 copied to memory, back to GDS and out again reads 3735928559, expected 1064.agc_driver_pm4_testshas a newtestGdsCopyDecode:Two
ResolveStorechecks: an immediate GDS fill resolves toGdsAddress() + offset; one past the GDS end does not.Full
cteston currentmainwith this change: 494/495 pass.import_auditfails in my git worktree (source_commitisNonebecause git cannot resolve the worktree's commit), which this change does not touch.tools/check_conventions.py --base upstream/mainpasses.PPSA01325 (Astro's Playroom), title screen, 150 s runs. I measured on my local branch, since current
mainstops at boot onmissing static shader ABI register 201(#1836). The same change ran there behind a switch. Per 10 s:The
CopyBuffervariant of the same change gave 1691-1787 ms on queue 0x3d. The title's frame rate stays ~13.7 FPS: it is bound by queue 0's draws, not by these waits.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:19:15Z.
Closing: the DMA_DATA time goes down, but the frame rate in PPSA01325 stays at ~13.7 fps, and the branch now conflicts with main in
Pm4.cpp. Reopen if a title shows a frame-time gain from it.Pull request closed