perf(agc): resolve DISPATCH_INDIRECT thread dimensions on the GPU #8066
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8066"
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 HQasper on 2026-10-19T19:29:18Z.
What
A
DISPATCH_INDIRECTwhose initiator sets USE_THREAD_DIMENSIONS (bit 5) takes thread counts from its arguments, not group counts.indirectArgumentsPathsent every such dispatch to the CPU (IndirectThreadDimensions). The read has to wait for earlier GPU work that may store the arguments: since #6786 it finishes the leased work first (FinishLeaseWork), under the GPU mutex. GTA V's async compute queues issue these dispatches all the time. In one run (title, loading and 200 s of Story) the driver read 28839 of them on the CPU, and those reads took 71 s in total across the compute queues.The argument kernel (
DispatchArguments.comp) now does the conversion on the GPU. Given the group size per axis (COMPUTE_NUM_THREAD_X/Y/Z), it writesceil(threads / size)as the group counts. It also writes the thread counts in words 3 to 5 of its output, andrecordDispatchcopies them into the program's ShaderData thread limit (dispatchThreadLimit) before the dispatch. The dispatch then stays on the GPU path like a group-count indirect dispatch.Other changes:
Driver::dispatchcompiles these dispatches as partial-group programs with a placeholder limit (~0uon each axis). It sets the push constant size of the request to 0, so the ShaderData words land in a storage buffer the GPU can store into.forgetShaderDataWords), so the next refresh writes them all again.TRANSFER_DST, not only the refreshable ones.decideIndirect's CPU fallback (pending image results, pending label or copied writer, no host import, device-memory LDS) converts the counts to groups itself and stores the limit withvkCmdUpdateBuffer.APS5_NO_GPU_THREAD_DIMENSIONS=1restores the CPU read.Tested
Windows 11 Pro 26300, NVIDIA GeForce RTX 5090 (617.42), MinGW-w64 Release build of this branch on
main7a015c094.agc_driver_indirect_thread_dimensions. It submits four shapes on a compute queue: 100x1x1 threads in groups of 64x1x1, 5x3x2 in 4x2x2, 64x2x1 in 32x1x1, and 0x7x1 in 8x1x1. Each runs once with the arguments stored by a GPU producer in the same submission and once with arguments the CPU wrote. A counter checks that exactly the requested threads ran. The test also takesdecideIndirect's CPU fallback, behind a GPU producer and a pending label over the arguments (cpuReason2). Without the limit store the first shape runs 128 threads instead of 100.agc_driver_indirect_thread_dimensions_cpuruns the same shapes withAPS5_NO_GPU_THREAD_DIMENSIONS=1, with arguments the CPU wrote.ctest -j 24: 1683 of 1685 pass.agc_driver_pixel_ldsandagc_driver_pass_input_hazardfail on plainmain7a015c094too on this RTX 5090.ANYPS5_GPU=AMDthe indirect and dispatch-move tests (agc_driver_indirect_thread_dimensions, its_cpuvariant,indirect_arguments_*,gpu_indirect_arguments_*,indirect_dispatch_limit,dispatch_move*,lds_beyond_device_limit,oversized_dispatch,pipelined_dispatch*) also pass on the AMD Radeon(TM) Graphics iGPU of a Ryzen 9 9950X3D (64-lane subgroups).ctest --test-dir build -R agc_driver_indirect -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, onmain7a015c094and on this branch (84a6fb0fe). Both logs show the loader insertingVK_LAYER_KHRONOS_validation, and neither says it was not found.mainpasses its 4 tests (agc_driver_indirect_arguments_pending_producer,agc_driver_indirect_arguments_written_ahead,agc_driver_indirect_dispatch_limit,agc_driver_indirect_patched_stage); this branch passes those and the two new ones. Both logs hold the same fourVUID-lines, all from the existingagc_driver_indirect_arguments_pending_producer(2xVUID-vkCmdWaitEvents-srcStageMask-01158, 2xVUID-vkSetEvent-event-09543). The two new tests log none.GTA V (PPSA04264) needs #6488 to reach Story and #7603 (merged since) not to hang there, so both builds carry them on this branch's base. In the summary lines,
7b18631f34aaismain7a015c094+ #6488 (a48c5a7c7) + #7603 (e5b4bd72d), and72a70f6d87efis the same build + this branch (84a6fb0fe). Both are Release builds on one Windows 11 Pro 26300 machine with a Ryzen 9 9950X3D and the RTX 5090 (617.42). The scene is the Story prologue, resumed from the same save before every run, at 3840x2160 with default settings and replayed pad input. OnlyAPS5_TRACE_FRAMES=7500:300is set besides the pad input file. Caches are warm, and both game folders hold the same shader and pipeline cache files. Base and change alternate in one session, three pairs:The median frame time drops by 2.7 %, 3.9 % and 3.1 % (84.2 to 81.5 ms on average, 3.3 %), and every change run is faster than every base run. GPU busy time per present stays about the same (58.8 against 59.2 ms on average). In the digests of pair 2 below, the draw committer's wait falls from 29.1 to 2.8 ms per frame, and
GpuMutex.wait.draw(27.8 ms per frame in the base) leaves the largest slices.A reviewer's run on a Linux laptop (RTX 5060 Laptop GPU, NVIDIA 615.71.09, GTA V PPSA04263 01.010.002, frames 3600:700,
maind14a186f4against the same + this branch, A B A B) found no difference (p50 -0.3 %). Whether that window had CPU thread-dimension reads was not checked, so the gain above holds for the RTX 5090 machine and scene only.In separate runs of the same scene with
APS5_PROFILE_DRAW=1, the[indirect]line readscpu-side 30391 (thread dimensions 30391, ...); CPU argument reads took 66.6 son the base andcpu-side 0 (thread dimensions 0, ...); CPU argument reads took 0.0 swith the change.Every trace reports dropped events: the event buffer of queue worker 0x0 fills after about 8 s of the 25 s window and that of the draw committer after about 23 s, so the digests' per-thread tables cover only that part.
totals_fullis false everywhere, so the summary numbers are complete.An earlier version of this description compared the change with
APS5_NO_GPU_THREAD_DIMENSIONS=1in one build on an oldermainwith #6786 (6 %). Its summary lines all carried one commit and it also setAPS5_TRACE_DIR, so this comparison of two builds replaces it.Summary lines, in run order (base and change of pair 1, then pairs 2 and 3):
The traces are attached.
aps5-trace-7b18631f34aa-6976.json.gz
aps5-trace-7b18631f34aa-7248.json.gz
aps5-trace-7b18631f34aa-17656.json.gz
aps5-trace-72a70f6d87ef-22380.json.gz
aps5-trace-72a70f6d87ef-27876.json.gz
aps5-trace-72a70f6d87ef-33088.json.gz
Digests of pair 2, from
python tools/trace_digest.py <trace>:base, aps5-trace-7b18631f34aa-17656.json.gz
frames 7500:300 from present 7500: 300 presents, frame p50 84.6 / p90 85.9 / p99 87.9 / max 90.5 ms, GPU busy 58.6 ms per present
NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit 7b18631f34aa, dropped: yes
Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.EndSubmission 880.8, Driver.Packet 223.8, Driver.Packet.memory_wait 157.2, Driver.WorkerWait 135.0, Driver.WorkerWait.idle_and_completion_poll 135.0, batch 58.6, Driver.Packet.dispatch 46.9, GpuMutex.wait.draw 27.8, Graphics.Draw 23.4, Graphics.Draw.draw_and_resource_release 19.0
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
change, aps5-trace-72a70f6d87ef-27876.json.gz
frames 7500:300 from present 7500: 300 presents, frame p50 81.3 / p90 82.7 / p99 85.4 / max 85.5 ms, GPU busy 59.1 ms per present
NVIDIA GeForce RTX 5090, NVIDIA 617.42, Windows 10.0.26300, 3840x2160, commit 72a70f6d87ef, dropped: yes
Slowest frames (largest slices inside each, inclusive)
Threads (ms per frame)
Largest slices (ms per frame, inclusive, all threads): Driver.EndSubmission 921.9, Driver.Packet 218.4, Driver.Packet.memory_wait 155.7, Driver.WorkerWait 124.9, Driver.WorkerWait.idle_and_completion_poll 124.9, batch 59.1, Driver.Packet.dispatch 45.7, Driver.Dispatch 43.8, Graphics.Draw 42.0, Graphics.Draw.draw_and_resource_release 37.4
Longest waits
Largest GPU batches (GPU ranges inside, and the CPU slices that recorded each, inclusive)
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 github-actions[bot] on 2026-10-19T19:29:42Z.
This pull request is labeled
perf, so it needs the summary line of a capture onmainand one with the change, from the same title, scene and machine, as the Performance report form asks. Please paste bothaps5-summary.jsonllines, attach the two traces and add the output oftools/trace_digest.py.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T19:44:57Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/ENVIRONMENT.mdL234core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppL277, L355core/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppL584core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4610-4611, L4983core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppL355core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppL4983core/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppL355Some 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.
core/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/IndirectDispatch.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/IndirectDispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/IndirectDispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Dispatch/Dispatch.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hppcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/ENVIRONMENT.mddocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/ENVIRONMENT.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by HQasper on 2026-10-19T21:52:40Z.
The CTest registration moved to its own
BUILD_TESTINGblock, so this no longer conflicts with #7705 or any other open pull request inlibSceAgcDriver/CMakeLists.txt; the configured test list is identical before and after. #6804, #7233 and #7371 each append a parameter (borderColorTable,htileClear) toVulkanDevice::dispatch, and #6804 also toDispatchIndirect, where this change appendsthreadGroup. Those declaration lines conflict, but the features are unrelated: whichever lands second keeps both parameters, and a wrong order does not compile. #1364 (open, conflicts withmain) moves small ShaderData blocks into a shared upload page atbufferOffset; if it lands first, the thread-limit copy here must add that offset. No other open pull request changes thread-dimension indirect dispatches. Depends on: none.Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T01:56:38Z.
Windows runs on a different NVIDIA card and an RDNA2 iGPU, plus one extra case the test doesn't cover: two thread-dimension dispatches of the same program in one submission.
Setup: Windows 11 26300, MinGW GCC 15.2 Release,
maineb7500680+ this PR (84a6fb0fe, merges cleanly). GPUs: RTX 5070 Ti (NVIDIA 617.42) and Ryzen 5 9600X Radeon iGPU (ANYPS5_GPU=AMD, 32.0.21042.62), both withANYPS5_REQUIRE_VULKAN=1.agc_driver_indirect_thread_dimensionsand_cpupassed 3 of 3 on each GPU.IndirectThreadDimensions.cpp(diff below, not for merge). One submission holds twoDISPATCH_INDIRECTpackets with USE_THREAD_DIMENSIONS for the same counter program, with the same user data and groups of 64x1x1, each reading its own argument words. So both dispatches share one template and one ShaderData buffer, and only the limit store differs between them. Expected counts are the sums: 100+40, 40+130, and, with GPU-produced arguments, 100+40 and 1+190. A limit from the second store that leaked into the first dispatch, or a dropped limit, would give 80, 192 or similar. Each pair ran 3 rounds per test, under bothagc_driver_indirect_thread_dimensionsand_cpu. All pairs passed on both GPUs, 3 of 3 runs. So the trailing COMPUTE->ALL_COMMANDS barrier of the first dispatch orders its ShaderData reads before the second dispatch'svkCmdCopyBuffer/vkCmdUpdateBufferinto the same buffer, as the code intends.DispatchIndirect(..., shape.group), which doesn't compile against main's sources._cpu(APS5_NO_GPU_THREAD_DIMENSIONS=1, main's path) passes, as expected.ctest -R "agc|shader|spirv|recomp"(825 tests): on NVIDIA 3 failed (msaa_dcc_clear_4,pass_input_hazard,sgpr_pattern_fill_keys); on AMD 5 failed (msaa_dcc_clear_4,sgpr_pattern_fill_keys,layered_volume_vertex_no_gpl,draw_cache_reuse_off,stencil_replay_no_gpl). The same set fails on main on this machine (sgpr_pattern_fill_keysflakes under load). No new failures.check_conventions.py --base origin/mainpasses.No GTA V or other title runs here, so the frame-time claim is not re-measured.
probe
AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by CPritch on 2026-10-20T12:36:53Z.
Ran this on GTA V (PPSA04263 01.010.002), Linux 7.2.8-zen1-2-zen, NVIDIA GeForce RTX 5060 Laptop GPU, NVIDIA 615.71.09, Graphics Mode Performance, the Story prologue after Resume Story, with no input.
main
d14a186f4against maind14a186f4+ #8066 at84a6fb0fe, same machine and session, two runs each in the order A B A B, window frames 3600:700, caches warm, APS5_TRACE_EVENTS=4194304 (BUILD.md's remedy for full trace buffers), no other APS5_TRACE_* or APS5_PROFILE_* switch, log not redirected. The harness navigates the menus from frame dumps in boot and load to present 3420 (APS5_DUMP_FRAMES=114, every 30 presents), which stop before the window.Frame p50: main 81.1, 80.8 ms, with #8066 80.8, 80.7 ms (-0.2 ms, -0.3 %). GPU busy per present: 64.7 and 64.7 ms.
Whether GTA V's DISPATCH_INDIRECT dispatches with thread dimensions took the new GPU path in these runs was not checked.
The summary lines' Driver.EndSubmission (about 2,979 and 2,946 ms per frame) and worker_busy_pct for queue worker 0x0 (about 3,701 and 3,679 %) are not costs: on the pipelined path the Driver.EndSubmission timer stays open through the rewind tail, so nested tails are counted many times over (#8092; #8108 has the fix).
Not tested: other scenes, Fidelity mode, other GPUs.
Written with AI assistance (Claude Code); measured on the machine above.
Summary lines (main, then the PR):
{"commit":"d14a186f4615","dirty":false,"env":{"APS5_DUMP_FRAMES":"114","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3600:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3600:700","first_present":3600,"ms":57589.746},"presents":700,"frame_ms":{"p50":81.071,"p90":89.216,"p99":112.759,"max":114.703},"gpu_busy_ms_per_present":64.591,"worker_busy_pct":{"queue worker 0x0":3701.0},"top_phases_ms_per_frame":{"Driver.EndSubmission":2979.061,"Driver.Packet":63.479,"Graphics.Draw":59.664,"Graphics.Draw.draw_and_resource_release":56.017,"Driver.Packet.draw":50.234,"Driver.Draw":50.019,"VideoOut.Flip":25.232,"Driver.Present":25.211},"trace_dropped":false,"trace":"aps5-trace-d14a186f4615-2448189.json.gz"}
{"commit":"0ed4594f2de0","dirty":false,"env":{"APS5_DUMP_FRAMES":"114","APS5_DUMP_FRAMES_EVERY":"30","APS5_NO_PAD_INPUT":"1","APS5_PAD_INPUT_FILE":"","APS5_TRACE_EVENTS":"4194304","APS5_TRACE_FRAMES":"3600:700"},"gpu":"NVIDIA GeForce RTX 5060 Laptop GPU","driver":"NVIDIA 615.71.09","os":"Linux 7.2.8-zen1-2-zen","cpu":"AMD Ryzen AI 9 465 w/ Radeon 880M","cpu_threads":20,"memory_mib":31391,"title_id":"PPSA04263","title":"Grand Theft Auto V","content_version":"01.010.002","resolution":"3840x2160","window":{"spec":"frames 3600:700","first_present":3600,"ms":57273.579},"presents":700,"frame_ms":{"p50":80.753,"p90":89.564,"p99":105.694,"max":112.216},"gpu_busy_ms_per_present":64.804,"worker_busy_pct":{"queue worker 0x0":3679.401},"top_phases_ms_per_frame":{"Driver.EndSubmission":2945.644,"Driver.Packet":62.559,"Graphics.Draw":59.691,"Graphics.Draw.draw_and_resource_release":56.117,"Driver.Packet.draw":49.536,"Driver.Draw":49.322,"VideoOut.Flip":25.823,"Driver.Present":25.812},"trace_dropped":false,"trace":"aps5-trace-0ed4594f2de0-2456265.json.gz"}
Imported from boykopovar/AnyPS5. Originally posted by HQasper on 2026-10-20T17:41:52Z.
@wachi35676 Thanks for running it on two more GPUs, and for the back-to-back probe. Two dispatches of one program in one submission share the template and the ShaderData buffer and differ only in the limit store, so that is the ordering I most wanted checked, and the sums (140, 170, 191) rule out both a leaked and a dropped limit.
On the negative control: as noted under Tested, without the limit store the first shape runs 128 threads instead of 100, so the test does fail when the store is missing.
@CPritch Thanks for the second machine. -0.3 % is within run-to-run noise, so in this window on this laptop the change makes no measurable difference. The gain in the description comes from removing the CPU reads of thread-dimension arguments, each of which first finishes leased GPU work under the GPU mutex. It can only show where those reads are frequent in the window and the frame waits on them. Your summaries show far less queue-worker work than mine (
Driver.Packetabout 63 against 280 ms per frame, and noDriver.Packet.memory_waitorDriver.Packet.dispatchamong the top phases), and the laptop is closer to GPU-bound (64.7 of 81 ms GPU busy). So either this part of the prologue issues few of these dispatches, or their reads are off the critical path here.APS5_PROFILE_DRAW=1prints an[indirect]line every 10 s with the number of CPU thread-dimension reads and the time they took, which would tell which.I've added your result to the description, so the speed-up isn't read as general.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T21:07:30Z.
Checked the argument kernel's ceil(threads / size) and the thread-limit store, the CPU fallback in
decideIndirect, the dispatch-move refusal for the ShaderData buffer, and the new test (it pins the exact thread count per shape, and the_cpuvariant covers the switch). The back-to-back and AMD/NVIDIA runs from @wachi35676 and your Windows numbers cover the GPU side; merged.