refactor(agc): split a dispatch's device call into a complete and a record step #8278
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8278"
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 m335671 on 2026-10-20T08:18:56Z.
What
This is step 1 of the dispatch-side series outlined in #7895 (issuecomment-6277297868) and accepted there. It is the dispatch counterpart of the
Graphics::Drawprepare/record split, and it changes no behaviour.VulkanDevice::dispatchused to run both parts of a dispatch's device call in one function. It now does only the complete part, then hands the result to a new function,VulkanDevice::recordCompletedDispatch, which does the record part:VulkanDevice::dispatchRevalidate/MovedDispatchBuffers, or a full build), then the cache insert andPatchPushConstants; resolves the compute pipelineVulkanDevice::recordCompletedDispatchRecordedDispatch, runsdecideIndirectandrecordDispatch, then the lease sync, the traces, the recipe andtimer.finishThe hand-off is a
DispatchCompletion: references to the context, shader, push constants, pipeline objects, resources, content key and the cache outcome, plus the call'sDispatchTimer,PerformanceTimerand group text. Both halves keep their code and their place in the file: the diff only adds the struct, the forward declaration, the member declaration and the lines at the cut. Nothing is copied, reordered or moved across the GPU mutex.The next steps from #7895 build on this cut. Step 2 moves parts of the complete step off the mutex. Step 4 resolves queue-0 dispatch capture and recompile ahead on a helper. Each of those comes behind a switch with before/after timings and a test that writes between prepare and record.
Tested
Windows 11 Pro 26200, RTX 4070, NVIDIA 617.42, WinLibs GCC 15.2.0, Release. Rebased on
main8499ea52e; since the first version,dispatchgainedthreadGroup(#8066) andhtileClear(#7233, #7371), and both are passed on torecordCompletedDispatchlikex,y,z.^agc_suite onmain8499ea52eand on this branch: 889 of 892 pass on both, and the same three tests fail on both (agc_driver_sample_order,agc_driver_sample_order_grid_reference,agc_driver_sample_order_recipe_depth_locations, which also fail onmainwith-j1on this machine).agc_driver_pipelined_dispatch*,agc_driver_dispatch*,agc_driver_gated_dispatch*,agc_driver_indirect_dispatch*,agc_driver_oversized_dispatch*,agc_driver_draw_write_ranges), run withctest -V,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1on both: 11 of 11 pass on both. Neither log haswas not found but was requested by env var VK_INSTANCE_LAYERSor anyVUID-line.python tools/check_conventions.py --base origin/main: all checks passed.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)Imported from boykopovar/AnyPS5. Originally posted by saarthakpant on 2026-10-20T10:21:42Z.
Tested this on Ghostrunner 2 (PPSA09911), Windows 11 10.0.26200, RTX 2060 SUPER (617.42), MinGW GCC 15.2.0, applied on top of
main4b462ef60+ #7687 + #5372 + the 8 MiB written-staging change (the stack this title needs to reach gameplay here), two scripted gameplay runs of about 5 minutes each withAPS5_PROFILE_GPU=1 APS5_PROFILE_DRAW=1, against one run of the same stack without this PR.No behaviour change: same scene progression, no errors or asserts, dispatch and draw counts per 10 s window match. Performance is inside the run-to-run spread of scripted runs of this title (medians over the steady 10 s windows):
Two runs of one build in the same session earlier differed by 33 vs 28 presents per 10 s, so the refactor costs nothing measurable here; the draw committer carries the frame on this title (about 65 ms busy per frame against 30 ms on queue worker 0), which is what the series is for.
Imported from boykopovar/AnyPS5. Originally posted by m335671 on 2026-10-20T11:13:55Z.
Thanks for running this on Ghostrunner 2. Matching dispatch and draw counts, with timings inside the run-to-run spread, is what a no-behaviour-change split should show. The draw committer carrying the frame there also matches what we see on Sword of the Sea, which is why the draw-side series matters as much as this one.
AI-assisted: yes (Claude Code).