perf(agc): let a CPU buffer fill wait only for the work over its range #18829
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18829"
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 DealPotato on 2026-11-12T11:50:18Z.
What
A buffer fill over a range that no host import covers is stored by the CPU, and that path drained the device first:
WaitIdleunder the GPU mutex, a recorder sync plusvkDeviceWaitIdle. WWE 2K26 (PPSA34299) issues about a dozen such fills every 10 s in a match, each one draining every queue while the GPU mutex is held.The CPU store now waits only for the work that can conflict with it, by the rules the CPU side of the copy HLE already applies to its destination:
SyncThrough;APS5_CPU_FILL_WAIT_IDLE=1restores the drain (documented inENVIRONMENT.md). The[fill]line ofAPS5_PROFILE_DRAWsplits the CPU wait from the store and counts the three outcomes.Tested
Windows 11 Pro (build 26300), NVIDIA GeForce RTX 4070, driver 610.88. Focused tests run with
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andctest -Vonmain(3b7f31fa70) and on this change, from one build directory; the loader inserted the validation layer in both runs.Passed on
mainand on the change (19 tests):agc_driver_fill_completion_labelsand its six variants,agc_driver_copied_writer_copy,agc_driver_pattern_buffer_fill,agc_driver_pipelined_fill(plus_draw_pipeline,_plan_verify),agc_driver_memory_value_fill,agc_driver_gds_dma_fill(plus_private),agc_driver_depth_plane_fill_discard,agc_driver_pipelined_dma(plus_draw_pipeline,_plan_verify). New on the change, passed:agc_driver_cpu_store_settle,agc_driver_cpu_store_settle_wait_idle(APS5_CPU_FILL_WAIT_IDLE=1),agc_driver_cpu_store_settle_untracked_reads(APS5_COPY_READ_TRACKING=0). No log has aVUID-message.The new test checks each decision on a real device: no wait on an idle device, no drain beside a recorded writer of another range, a wait for a recorded writer of the range (its data lands), and a drain for a pending GPU label or a noted in-place reader; with read tracking off, recorded work drains; with the switch, everything drains.
Performance
WWE 2K26 does not reach a match on
mainalone; it was measured on a local branch ofmain(3a0a54bbd8) with #18651, #18652, #18654, #18660 and local workarounds for native multisample depth, with and without this change. Match intro, 10 s windows.Per fill, from the
APS5_PROFILE_DRAW[fill]and[commits]lines:APS5_TRACE_FRAMES=0:30captures of the same build (dirty: it also held the fix that holds the settle and sparse queues acrossvkDeviceWaitIdle, opened separately as #18828), withAPS5_CPU_FILL_WAIT_IDLE=1(drain) and without (this change), summary lines below. The two captures did not land on the same scene: the change's run recorded about 20 % more draws on the draw committer (5017 vs 4185) and more GPU time, so its frame times are not a comparison of the change. The committer'sRecorder.Synctime fell from 79 to 64 ms per present.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-14T09:19:46Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation and tests support the range-specific CPU store settle behavior.
What I ran
Reviewed head
19442d992ac97afd51949578b817787f43145a52. Read the prepared diff and changed-file contents throughrepo_read.py; inspected relevant Vulkan device and buffer-fill context. No build or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No commands, build, tests, or hardware behavior were independently verified. Read changed files:
core/libs/prx/libSceAgcDriver/CMakeLists.txt,core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp,core/libs/prx/libSceAgcDriver/Execution/src/Driver/Memory/BufferFill.cpp,core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp(targeted ranges),core/libs/prx/libSceAgcDriver/tests/execution/CpuStoreSettle.cpp, anddocs/dev/ENVIRONMENT.md. The fullVulkanDevice.cppwas excluded from the review folder, so only relevant ranges were read. No other changed files were listed as excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:17:20Z.
Review: COMMENTED
The trial merge onto
a1b75b0947conflicts inBufferFill.cppandVulkanDevice.cpp. Please preserve the drain when read tracking is disabled and the full-drain path for pending labels, image writes, or shadows, alongside the range-only writer wait.CpuStoreSettlechecks both arms of the decision, so please run the wait-idle and untracked-read cases once the merge is resolved. Any speed claim needs pairedtrace_digest.pysummaries for the same scene and machine.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.