AGC: a submission that ends in a REWIND still waits for every queued registration preparation; PPSA38500 nearly stops presenting #27705

Closed
opened 2026-11-27 04:21:52 +00:00 by videogamer10293 · 0 comments
videogamer10293 commented 2026-11-27 04:21:52 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by videogamer10293 on 2026-11-27T04:21:52Z.


What happens

Since #6867, Driver::Submit waits only for the preparations of the programs a submission binds. It still waits for every queued preparation when the submission ends in a REWIND (Submission.cpp:860), because the queue worker copies the tail after the REWIND later and nothing scans it. The debt entry "Registration preparation at submit" lists this case.

PPSA38500 (content version 01.002.001) submits on queue 0 with REWIND tails. A submission ring dump holds 16 queue-0 records: all 8 full submissions end in a REWIND, and the other 8 are their tails. The dump is the failure report of a run without the local change below, which stopped on the #27525 error. All 8 slow submit waits below are REWIND submissions too. The title also keeps compiling new shaders: five local runs of 300 to 420 s logged 5,375 to 9,945 shader disk cache misses each. So each of those submissions waits for the whole backlog, and presents almost stop. #6846 covers the broader gap between eager and lazy preparation on Ghost of Yōtei.

Measured

Windows 10 (10.0.19045), AMD Ryzen 5 7600X, NVIDIA GeForce RTX 5070 Ti, driver 621.24. To get past its first stop, the title needs a local change that moves the AMM range 64 GiB lower (#27525). Every run below has it, and it is not committed anywhere.

  1. Local print lines around the wait (not committed), on ad7582bad4, 300 s. Only waits of 100 ms or more were printed, with running counters. At the last printed line (the 31.9 s wait), the counters showed 16 submit waits on the wait-for-all path and 1 on the bound-programs path. All 8 printed waits were REWIND submissions whose scan was complete. A wait still running at the 300 s cap would not have printed. The run had 16 presents in its summary (17 by the [flip] counter), all in the first 34 s.
  2. On the same base, with different local print lines, 420 s: eager preparation (the default) with a warm cache had 102 presents. APS5_LAZY_SHADER_PREPARE=1 with an empty cache had 12,129.
  3. Main 5348d022f4 against a branch that scans REWIND tails (described below), 300 s each, APS5_TRACE_SUMMARY_EVERY=10, one warm cache folder shared by both:
Presents (complete intervals: 282.8 s and 285.2 s) Intervals with 1 present Longest frames
main 348 2 129.5 s, 80.4 s, 34.7 s, 9.3 s
branch 5,161 none 9.9 s, 6.5 s

There was one run per side. Main ran first, after four earlier warm-up and trace runs on the same cache folder, branch first. With APS5_TRACE_FRAMES=0:60 and no other trace switch, 60 presents took 2,953 ms on main and 2,191 ms on the branch, and the slowest frame was 472.5 ms against 180.5 ms. Main's slowest frame is 471 ms of Driver.WorkerWait on the queue worker. The trace has no Submit slice, so my reading is that the title was waiting in Submit then.

The newest main, c64b9d323f, has no changes in Submission.cpp, ShaderRegistry.cpp or PacketExecution.cpp since 5348d022f4.

The choice

The branch perf/agc-rewind-tail-bound-wait (3405a67077) changes three things:

  • The queue worker scans each REWIND tail after copying it and before running it, starting from the program pairs bound before the REWIND.
  • The worker waits there only for the programs the tail binds, moved to the front of the queue. A tail whose scan is incomplete waits for all queued preparations, also in the worker.
  • Submit waits only for the programs before the REWIND.

That moves the wait from the submitting thread to the queue worker. CnRJay's review of #6867 warns against exactly that:

... a title that sees a submission take seconds treats the GPU as hung. Goat Simulator 3 (PPSA04159) failed a 10 s timeout when the wait sat in the queue worker.

The options I see:

  1. Keep the wait on the submitting thread, as now. Titles that submit REWIND tails keep waiting for the whole backlog at every submit.
  2. Drop the REWIND case from the wait for all at Submit, and change nothing else. A program the tail binds already waits in the worker at its first use and is moved to the front then (ShaderRegistry.cpp:201). Such a wait lasts as long as that program's preparation; the debt entry names 74 s for the largest shader seen. A one-line local test of this on ad7582bad4, with local print lines and a partly warm cache, had 5,496 presents in 300 s. I did not time its worker waits.
  3. The branch without its fallback: wait in the worker before each tail, only for the programs the tail binds. This is the same wait as option 2, started earlier.
  4. The branch as it is, with the fallback: also wait for all queued preparations in the worker when a tail's scan is incomplete. That can hold the GPU side for the whole backlog.
  5. Something else, such as a bound on the worker wait.

Which of these is acceptable? If option 2, 3 or 4 is, I would first measure the worker waits on this title: how many there are, how often a tail's scan is incomplete, and the longest wait against the 10 s margin. Then I would open a PR. The branch also does not yet end a worker wait on shutdown or device loss, because Driver::stop joins the workers before it closes the preparation pool.

Not covered

One machine, and one run per side for the branch comparison. Nothing was measured on a console or on other titles, and I don't know which other titles submit REWIND tails. I have not timed the queue-worker waits of the branch or of option 2.

AI-assisted: yes. Claude Code ran the title on my machine, added the local print lines, wrote the branch and drafted this issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6639912457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/27705). Originally posted by [videogamer10293](https://github.com/videogamer10293) on 2026-11-27T04:21:52Z. --- ### What happens Since #6867, `Driver::Submit` waits only for the preparations of the programs a submission binds. It still waits for every queued preparation when the submission ends in a `REWIND` ([Submission.cpp:860](https://github.com/boykopovar/AnyPS5/blob/688a0ae99e10a3683f77bc83c46a7f3d27e18208/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Queues/Submission.cpp#L860)), because the queue worker copies the tail after the `REWIND` later and nothing scans it. The debt entry "Registration preparation at submit" lists this case. PPSA38500 (content version 01.002.001) submits on queue 0 with `REWIND` tails. A submission ring dump holds 16 queue-0 records: all 8 full submissions end in a `REWIND`, and the other 8 are their tails. The dump is the failure report of a run without the local change below, which stopped on the #27525 error. All 8 slow submit waits below are `REWIND` submissions too. The title also keeps compiling new shaders: five local runs of 300 to 420 s logged 5,375 to 9,945 shader disk cache misses each. So each of those submissions waits for the whole backlog, and presents almost stop. #6846 covers the broader gap between eager and lazy preparation on Ghost of Yōtei. ### Measured Windows 10 (10.0.19045), AMD Ryzen 5 7600X, NVIDIA GeForce RTX 5070 Ti, driver 621.24. To get past its first stop, the title needs a local change that moves the AMM range 64 GiB lower ([#27525](https://github.com/boykopovar/AnyPS5/issues/27525#issuecomment-7204293252)). Every run below has it, and it is not committed anywhere. 1. Local print lines around the wait (not committed), on `ad7582bad4`, 300 s. Only waits of 100 ms or more were printed, with running counters. At the last printed line (the 31.9 s wait), the counters showed 16 submit waits on the wait-for-all path and 1 on the bound-programs path. All 8 printed waits were `REWIND` submissions whose scan was complete. A wait still running at the 300 s cap would not have printed. The run had 16 presents in its summary (17 by the `[flip]` counter), all in the first 34 s. 2. On the same base, with different local print lines, 420 s: eager preparation (the default) with a warm cache had 102 presents. `APS5_LAZY_SHADER_PREPARE=1` with an empty cache had 12,129. 3. Main `5348d022f4` against a branch that scans `REWIND` tails (described below), 300 s each, `APS5_TRACE_SUMMARY_EVERY=10`, one warm cache folder shared by both: | | Presents (complete intervals: 282.8 s and 285.2 s) | Intervals with 1 present | Longest frames | |---|---|---|---| | main | 348 | 2 | 129.5 s, 80.4 s, 34.7 s, 9.3 s | | branch | 5,161 | none | 9.9 s, 6.5 s | There was one run per side. Main ran first, after four earlier warm-up and trace runs on the same cache folder, branch first. With `APS5_TRACE_FRAMES=0:60` and no other trace switch, 60 presents took 2,953 ms on main and 2,191 ms on the branch, and the slowest frame was 472.5 ms against 180.5 ms. Main's slowest frame is 471 ms of `Driver.WorkerWait` on the queue worker. The trace has no `Submit` slice, so my reading is that the title was waiting in `Submit` then. The newest main, `c64b9d323f`, has no changes in `Submission.cpp`, `ShaderRegistry.cpp` or `PacketExecution.cpp` since `5348d022f4`. ### The choice The branch [`perf/agc-rewind-tail-bound-wait`](https://github.com/videogamer10293/AnyPS5/commits/perf/agc-rewind-tail-bound-wait) (`3405a67077`) changes three things: - The queue worker scans each `REWIND` tail after copying it and before running it, starting from the program pairs bound before the `REWIND`. - The worker waits there only for the programs the tail binds, moved to the front of the queue. A tail whose scan is incomplete waits for all queued preparations, also in the worker. - `Submit` waits only for the programs before the `REWIND`. That moves the wait from the submitting thread to the queue worker. CnRJay's [review of #6867](https://github.com/boykopovar/AnyPS5/pull/6867#pullrequestreview-5603955023) warns against exactly that: > ... a title that sees a submission take seconds treats the GPU as hung. Goat Simulator 3 (PPSA04159) failed a 10 s timeout when the wait sat in the queue worker. The options I see: 1. Keep the wait on the submitting thread, as now. Titles that submit `REWIND` tails keep waiting for the whole backlog at every submit. 2. Drop the `REWIND` case from the wait for all at `Submit`, and change nothing else. A program the tail binds already waits in the worker at its first use and is moved to the front then ([ShaderRegistry.cpp:201](https://github.com/boykopovar/AnyPS5/blob/688a0ae99e10a3683f77bc83c46a7f3d27e18208/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L201)). Such a wait lasts as long as that program's preparation; the debt entry names 74 s for the largest shader seen. A one-line local test of this on `ad7582bad4`, with local print lines and a partly warm cache, had 5,496 presents in 300 s. I did not time its worker waits. 3. The branch without its fallback: wait in the worker before each tail, only for the programs the tail binds. This is the same wait as option 2, started earlier. 4. The branch as it is, with the fallback: also wait for all queued preparations in the worker when a tail's scan is incomplete. That can hold the GPU side for the whole backlog. 5. Something else, such as a bound on the worker wait. Which of these is acceptable? If option 2, 3 or 4 is, I would first measure the worker waits on this title: how many there are, how often a tail's scan is incomplete, and the longest wait against the 10 s margin. Then I would open a PR. The branch also does not yet end a worker wait on shutdown or device loss, because `Driver::stop` joins the workers before it closes the preparation pool. ### Not covered One machine, and one run per side for the branch comparison. Nothing was measured on a console or on other titles, and I don't know which other titles submit `REWIND` tails. I have not timed the queue-worker waits of the branch or of option 2. AI-assisted: yes. Claude Code ran the title on my machine, added the local print lines, wrote the branch and drafted this issue.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#27705
No description provided.