agc_driver takes up to 123 s on Windows: its self-linking buffer check runs to the 1 << 26 word copy limit #22565

Closed
opened 2026-11-17 21:11:47 +00:00 by Jazeupoi · 0 comments
Jazeupoi commented 2026-11-17 21:11:47 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-17T21:11:47Z.


What happens

On Windows, agc_driver takes 26 to 123 s and sometimes hits the 120 s ctest timeout. Almost all of that time is the self-linking check in testChainedIndirectBuffers, which waits for the driver's jump-loop copy limit. CONTRIBUTING.md asks for 30 s per test.

Title, test or build step

agc_driver (agc_driver_tests, core/libs/prx/libSceAgcDriver/tests/Submit.cpp)

AnyPS5 commit

main 5adb7d22ab with #22373 merged. #22373 is needed only because the full Windows test build stops on #22358.

System

Windows 11, AMD Ryzen 5 3400G (4 cores, 8 threads), 16 GB, NVIDIA GeForce RTX 2060 (driver 621.24), WinLibs GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Release.

Steps to reproduce

ctest --test-dir build -R '^agc_driver$' --output-on-failure

Log

Run alone on this tree, 6 runs: 39.6, 30.0, 33.4, 26.1, 103.2 and 27.0 s. In the full-suite run with --parallel 8 it timed out at 120 s.

What was checked

Where the time goes. I timed each call in main() with a local copy of Submit.cpp; the timing code is not part of any change.

Run whole test testChainedIndirectBuffers every other call
1 89.1 s 76.8 s 0.3 s or less
2 122.9 s 110.8 s 0.3 s or less
3 25.5 s 13.3 s 0.3 s or less

Inside testChainedIndirectBuffers, timed separately in 5 runs:

  • The self-linking buffer (expectFailure on loopPacket, Submit.cpp lines 158 to 167) took 14.0 to 22.6 s.
  • The 2000-buffer chain took 0.0 s to submit and 0.0 s for AgcDriverWaitIdle_nid_postfix.

Why. The check builds a 4-word buffer whose only packet chains back to itself. Driver::copyCommands (Execution/src/Driver/Queues/Submission.cpp:183) starts with budget = 1 << 26 words. copyLink (line 201) takes 4 words from it per pass, so the loop is rejected only after about 16.7 million passes. The run time follows that work, and on this machine it varies a lot between runs.

macOS for comparison. On an Apple M4 (x86-64 Release under Rosetta 2, main e798a424c7 with #17425 and #11049), the whole agc_driver test took 20.7 and 24.6 s.

Possible directions. These are for maintainers to choose; I have not implemented either.

  • Reject a chain whose target buffer was already entered in the same copy. A buffer that links to itself can never finish, so this would fail at once. The test only checks that the message contains copy limit.
  • Keep the driver as it is and let this check run with a smaller budget.

#22441 is open and changes copySegment and copyLink, so a driver-side change would touch the same code.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6454231076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/22565). Originally posted by [Jazeupoi](https://github.com/Jazeupoi) on 2026-11-17T21:11:47Z. --- ### What happens On Windows, `agc_driver` takes 26 to 123 s and sometimes hits the 120 s ctest timeout. Almost all of that time is the self-linking check in `testChainedIndirectBuffers`, which waits for the driver's jump-loop copy limit. CONTRIBUTING.md asks for 30 s per test. ### Title, test or build step `agc_driver` (`agc_driver_tests`, `core/libs/prx/libSceAgcDriver/tests/Submit.cpp`) ### AnyPS5 commit `main` `5adb7d22ab` with #22373 merged. #22373 is needed only because the full Windows test build stops on #22358. ### System Windows 11, AMD Ryzen 5 3400G (4 cores, 8 threads), 16 GB, NVIDIA GeForce RTX 2060 (driver 621.24), WinLibs GCC 15.2.0 r7 (`x86_64-ucrt-posix-seh`), Release. ### Steps to reproduce ``` ctest --test-dir build -R '^agc_driver$' --output-on-failure ``` ### Log Run alone on this tree, 6 runs: 39.6, 30.0, 33.4, 26.1, 103.2 and 27.0 s. In the full-suite run with `--parallel 8` it timed out at 120 s. ### What was checked **Where the time goes.** I timed each call in `main()` with a local copy of `Submit.cpp`; the timing code is not part of any change. | Run | whole test | `testChainedIndirectBuffers` | every other call | |---|---|---|---| | 1 | 89.1 s | 76.8 s | 0.3 s or less | | 2 | 122.9 s | 110.8 s | 0.3 s or less | | 3 | 25.5 s | 13.3 s | 0.3 s or less | Inside `testChainedIndirectBuffers`, timed separately in 5 runs: - The self-linking buffer (`expectFailure` on `loopPacket`, `Submit.cpp` lines 158 to 167) took 14.0 to 22.6 s. - The 2000-buffer chain took 0.0 s to submit and 0.0 s for `AgcDriverWaitIdle_nid_postfix`. **Why.** The check builds a 4-word buffer whose only packet chains back to itself. `Driver::copyCommands` (`Execution/src/Driver/Queues/Submission.cpp:183`) starts with `budget = 1 << 26` words. `copyLink` (line 201) takes 4 words from it per pass, so the loop is rejected only after about 16.7 million passes. The run time follows that work, and on this machine it varies a lot between runs. **macOS for comparison.** On an Apple M4 (x86-64 Release under Rosetta 2, `main` `e798a424c7` with #17425 and #11049), the whole `agc_driver` test took 20.7 and 24.6 s. **Possible directions.** These are for maintainers to choose; I have not implemented either. - Reject a chain whose target buffer was already entered in the same copy. A buffer that links to itself can never finish, so this would fail at once. The test only checks that the message contains `copy limit`. - Keep the driver as it is and let this check run with a smaller budget. #22441 is open and changes `copySegment` and `copyLink`, so a driver-side change would touch the same code. AI-assisted: yes (Claude Code)
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#22565
No description provided.