test(agc): split the gated dispatch producer spin into short dispatches #3833

Merged
David-cmrg merged 1 commit from upstream-pr/3833 into main 2026-10-11 22:08:18 +00:00
David-cmrg commented 2026-10-11 17:20:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by David-cmrg on 2026-10-11T17:20:46Z.


What

Fixes #3345. agc_driver_gated_dispatch_capture ran its producer spin as one dispatch of 2^26 iterations, doubled per slot. On Intel HD Graphics 520 (Gen9, i915) that dispatch runs for about 3.1 s. i915 cannot preempt it within preempt_timeout_ms (640 ms) and resets the context, with the same Resetting rcs0 for preemption time out and GPU HANG: ecode 9:1:85ddfffa as in the issue. The test then fails with vkWaitForFences recorder: Vulkan result -4.

The producer now issues the same iterations as 64 dispatches of 2^20 each before its label write, and doubles the number of dispatches per slot. The 300 ms fill delay, the iterations per slot and the fresh, stale and inconclusive checks are unchanged.

Tested

Fedora 44 (toolbox container), GCC 16.2.1, Release, BUILD_TESTING=ON, Mesa 26.2.4, ANYPS5_REQUIRE_VULKAN=1. Host kernel 6.19.10, i915, rcs0 preempt_timeout_ms 640.

Device main a11c8f7f this branch
Intel HD Graphics 520 (SKL GT2, ANV) default fails 3/3, _short_timeout fails 1/1: dropped 1 queued labels, Vulkan result -4, i915 reset on every run both pass 23/23, about 3.7 s each, no i915 reset
llvmpipe (LLVM 22.1.8), GALLIUM_OVERRIDE_CPU_CAPS=avx both pass 5/5, about 4.3 s each both pass 5/5, about 4.4 s each

Both variants finish on their first slot on both devices. On the HD 520, one dispatch of 2^20 iterations takes 50 ms. 64 of them, 2^26 in total, take 3.15 s with no reset. tools/check_conventions.py passes. Not tested on Windows or other GPUs.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Opus 5.5)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820889901 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3833). Originally posted by [David-cmrg](https://github.com/David-cmrg) on 2026-10-11T17:20:46Z. --- ### What Fixes #3345. `agc_driver_gated_dispatch_capture` ran its producer spin as one dispatch of 2^26 iterations, doubled per slot. On Intel HD Graphics 520 (Gen9, i915) that dispatch runs for about 3.1 s. i915 cannot preempt it within `preempt_timeout_ms` (640 ms) and resets the context, with the same `Resetting rcs0 for preemption time out` and `GPU HANG: ecode 9:1:85ddfffa` as in the issue. The test then fails with `vkWaitForFences recorder: Vulkan result -4`. The producer now issues the same iterations as 64 dispatches of 2^20 each before its label write, and doubles the number of dispatches per slot. The 300 ms fill delay, the iterations per slot and the fresh, stale and inconclusive checks are unchanged. ### Tested Fedora 44 (toolbox container), GCC 16.2.1, Release, `BUILD_TESTING=ON`, Mesa 26.2.4, `ANYPS5_REQUIRE_VULKAN=1`. Host kernel 6.19.10, i915, rcs0 `preempt_timeout_ms` 640. | Device | `main` a11c8f7f | this branch | |---|---|---| | Intel HD Graphics 520 (SKL GT2, ANV) | default fails 3/3, `_short_timeout` fails 1/1: `dropped 1 queued labels`, `Vulkan result -4`, i915 reset on every run | both pass 23/23, about 3.7 s each, no i915 reset | | llvmpipe (LLVM 22.1.8), `GALLIUM_OVERRIDE_CPU_CAPS=avx` | both pass 5/5, about 4.3 s each | both pass 5/5, about 4.4 s each | Both variants finish on their first slot on both devices. On the HD 520, one dispatch of 2^20 iterations takes 50 ms. 64 of them, 2^26 in total, take 3.15 s with no reset. `tools/check_conventions.py` passes. Not tested on Windows or other GPUs. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude Opus 5.5)
Silverash-i8 commented 2026-10-11 17:37:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T17:37:33Z.


Windows run of this branch (6200b8c7, on main a11c8f7f) on the Arrow Lake iGPU from #3345: Windows 11 Home 26200, Intel driver 101.8991, WinLibs GCC 15.2.0 r7, Release, ANYPS5_GPU=Intel, ANYPS5_NO_SHADER_CACHE=1.

main a11c8f7f (my earlier rerun on #3345) this branch
agc_driver_gated_dispatch_capture 19 of 20, about 3.4 to 3.6 s; the failure was dropped 1 queued labels, Vulkan result -4 and a burst of LiveKernelEvent 141 (GPU watchdog) 20 of 20, 2.35 to 2.57 s
agc_driver_gated_dispatch_capture_short_timeout not run 20 of 20, 2.36 to 2.48 s

The event log has no LiveKernelEvent at all across the 40 runs on the branch. Since main only failed 1 in 20 here, 40 clean runs are consistent with the fix rather than proof of it. The shorter run time does fit the GPU no longer sitting in one long dispatch.

On the RTX 5060 Laptop (driver 617.42), both variants pass 5 of 5 (about 1.3 s each).

AI-assisted (Claude Code); I ran the above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111790385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3833#issuecomment-6111790385). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T17:37:33Z. --- Windows run of this branch (`6200b8c7`, on `main` `a11c8f7f`) on the Arrow Lake iGPU from #3345: Windows 11 Home 26200, Intel driver 101.8991, WinLibs GCC 15.2.0 r7, Release, `ANYPS5_GPU=Intel`, `ANYPS5_NO_SHADER_CACHE=1`. | | `main` `a11c8f7f` (my earlier rerun on #3345) | this branch | |---|---|---| | `agc_driver_gated_dispatch_capture` | 19 of 20, about 3.4 to 3.6 s; the failure was `dropped 1 queued labels`, `Vulkan result -4` and a burst of `LiveKernelEvent 141` (GPU watchdog) | 20 of 20, 2.35 to 2.57 s | | `agc_driver_gated_dispatch_capture_short_timeout` | not run | 20 of 20, 2.36 to 2.48 s | The event log has no `LiveKernelEvent` at all across the 40 runs on the branch. Since `main` only failed 1 in 20 here, 40 clean runs are consistent with the fix rather than proof of it. The shorter run time does fit the GPU no longer sitting in one long dispatch. On the RTX 5060 Laptop (driver 617.42), both variants pass 5 of 5 (about 1.3 s each). AI-assisted (Claude Code); I ran the above on my machine.
adriadam10 commented 2026-10-11 22:08:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:08:15Z.


Checked the diff (same total iterations, 64 dispatches of 2^20 instead of one of 2^26; fresh/stale/inconclusive checks unchanged), build and ctest of the libSceAgcDriver scope on Linux (both agc_driver_gated_dispatch_capture variants pass), and the hardware results in the thread: HD 520 23/23 and Silverash-i8's Arrow Lake run on Windows 20/20, versus the i915 reset / watchdog on main. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114385440 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3833#issuecomment-6114385440). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:08:15Z. --- Checked the diff (same total iterations, 64 dispatches of 2^20 instead of one of 2^26; fresh/stale/inconclusive checks unchanged), build and ctest of the libSceAgcDriver scope on Linux (both `agc_driver_gated_dispatch_capture` variants pass), and the hardware results in the thread: HD 520 23/23 and Silverash-i8's Arrow Lake run on Windows 20/20, versus the i915 reset / watchdog on `main`. Merging.
Sign in to join this conversation.
No reviewers
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!3833
No description provided.