feat(libSceAgcDriver): raise MaxDispatchVariants cap to allow larger cache via APS5_DISPATCH_VARIANTS #6656
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6656"
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 al3w0f205 on 2026-10-16T01:59:48Z.
What
Expands
MaxDispatchVariantsfrom 8 to 32 inDispatchCache.hppand default variants from 4 to 16 inDispatchCache.cpp.This prevents compute dispatch variant evictions and pipeline thrashing in titles where compute programs switch across multiple dynamic resource and binding configurations.
All extraneous changes (DMA pattern fill refactoring, reserve optimizations, and group drain modifications) have been dropped to keep this PR strictly focused on the dispatch variant cache.
Tested
tools/check_conventions.py --base origin/mainpasses cleanly.ctest -R agc_driverpasses cleanly.Checklist
Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-17T00:05:19Z.
Data point from a CPU-bound scene on Windows: RTX 3060 12 GB (NVIDIA 617.42), i5-12400F, Windows 10 19045, MinGW GCC Release. Minecraft Dungeons II (PPSA16064 01.100.100), title screen, no input, 200 s rows,
APS5_PROFILE_DRAW=1 APS5_PROFILE_GPU=1;mainaf0fff762vsmain+ this PR, interleaved with five other PRs in one batch, two rounds. FPS is the mean of the last 10[present]windows, GPU busy and idle gaps per frame over the last 8. This scene is CPU-bound on this machine (44-47 ms of idle gaps per frame).mainWithin the run-to-run spread (
mainitself moved 6.61 -> 6.76 between rounds), no regression, 0 fatal.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-18T00:09:46Z.
Tested on Linux (Arch),
c++ (GCC) 16.2.1 20260810, Release,BUILD_TESTING=ON,mainate3838332ee31af787ad311b7eadbe53d8d012e95. GPU tests ran on lavapipe (llvmpipe, LLVM 22.1.8).This PR breaks three existing tests:
agc_driver_pm4,agc_driver_pipelined_dispatchandagc_driver. Onmainthey pass (2 of 2 fullctest -j8runs). Onmainplus this PR each fails (2 of 2):Each test checks the behaviour this PR changes, so they need to follow it if the change is intended:
agc_driver_pm4: the PR replacesrequire(guarded.empty(), "conditional execution range exceeds its command buffer")(Submission.cpp:159onmain) with code that ends open ranges at the end of the buffer (Submission.cpp:100and:164on its head).Pm4.cpp:1067and:1077onmainstill expect the rejectionexceeds its command buffer.agc_driver_pipelined_dispatch:Dispatch.cpp:131onmaindrains the draw pipeline (Drain(..., 0x15)) before every dispatch. This PR drops that drain and only drains when an HTILE clear overlaps (Dispatch.cpp:139on its head).PipelinedDispatch.cpp:193(also:210,:241,:257) requires at least one drain with opcode 0x15 whenAPS5_PIPELINE_DISPATCHis off. With the old drain put back in front ofcopyBuffer, the test passes (2 of 2).agc_driver:PacketMemory.cpp:271turns the pipelined DMA path on by default (APS5_PIPELINE_DMAopt-in onmain,APS5_NO_PIPELINE_DMAopt-out here), and:295drops the 4-byte alignment condition. The PR description does not mention the default change.Submit.cpp:537countscopiesToHostMemoryfor a copy into host memory, and that copy now takes the pipelined path instead. WithAPS5_NO_PIPELINE_DMA=1agc_driverpasses (3 of 3);agc_driver_pm4andagc_driver_pipelined_dispatchstill fail.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-18T00:22:14Z.
Follow-up to my comment above: with this PR, #6914 and #6249 merged together, the pipelined DMA copy path that this PR turns on by default holds back its own source flush. The cause and a tested two-hunk fix are on #6914: https://github.com/boykopovar/AnyPS5/pull/6914#issuecomment-6243672245
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by al3w0f205 on 2026-10-18T01:08:54Z.
Rebased onto current main and resolved the test regressions:
equire(guarded.empty(), "conditional execution range exceeds its command buffer"). gc_driver_pm4 passes.
Verified locally: gc_driver, gc_driver_pm4, and gc_driver_pipelined_dispatch all pass 100%, and ools/check_conventions.py passes cleanly.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T07:45:05Z.
Review: CHANGES_REQUESTED
Thanks for the rebase and for reverting the parts that broke
agc_driver_pm4,agc_driver_pipelined_dispatchandagc_driver. The current head has these problems:PacketExecution.cpp:41: the newcase 0x50:duplicates the existingcase 0x50: {at:45in the sameswitch. That is a duplicate case label and does not compile with GCC/MinGW. The existing 0x50 branch already handles theOverlapscheck andpipelineDma(); if the overlap check is what you want for pattern fills, change that branch instead.PacketExecution.cpp:362-363: the pre-groupDrainnow only runs withAPS5_GROUP_CAPTURE_ALL_QUEUESset. That removes a drain for every group capture on queue 0 by default, which is not described in the PR and no test covers it. Show why it is safe (what the drain protected) and add a test, or drop it.PacketMemory.cpp:293: the pattern fill no longer goes throughPm4::ResolveStore, so its size/bounds validation is replaced byfillBytes > immediateLimitonly; please keep theAccessiblecheck on the destination and say how this matches the old behaviour for sizes not a multiple of 4.Dispatch.cpp:204is a refactor with no behaviour change, andreserveat:71likewise; the PR is "one topic", so drop them.If the Overcooked
COND_EXECcrash is still unfixed, that is a separate PR with a test inagc_driver_pm4.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T17:32:21Z.
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 al3w0f205 on 2026-10-19T17:32:25Z.
Rebased onto current main and scoped this PR strictly to the dispatch variant cache: dropped the DMA pattern fill changes, reserve calls, and group capture drain changes. The PR now cleanly expands
MaxDispatchVariantsto 32 and default variants from 4 to 16 to eliminate variant thrashing, with conventions and tests passing 100%.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T17:34:32Z.
Review: CHANGES_REQUESTED
Thanks for scoping this down to the variants change. What is missing before it can merge:
perflabel needs the evidence the bot asked for: theaps5-summary.jsonlline ofmainand of this PR from the same title, scene and machine, plus thetools/trace_digest.pyoutput. The only measurement in the thread (parl0v, Minecraft Dungeons II, RTX 3060) was taken on the previous head and shows no gain (6.61 → 6.60 FPS); please show a scene where the evictions actually happen and what they cost.APS5_DISPATCH_VARIANTS.ctest -R agc_driverand the conventions check do not show the claimed benefit.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T13:20:48Z.
Review: CHANGES_REQUESTED
Thanks for dropping the default change. What is still missing:
DispatchCache.cpp, but the head only changesMaxDispatchVariants(8 → 32) inDispatchCache.hpp:24. Please update What/Tested to describe the actual change.APS5_DISPATCH_VARIANTS. Show a title/scene where a value above 8 helps: theaps5-summary.jsonlline ofmainand of this PR (same title, scene, machine, withAPS5_DISPATCH_VARIANTSset) plus thetools/trace_digest.pyoutput, as theperflabel bot asks. The only measurement in the thread shows no gain.Pull request closed