Repository navigation
fix(agc): land cross-queue waits and capture the gated compute group at the gate - #1864
Conversation
bf6f123 to
d9a69e4
Compare
d9a69e4 to
f8a7323
Compare
|
Added a test, On On the branch it passed 3 of 3 runs and under ctest, and also passes on lavapipe. If the label lands before the fill, the run proves nothing, so the test doubles the producer loop and tries again; it returns 77 if no run is conclusive. Also rebased on f145139. The TechnicalDebt conflict keeps both sides. |
f8a7323 to
f5dd9ce
Compare
|
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
No title was run. 🤖 Addressed by Claude Code |
|
Please drop |
|
Done in 6c292c4. Both switches are gone and the fixes always run now.
AI-assisted: yes |
|
It now conflicts with main in |
6c292c4 to
38e25e8
Compare
|
Rebased onto main 0011248. New head: 38e25e8. The conflict was in Tested on an RTX 5070 Ti (NVIDIA 595.91.07), built with AI-assisted: yes |
|
Conflicts with main again in |
38e25e8 to
db1bd55
Compare
|
Rebased onto current
Built and ran the libSceAgcDriver ctest scope on the rebased head: 315/315 pass, including |
|
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.
|
What
A compute queue worker passes a
WAIT_REG_MEMas soon as another queue's worker has recorded the label store it waits on, before the GPU has executed that store. The dispatches behind the wait are then captured from guest memory the title has not written yet. On hardware the CP cannot pass the wait that early, so titles fill the tables a gated dispatch reads after they submit, and GPU latency keeps it ordered. Demon's Souls does this every frame, and it crashes 20-90 s into boot withguest memory is not readable at 0x60, bad V#s or null texture bases on a compute queue. #1787 has the traces.Two commits:
LabelStorerecords the writing queue for that check. The graphics queue is exempt by default, because landing its waits on the compute queues' labels took the attract from 50-54 to 36-39.5 fps, and this title fills its graphics buffers before submitting them.APS5_LAND_WAITS_ALL_QUEUES=1includes it. A landing wait restarts its timeout only when packets finish, since it runs inside a packet that is itself in flight. A TechnicalDebt entry records the graphics-queue exemption.SET_*packets. The real dispatch adopts the parked result if the program address and cache key still match. The lookahead stops at a packet that writes guest memory other than a label, at conditional or predicated packets, and at a dispatch that reads a label or buffer an earlier dispatch of the run writes. CPU-path indirect arguments are read at the gate too. If the device later finds the memory changed (guest snapshot differs from registered memory), the dispatch is resolved again from current memory, as onmain.One gap is left. The capture now holds gate-time memory, but the GPU still reads the live import later. Queue 0's next frame overwrites a few structs the group reads, so the device check rejects about 5 dispatches per frame, and those are resolved live (708 in 150 s). Binding gate-time snapshots for those regions would close the gap; it isn't in this PR.
Closes #1787.
Tested
Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti, driver 595.91.07.
main(ce64d8e). The only conflicts were in the TechnicalDebt list; both sides are kept.main0011248, after fix(agc): store labels the GPU cannot reach in stream order #2044 removed the not-imported label outcome (6).PacketMemory.cppkeeps main's outcomes and passes the writing queue tonoteLabelStore. Built withANYPS5_ENABLE_SPIRV_TOOLS=ON:agc_driver_gated_dispatch_capturepasses, andctest -R agc_ -j1passes 279 of 280 on the RTX 5070 Ti. The one failure,agc_driver_dcc_keys_first_write, also fails on plainmain0011248 on this GPU.ctest -R "agc_driver|guest_agc_driver": 203 of 203 pass, withoutAPS5_WRITE_WATCH_IMPORTS.agc_driver_lds_atomics64andagc_driver_scalar_sop1are excluded; they fail on unmodifiedmainon this GPU too (the first one hangs it).python3 tools/check_conventions.py --base origin/main: passes.APS5_THREAD_PRIORITY=high, Driver queue workers and the presenter lose their cores to a title's spinning job threads #1788), which makes the race more likely:main, normal prioritymain, high priorityThe 15 runs include 4 with a 48x24 depth copy that made the crash 2 of 2 before. The group capture costs 25-75 ms per 10 s on queue 0x20, and the parked result is adopted 0.35-0.65 ms after the gate on average. Movie and attract frame rates are unchanged (305-346 presents per 10 s in the movie).
Those runs were measured on an older
main(c1241ad) with #861 and a few other local patches. The settle condition and the landing timeout in commit 1 came after them, when a landing wait on a re-armed label hung the title past the main menu, so they weren't in the build behind the 15 runs.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository