perf(agc): back the GDS with shared memory on every GPU with host imports #21303
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21303"
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 Gag21 on 2026-11-16T05:00:07Z.
What
Background. On AMD GCN/RDNA GPUs, GDS (Global Data Share) is on-chip memory accessible by all workgroups across the GPU. Titles like CUSA01709 use GDS for append/consume counters (e.g. at GDS offsets 0x40/0x44) and synchronize these counters with memory via
DMA_DATApackets. Commitd4cf5cbeecintroduced anonymous shared memory backing for the GDS with host pointer import (Pm4::RequestImportableGds), enablingDMA_DATAcopies between GDS and guest memory to execute directly on the GPU without CPU stalls. However,VulkanDevice.cpppreviously restrictedPm4::RequestImportableGdsstrictly toVK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU.The problem. On discrete GPUs (such as NVIDIA GeForce RTX 3070 or AMD Radeon dGPUs), gating
Pm4::RequestImportableGdsbehindintegratedforced GDS to remain in a private anonymous mapping (Pm4::GdsImportable()is false). Consequently:DMA_DATAcopy from GDS to guest memory (and GDS fills following GPU work) was classified as unimported, forcingRecorder::SyncThroughto stall the CPU and wait for GPU completion (preparePacketMemory->Pm4::ResolveStore->GuestMemory::Read->Recorder::SyncThrough).DMA_DATApacket execution was severely degraded (from ~0.15 ms to 7–40 ms per packet), resulting in multi-second frame stalls (5 to 18 second frames during cutscenes in CUSA01709).The fix. Remove the integrated-GPU restriction from
VulkanDevice.cpp:1945:Pm4::RequestImportableGds(state->hostPointerImport)requests shared GDS host pointer import on every GPU that supports host pointer import.DMA_DATAcopies entirely on the GPU without CPU stalls.RejectGdsImport()retains clean fallback to private GDS mapping.APS5_NO_SHARED_GDS=1continues to provide an explicit opt-out switch to retain private GDS mappings.agc_driver_gds_dma_fill_sharedin CTest alongsideagc_driver_gds_dma_fill_privateto ensure continuous CI coverage of both shared importable and private GDS configurations.docs/dev/ENVIRONMENT.mddescription forAPS5_NO_SHARED_GDS.Tested
agc_driver_gds_dma_fill_testsexecuted directly on RTX 3070:host imports at shutdown: 6 live (2.3 MiB); made 7 (2.4 MiB), refused 0-> GDS imported on discrete GPU, all tests passed.APS5_NO_SHARED_GDS=1):host imports at shutdown: 6 live (1.3 MiB); made 6 (1.3 MiB)-> private mapping cleanly preserved, all tests passed.build-b:agc_driver_gds_dma_fill_sharedPassed (1.27 sec)agc_driver_gds_dma_fill_privatePassed (1.25 sec)agc_driver_gds_dma_fill_testswithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer.Enabled By: Environment Variable VK_INSTANCE_LAYERS,Manifest: C:\VulkanSDK\1.4.363.1\Bin\VkLayer_khronos_validation.json.VUID-validation errors logged.python tools/check_conventions.py --base origin/main: passed with 0 errors.python tools/offline_overlap.py --branch perf/agc-gds-host-import-discrete-gpu: 0 overlaps across 1,588 open PRs.python tools/fast_dup_check.py: 0 duplicates.DMA_DATApacket time reduced from ~1,400 ms per 9,000 packets to 636 ms per 12,031 packets.trace_digest.py):APS5_GNM_SUBMIT_WAIT_IDLE=1): 1.73 FPS, longest frame 18.3 s.APS5_GNM_SUBMIT_WAIT_IDLE=1): 4.11 FPS, longest frame 1.0 s (2.37x speedup).APS5_GNM_SUBMIT_WAIT_IDLE=1): 4.89 FPS (2.82x speedup).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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T05:15:42Z.
Review: APPROVED
Reviewed — looks good
Nothing in the inspected changes blocks merging; the PR description reports successful execution on an RTX 3070, but I did not run the tests independently.
What I ran
Reviewed head
cc1c02bfe4eda847c8f2c241520158360f3737deagainst the prepared diff. No tests or builds were run. I read all changed lines and the relevant GDS allocation, import fallback, packet handling, and execution test code.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently run CTest, build the project, reproduce the reported performance measurements, or test on physical GPUs.
VulkanDevice.cppwas read throughrepo_read.py; it was excluded from the preparedfiles/folder because of size. Files listed as reviewed in the manifest:core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp,core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_gds_dma_fill_tests.cmake, anddocs/dev/ENVIRONMENT.md. No changed files were excluded from review.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:42:03Z.
Review: COMMENTED
I tested
cc1c02bfe4againstmainat9d362fb088on Linux with Mesa lavapipe. The GCN scalar-buffer control and both existing GDS DMA fill cases passed on both revisions. The branch's shared-backing case also passed. All logs show Khronos validation 1.4.369 inserted with Vulkan required and the shader cache disabled, and contain no missing-layer warnings orVUID-messages. This verifies the paths exercised on software Vulkan. It does not measure the performance of a discrete GPU.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.