agc_driver_sgpr_pattern_fill_keys times out under parallel ctest load #8708

Closed
opened 2026-10-20 21:42:29 +00:00 by janzezno · 3 comments
janzezno commented 2026-10-20 21:42:29 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-20T21:42:29Z.


What

agc_driver_sgpr_pattern_fill_keys fails intermittently under parallel ctest. It hits the 10 s deadline in ReadAfterWrite (tests/execution/SgprPatternFillKeys.cpp):

[Shaders/ShaderRegistry.cpp:613 ReportPreparedAtUse] Compute shader 0x55b3cdbc9900 was not registered; preparing its artifact at dispatch
[log] 10.1 s: 25 lines (24 stdout, 1 stderr), 2.2 KiB written, 0 repeats coalesced; ...
AGC graphics: the submitted dispatch never became a pending write over the keys

A passing run takes about 0.15 s, so the dispatch's write note never shows up at all; it isn't just slow. ReadAfterWrite is called from 8 places with the same message, so the log doesn't show which step timed out.

Reproduce

On main e48bbff9f:

for i in $(seq 1 20); do
  ctest --test-dir build -j12 -R 'agc|shader|spirv|recomp' --output-on-failure > run-$i.log 2>&1
  grep -qE 'sgpr_pattern_fill_keys .*\*\*\*Failed' run-$i.log && { echo "failed in run $i"; break; }
done
  • Failed in run 7 of 7 here, after 6 clean runs. On ca74ef217 it failed in about 3 of 15 full ctest -j12 runs.
  • Run alone it has never failed: ctest -R '^agc_driver_sgpr_pattern_fill_keys$' --repeat until-fail:20 passes 20 of 20 on e48bbff9f.
  • The other failures in the same runs are unrelated and fail every time on this machine: agc_driver_guest_memory_lifetime (#7784, #7849), agc_driver_image_array_window_past_layer_limit (#8361) and agc_driver_tessellation (#5444).

It isn't specific to this machine. The testing notes on #8066 list sgpr_pattern_fill_keys failing on both NVIDIA and AMD with the same -R "agc|shader|spirv|recomp" run, also as a flake under load.

Environment

  • Arch Linux, kernel 7.2.11, GCC 16.2.1, Release, BUILD_TESTING=ON
  • AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, Ryzen 5 7500F (12 threads)

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5950130376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8708). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-20T21:42:29Z. --- ### What `agc_driver_sgpr_pattern_fill_keys` fails intermittently under parallel `ctest`. It hits the 10 s deadline in `ReadAfterWrite` (`tests/execution/SgprPatternFillKeys.cpp`): [Shaders/ShaderRegistry.cpp:613 ReportPreparedAtUse] Compute shader 0x55b3cdbc9900 was not registered; preparing its artifact at dispatch [log] 10.1 s: 25 lines (24 stdout, 1 stderr), 2.2 KiB written, 0 repeats coalesced; ... AGC graphics: the submitted dispatch never became a pending write over the keys A passing run takes about 0.15 s, so the dispatch's write note never shows up at all; it isn't just slow. `ReadAfterWrite` is called from 8 places with the same message, so the log doesn't show which step timed out. ### Reproduce On `main` `e48bbff9f`: ``` for i in $(seq 1 20); do ctest --test-dir build -j12 -R 'agc|shader|spirv|recomp' --output-on-failure > run-$i.log 2>&1 grep -qE 'sgpr_pattern_fill_keys .*\*\*\*Failed' run-$i.log && { echo "failed in run $i"; break; } done ``` - Failed in run 7 of 7 here, after 6 clean runs. On `ca74ef217` it failed in about 3 of 15 full `ctest -j12` runs. - Run alone it has never failed: `ctest -R '^agc_driver_sgpr_pattern_fill_keys$' --repeat until-fail:20` passes 20 of 20 on `e48bbff9f`. - The other failures in the same runs are unrelated and fail every time on this machine: `agc_driver_guest_memory_lifetime` (#7784, #7849), `agc_driver_image_array_window_past_layer_limit` (#8361) and `agc_driver_tessellation` (#5444). It isn't specific to this machine. The testing notes on #8066 list `sgpr_pattern_fill_keys` failing on both NVIDIA and AMD with the same `-R "agc|shader|spirv|recomp"` run, also as a flake under load. ### Environment - Arch Linux, kernel 7.2.11, GCC 16.2.1, Release, `BUILD_TESTING=ON` - AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, Ryzen 5 7500F (12 threads) AI-assisted: yes
MarcZX10 commented 2026-10-20 21:46:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:46:13Z.


One diagnostic improvement may make the next parallel failure easier to localize: ReadAfterWrite is called from eight checkpoints, but each timeout currently reports “the submitted dispatch never became a pending write over the keys.” Passing a short checkpoint label (or submission sequence) into ReadAfterWrite and including it in the timeout would identify which pattern fill failed to produce a note. That would not establish the root cause, but it should distinguish an early setup/preparation failure from a later submission or recorder failure in the same test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302309229 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8708#issuecomment-6302309229). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T21:46:13Z. --- One diagnostic improvement may make the next parallel failure easier to localize: `ReadAfterWrite` is called from eight checkpoints, but each timeout currently reports “the submitted dispatch never became a pending write over the keys.” Passing a short checkpoint label (or submission sequence) into `ReadAfterWrite` and including it in the timeout would identify which pattern fill failed to produce a note. That would not establish the root cause, but it should distinguish an early setup/preparation failure from a later submission or recorder failure in the same test.
janzezno commented 2026-10-20 21:56:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-20T21:56:29Z.


Found the cause; it's in the test, and any of the eight checkpoints can hit it.

ReadAfterWrite waits for Recorder::NewestWriteNote over the keys, but that only scans the open and in-flight batches. If the queue worker submits the dispatch and the batch retires before the test thread takes GpuMutex, the note is gone and the loop can only wait out the 10 s. Under load the test thread is descheduled long enough for that to happen.

Reproduced deterministically by adding a 200 ms sleep at the start of ReadAfterWrite: it fails 3 of 3 with the same message after 10.2 s. APS5_NO_OPPORTUNISTIC_REAP=1 doesn't help (3 of 3 still fail), so the end-of-submission drain retires it too.

@MarcZX10 thanks, a label would have said which checkpoint. With the cause known I'd rather fix it than label it: I'll send a PR that puts a WRITE_DATA label after the dispatch and resubmits the same fill when the label is written but no note is pending. The assertions stay as they are.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302581431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8708#issuecomment-6302581431). Originally posted by [janzezno](https://github.com/janzezno) on 2026-10-20T21:56:29Z. --- Found the cause; it's in the test, and any of the eight checkpoints can hit it. `ReadAfterWrite` waits for `Recorder::NewestWriteNote` over the keys, but that only scans the open and in-flight batches. If the queue worker submits the dispatch and the batch retires before the test thread takes `GpuMutex`, the note is gone and the loop can only wait out the 10 s. Under load the test thread is descheduled long enough for that to happen. Reproduced deterministically by adding a 200 ms sleep at the start of `ReadAfterWrite`: it fails 3 of 3 with the same message after 10.2 s. `APS5_NO_OPPORTUNISTIC_REAP=1` doesn't help (3 of 3 still fail), so the end-of-submission drain retires it too. @MarcZX10 thanks, a label would have said which checkpoint. With the cause known I'd rather fix it than label it: I'll send a PR that puts a `WRITE_DATA` label after the dispatch and resubmits the same fill when the label is written but no note is pending. The assertions stay as they are.
MarcZX10 commented 2026-10-20 21:58:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T21:58:58Z.


That diagnosis matches the current ReadAfterWrite loop: once the queue retires the batch, NewestWriteNote no longer provides evidence for the already-completed fill. The label-and-retry approach sounds appropriate for a test-side race. Please preserve the deterministic delayed-reader reproduction as regression coverage (or an equivalent controlled scheduling hook), and keep the retry bounded so a genuinely missing dispatch still fails instead of spinning. This will distinguish “write completed before observation” from a dispatch that never wrote.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6302642353 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8708#issuecomment-6302642353). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T21:58:58Z. --- That diagnosis matches the current `ReadAfterWrite` loop: once the queue retires the batch, `NewestWriteNote` no longer provides evidence for the already-completed fill. The label-and-retry approach sounds appropriate for a test-side race. Please preserve the deterministic delayed-reader reproduction as regression coverage (or an equivalent controlled scheduling hook), and keep the retry bounded so a genuinely missing dispatch still fails instead of spinning. This will distinguish “write completed before observation” from a dispatch that never wrote.
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#8708
No description provided.