perf(agc): run the dispatches a compute ring leaves unordered side by side #9176
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9176"
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 Celegans12 on 2026-10-21T14:20:49Z.
What
Compute-ring dispatches separated only by SET_SH_REG/NOP share a run when their buffer/image accesses are disjoint. Queue 0 and unsupported dispatch kinds stay ordered; unknown/BDA accesses conflict with everything and a resource owner cannot join twice.
APS5_NO_DISPATCH_OVERLAP=1restores separate dispatches.#7449 mirror clears must remain outside runs; #9508 heap buffers must remain visible to the access checks.
Tested
Windows 11, MinGW-w64 GCC 15.2.0, Release,
-DBUILD_TESTING=ON, SPIR-V Tools off; based onmaina043b048db.80ff4017eedd:agc_driver_dispatch_overlap/agc_driver_dispatch_overlap_off, 2/2 NVIDIA and 2/2 Windows lavapipe, once each. Build/registration pass; Vulkan required, cache off, Khronos 1.4.363 loaded, no skips/VUIDs/sync diagnostics; 30 s local limit.Historical Yōtei 1.008 title-menu counters (2026-10-24) omit CPU and other worker/phase fields: full baseline, full change. They do not establish an FPS gain.
Not tested in this carry: Linux, macOS, titles/FPS or console behavior. Earlier negative controls are historical.
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)Historical summary excerpts; all retained values unchanged
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T14:21:04Z.
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 janzezno on 2026-10-21T14:56:07Z.
Run on AMD hardware.
Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release,
BUILD_TESTING=ON.maincecb540a6; PR head0c930692amerged on top (clean merge).main: 38 of 38 pass. PR: 40 of 40 pass, including the newagc_driver_dispatch_overlapandagc_driver_dispatch_overlap_off.VUID-messages in either run, so the deferred and skipped barriers draw no synchronization errors from the validation layer on RADV. The layer loaded in both runs.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-21T17:29:36Z.
Review: COMMENTED
The microbenchmark is a real signal (8 independent dispatches 0.80 ms against 6.3 ms with a barrier between each pair on an RTX 3080 Laptop). The design decides overlap from the absence of packets the game wrote, and that is the wrong evidence.
SET_SH_REGandNOP. That says the game didn't ask for ordering; it does not say the dispatches are independent. Titles that skip aCS_PARTIAL_FLUSH/ACQUIRE_MEMbetween two dispatches may still depend on the second starting after the first has launched, and nothing in the PR shows that none does. Before this PR the emulator imposed full ordering and hid that; now a dispatch that reads what the previous one wrote through the same memory (not the sameresourcesobject) runs concurrently with it. The PR's own tests only check that dispatches over separate resources keep their results.PassHazardsdoes it for draws in one render pass, and the staged-element code knows each element's extent). Overlap a dispatch only when its ranges are disjoint from the run's, and treat unknown accesses (BDA, indirect) as conflicting, the wayPassHazardsdoes. That makes overlap a proven-independent case and costs one range check; the packet-pattern rule makes it a guess. Please add that check, and a test where dispatch B reads what A writes, with onlySET_SH_REGbetween them, and requires B to see A's result.main)": overlap off added about 146 ms of summed GPU time per frame (+19%) on PPSA26344, with presents unchanged because the scene is CPU-bound. That is a GPU-time number on a scene where the frame rate doesn't move. Post the summary lines of main and this PR from the same scene, and one GPU-bound scene where the benefit would show in frame time.agc_driver_dispatch_overlapand a game scene would show it's not specific to the NVIDIA barrier cost.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-21T18:05:57Z.
Review: COMMENTED
A data point for the hazard question in my earlier review: #9287, stacked on this PR, says "PPSA26344 v1.008: renders correctly in our tree with this change (geometry broke before the guards)" and adds a rule that "a dispatch does not join when one of its ranges overlaps a range of the run" when one side is a staged copy. So overlapping dispatches already produced wrong geometry on this title once the copies were allowed inside a run.
That shows the dispatch overlap in this PR needs the same guard in the base case: a dispatch must not join an open run when its read or write ranges overlap the ranges of the run (reads against writes, writes against writes), and unknown accesses (BDA, indirect) must conflict, not only the staged-copy case #9287 covers. Please add that check here, with a test where dispatch B reads what A wrote with only
SET_SH_REGbetween them, rather than leaving it to a follow-up that depends on this one landing first.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-22T00:14:33Z.
Thanks, you're right that the packet pattern was the wrong evidence. No CS_PARTIAL_FLUSH between two dispatches only says the game didn't ask for ordering, not that the dispatches are independent, and #9287's geometry history shows what happens when that gap is left open. I've amended the commit so a dispatch joins an open run only when its accesses are disjoint from the run's: every bound buffer range counts as a read, every written range as a write, and storage images (including sampled views of them) are compared by image. Reads against writes and writes against writes conflict. An address-based or BDA build counts as writing all memory, and indirect, LDS, thread-dimension and staged dispatches never join.
agc_driver_dispatch_overlapnow has the case you asked for: B reads the buffer A just wrote with only SET_SH_REG between them, and it must not join and must see A's values. There are also write-after-read and write-after-write versions, and the same pair over disjoint buffers still joins. With the range check taken out, the read case fails with "1 joined a run, expected 0" in 3 of 3 runs. To be honest, its data check still passed in those runs, probably because a single 64-lane group finishes before the next one starts, so the join count is what actually guards it. #9287 now relies on this base check instead of its own rule for staged copies.You're also right that the main-vs-PR summary lines from one scene and a GPU-bound scene are still owed. In the part of Yotei's world we can reach we're CPU-bound in the committer, so frame time won't move there; I'll post both summary lines and look for a GPU-bound spot. We don't have AMD hardware either. Could someone with an AMD card run
agc_driver_dispatch_overlapandagc_driver_dispatch_overlap_off?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T08:24:08Z.
Review: CHANGES_REQUESTED
Review
I reviewed the dispatch eligibility, access-range conflict checks, deferred barrier lifecycle, and the added ordering/hazard cases. I did not confirm a behavioral defect in the read/write conflict predicate from static inspection. I’m requesting changes because the branch is far behind current
main, the performance report does not yet meet the repository’s evidence rule, and some active overlaps need to be recorded and coordinated.Bring the branch and validation current
This head is 721 commits behind current
main(merge basede4ef842b5). The tests in the description were run against that old base. Please rebase on currentmain, resolve any conflicts, and rerun the focused dispatch tests on bothmainand this head.This changes the AGC driver, so the PR checklist also requires the focused tests on both revisions with
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1, andANYPS5_REQUIRE_VULKAN=1underctest -V, including a comparison of newVUID-messages and confirmation the requested validation layer loaded. The reported Windows/WSL test counts and dispatch cases are useful, but the description does not report this comparison.Performance report
The repo requires a
perfPR to provide valid summary lines formainand the change from the same machine and scene, with traces. The currentperf numbers missinglabel reflects the gap: the PPSA26344 result compares the feature enabled/disabled in “our own tree (not main),” and the 8-dispatch microbenchmark is not a main-versus-change scene report.Please add same-scene, same-machine
mainand rebased-head summary lines and traces as described by the performance issue form. Keep the enabled/disabled run as a useful feature-isolation result, but label it separately from the required main comparison.Open overlaps
The generated overlap report lists currently open #6946, #9508, and #7449 in code changed here; the PR body currently records #7920 and mentions #8278/#8992. In particular, #6946 changes packet execution ordering in the same function, #9508 is stacked on #6946, and #7449 touches the dispatch recording/barrier path. Please update the overlap notes, agree on integration order with the affected authors, and add a
Depends onentry if this branch actually depends on another PR. The #7920 barrier interaction is already called out; please preserve that coordination as well.Checks
git diff --check: passed.tools/check_conventions.pyagainst currentmain: passed.The test matrix and explicit
APS5_NO_DISPATCH_OVERLAPcontrol are useful. I’ll revisit after the current-base validation, performance comparison, and overlap notes are updated.Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-22T13:30:10Z.
Thanks for the careful pass, especially the reminder that the validation-layer comparison is part of the checklist. I hadn't run it. I've rebased onto current
main(cc0078595d, with #8992 in) and restacked #9287 and #9289. The rebase changed no lines of the PR's diff. I moved the ring-order hook two lines down so it no longer touches the lines #6946 edits.Validation: I ran
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V -R dispatchonmainand on the head. WithVK_LOADER_DEBUG=layerthe loader shows the layer being added from the SDK 1.4.363 registry entry, and there's no "was not found" message.mainpasses 12/12 and the head 14/14 (the same 12 plus the two overlap tests), with noVUID-message on either. That's in the body now, together with fresh Windows and Linux runs on the new base.On performance, I've split the two results. The game number stays as a feature on/off result from our own tree, and it's labelled that way. A
main-vs-change game scene isn't possible yet: plainmaindoesn't reach Yōtei's world. It stops on the loading screen at about 160 s and later aborts on a 10_11_11 blend; a follow-up to #9020 is in progress. What I can give formainagainst this head is a driver-level microbenchmark: 8 unordered single-group dispatches of a loop, timed until the results are visible on the CPU. That's 12.5 ms onmainand 1.79 ms here, and 12.3 ms vs 12.8 ms when a CS partial flush separates them. The harness is on our fork (bench/dispatch-overlap, not for merge) if you want to rerun it. I'll post game summary lines oncemaingets into the world.On overlaps, @AlxcBTW @hugodearaujo @Raghav314, I don't think there's an ordering dependency in either direction. Whoever lands second adds one condition:
!mirrorClearedinoverlapCapable). The leading-barrier lines conflict textually.ShaderResources::RunAccesses, or else count as unknown so they never join.If any of you would rather this one went first or last, tell me and I'll rebase to match.
Details
x = x*x + 1in floats 32,767 times, then a store; median of 40 rounds, 3 runs per arm, RTX 3080 Laptop, driver 610.62.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T20:19:56Z.
Review: CHANGES_REQUESTED
Thanks for the access-range check and the rebase; I read the full diff and found no logic defect in the conflict predicate, the deferred-barrier flushes or the exclusions. What is left is the evidence rule for
perfPRs (also asked by the labels bot on 2026-10-21):aps5-summary.jsonlline of a capture with the change and one withAPS5_NO_DISPATCH_OVERLAP=1(that switch records every dispatch as before, so it is a valid baseline on the same tree, title, scene and machine), and add thetools/trace_digest.pyoutput of both. The "+146 ms GPU per frame" figure in Tested should come from those two captures, attached to the PR.Overlap notes for #7449 (
!mirrorCleared) and #9508 (heap-bound ranges visible toRunAccesses) are fine as written; whichever lands second adds its condition.