AGC: WAIT_REG_MEM gives up after 1 s while the awaited label is still pending on another queue, so gated work reads too early #2832
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T16:15:39Z.
A
WAIT_REG_MEMgives up afterAPS5_GPU_WAIT_TIMEOUT_MS(1000 ms by default) and lets its queue carry on, even when the awaited label is a recorded store on another queue that the GPU simply hasn't reached yet. When the producing work takes longer than the timeout, the gated work runs early and reads what it was supposed to wait for.agc_driver_gated_dispatch_capturecatches exactly that, so it fails whenever its producer spin outlasts the timeout, which on a slow GPU underctest --parallelhappens on its own.Setup: Windows 11 Home (26200), WinLibs GCC 15.2.0 r7, Release,
main57f96fd2,APS5_NO_PIPELINE_LTO=1(#2777 is a separate issue). Intel Graphics in a Core Ultra 9 275HX (Arrow Lake, driver 32.0.101.8991) and RTX 5060 Laptop GPU (32.0.16.1742).Deterministic repro
Shortening the timeout makes it fail every time, on both GPUs, with the test run on its own:
APS5_GPU_WAIT_TIMEOUT_MSWith 100 ms the test reports
a dispatch behind a cross-queue WAIT_REG_MEM read its table before the producer's label reached memory, so it missed the table the CPU filled after submitting, after:So the driver does know a
WRITE_DATAto that address is recorded on queue 0x28. It just stops waiting for it.Under load
With the default timeout, the test failed in two of my
ctest --parallel 6runs on the iGPU and passes 10/10 on its own. Both failures start the same way, with the 1000 ms timeout above and thenqueue 0x28 dropped 1 queued labels: their record failed. One ended at the test's 10 s limit (the gated submissions did not finish, thenVK_ERROR_DEVICE_LOSTin teardown); the other died at 3.9 s with0xc0000374(heap corruption). I haven't traced the heap corruption, so I'm only reporting that it follows the same timeout.Question
The timeout in
Driver::waitMemory(WaitMemory.cpp,if (warned) return;) looks deliberate, to keep a title moving when a label never comes. But console hardware waits indefinitely here, so giving up while a matching store from another queue is still pending turns a slow frame into wrong results. Would it make sense to keep waiting, or resetstart, while the awaited range has a recorded store from another queue that hasn't completed, and only give up when nothing pending can satisfy it? I'm happy to try that on a branch if it's the direction you'd want, but it's core synchronisation, so I'd rather ask first.AI-assisted (Claude Code); every number above is from runs on this machine.
Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-10T17:51:00Z.
RTX 4070 data, same build setup as yours (Windows 11 Home 26200, WinLibs GCC 15.2.0 r7, Release,
main57f96fd2), RTX 4070 Laptop GPU (Ada, driver 32.0.15.9636), withoutAPS5_NO_PIPELINE_LTO.agc_driver_gated_dispatch_capturerun on its own, 3 runs each:APS5_GPU_WAIT_TIMEOUT_MSThe failures are the ones you describe:
queue 0x20 WAIT_REG_MEM ... timed out after 100ms,earlier write by queue 0x28 opcode 0x37, then the stale-table message. On this GPU the conclusive slot is 2^27 producer iterations, and its producer finishes in under ~400 ms.At the default timeout it passed in 5 full-suite
ctest -j6runs and in 18 batches of allagc_driver_tests under-j12with every cache cold, with noWAIT_REG_MEMtimeout logged in any of them. So it doesn't reproduce here without shortening the timeout.One note on the test: the consumer reads stale data only if the wait gives up before the CPU fills the table 300 ms after submitting. With the default 1000 ms the test can therefore see an early give-up only when that fill is delayed past the timeout, as under heavy load on a slower GPU. A pass at 1000 ms does not show that the wait held.
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-10T23:09:18Z.
@MrMha I tested your branch from #2985 (
fix/wait-memory-timeout-2832,72f62319) on Windows, since that's the case you noted as untested. I merged it ontomaine4045bbb; the only conflict was the test registration inlibSceAgcDriver/CMakeLists.txt. Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5060 Laptop (617.42) and the Arrow Lake iGPU (32.0.101.8991).The repro from this issue is fixed.
agc_driver_gated_dispatch_capturewithAPS5_GPU_WAIT_TIMEOUT_MS=100passes 3/3 on both GPUs, wheremainfails 3/3 on both. Your_short_timeouttest (1 ms) passes every run on NVIDIA.But it breaks an existing test:
agc_driverfails on both GPUs after 10 s withconsumer never passed its wait. That's the second half oftestLabelStoredSinceSubmissionintests/Submit.cpp:Nothing ever stores
labelagain, so the only way that consumer gets through is the old give-up afterAPS5_GPU_WAIT_TIMEOUT_MS. The test asserts it doesn't pass early (at least 900 ms), and then relies on the timeout releasing it. So the timeout-as-completion behaviour is deliberately covered by a test today. Whether that's still wanted is the maintainer call I asked about above, and the branch needs this test updated either way. For example, the test could store the label itself once it's confirmed the consumer is still waiting at around 900 ms, and then check the consumer gets through.Arrow Lake,
_short_timeout: it fails about 1 run in 10 (2 of 10 alone, 2 of 30 with background load) withqueue 0x28 dropped 1 queued labels: their record failed, thenthe gated submissions did not finish. A temporary print inDriver::ReportFailureshowed the record fails because the device is lost (vkWaitForFences recorder: Vulkan result -4), and the Windows log has a GPU timeout (LiveKernelEvent 141) at exactly the times of the failing runs. So on this iGPU the test's long producer spin sometimes runs into the Windows GPU watchdog. That's a limit of the test on a slow GPU rather than your change. Before your change, the 1 ms timeout made it fail every time anyway. In the full parallel suite,agc_driver_gated_dispatch_capturealso failed once on the iGPU; run alone with your branch it passes 5/5, which matches the parallel-load flake I described in the issue.Full
ctest -j6with the branch: NVIDIA 742/743 (onlyagc_driver). Arrow Lake 734/743:agc_driver, the two gated dispatch tests above, and the six known Intel failures listed on #2114.AI-assisted (Claude Code); I ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T02:53:13Z.
@MrMha @Silverash-i8 I prepared a test-only follow-up for #2985: 36b26122a5458028f76fe7c7710333fcfca80f6d,
github.com/Scramblrrrr/AnyPS5@36b26122a5. It can be cherry-picked independently; the branch parent is my 007 integration experiment, not a proposed replacement for your branch.There are three timeout-dependent portions in Submit.cpp, not just the first one: stale pre-submission label, unmatched high dword in a wide wait, and a held label reset by its own queue. Each now signals that it has reached the wait, holds it for 1200 ms, asserts the consumer has not completed, then submits a genuine matching producer and checks completion. The wide case fixes the high dword; the reset case uses another queue.
Windows RTX 5070 Ti / NVIDIA 617.14 / Release with required Vulkan: revised
agc_driverpassed 4.21 s. Negative control restoring justif (warned) return;to WaitMemory fails at the first new assertion after the 1000 ms diagnostic (1.65 s), so this catches timeout-as-completion rather than merely making the old test pass. Restored source then passedagc_driver, gated dispatch capture and its 1 ms short-timeout mode, 3/3 in 7.95 s. Conventions pass. The temporary negative control was removed; no runtime behavior is changed by this commit.This assumes persistent waits are the desired policy, which remains the maintainer decision noted above. It does not test shutdown cancellation of an unsatisfiable wait. I have not opened a duplicate PR.
AI-assisted (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T02:58:25Z.
Parallel-load run of the two together on NVIDIA, since persistent waits are the case that could hang under load: #2985's
72f62319plus @Scramblrrrr's36b26122, applied ontomain961b25fe(the only conflict was the test registration inlibSceAgcDriver/CMakeLists.txt, resolved by keeping both blocks). RTX 4070 Laptop (driver 32.0.15.9636), Windows 11 Home (26200), WinLibs GCC 15.2.0 r7, Release,ANYPS5_REQUIRE_VULKAN=1.agc_driveragc_driver_gated_dispatch_capture..._short_timeout(1 ms)-j12,ANYPS5_NO_SHADER_CACHE=1,__GL_SHADER_DISK_CACHE=0, 3 runsNo hang, timeout or device loss. The full runs' only other failures also fail on
mainhere:pr_overlap_encoding(Python 3.10) andguest_filesystem(no symlink privilege, #3169).Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T03:02:25Z.
Thanks @Zurisen — that independent current-main / RTX 4070 parallel-load run is useful coverage beyond my 5070 Ti check. I will keep the 36b26122 fixture follow-up separate for @MrMha to pick up; it does not close the shutdown-cancellation gap or settle the maintainer's persistent-wait policy decision. My 007 run remains guarded and uses the unchanged 5fd30d503 driver while its lean-preset cache prepares.
AI-assisted (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T03:05:26Z.
@Scramblrrrr @MrMha I ran this on both GPUs here: Windows 11, WinLibs GCC 15.2.0 r7, Release,
main961b25fe+ #2985 (72f62319, theCMakeLists.txtconflict resolved by keeping both test blocks) +36b26122cherry-picked, three runs per GPU.agc_driverpasses on both, 3/3 on the RTX 5060 and 3/3 on the Arrow Lake iGPU. So the reworkedSubmit.cppcases fix the failure I reported above, where the old test counted the timeout as completion.agc_driver_gated_dispatch_captureand_short_timeoutpass 3/3.gated_dispatch_capturetests failed 3/3 withthe gated submissions did not finishandvkWaitForFences recorder: Vulkan result -4, with bursts ofLiveKernelEvent 141(the Windows GPU watchdog) at the same seconds. But when I then went back to plainmain(961b25fe, andd31b57a4) to compare, the same test kept failing there too, with more watchdog resets and a few heap-corruption exits, even though it passed ond31b57a4on this iGPU earlier tonight. So after that first burst of resets the iGPU's driver seems to be in a bad state, and I can't pin the failures on #2985 yet. I'll rerun after a driver reset and post a clean comparison.AI-assisted (Claude Code); I ran all of this on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MrMha on 2026-10-11T05:57:41Z.
Thanks @Scramblrrrr, @Silverash-i8 and @Zurisen for the correction and independent Windows testing.
I’ve incorporated the three-case test correction, credited Scramblrrrr as a coauthor, and synchronized the branch with current main while preserving both test-registration blocks.
Updated commit:
github.com/MrMha/AnyPS5@056534a969Local conventions and whitespace checks pass. The Windows/GPU measurements are yours; I have not rerun them myself. Intel GPU coverage, shutdown cancellation, and the maintainer’s decision on persistent waits remain outstanding.
Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T06:03:22Z.
@MrMha Reran on
056534a9itself, merged into currentmain4be74d4f(clean merge), same RTX 4070 Laptop setup as above:agc_driver,agc_driver_gated_dispatch_captureand..._short_timeoutalone: 3/3 each (agc_driver4.10–4.27 s).-j12withANYPS5_NO_SHADER_CACHE=1and__GL_SHADER_DISK_CACHE=0, 2 runs: 768/769 each; the three tests pass in both, and the only failure ispr_overlap_encoding, which also fails onmainhere (Python 3.10).Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T06:05:03Z.
@MrMha checked
056534a9as pushed (onmaind7cfa728), Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5060 Laptop:agc_driver,agc_driver_gated_dispatch_captureandagc_driver_gated_dispatch_capture_short_timeoutall pass 3/3.The Intel iGPU result is still pending: its driver is in the bad state I described above, so I'll rerun this commit there after a driver reset and post the comparison with plain
main.AI-assisted (Claude Code); I ran this on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MrMha on 2026-10-11T06:40:52Z.
Thanks for verifying the updated commit on Windows.
I’ve added a focused shutdown test on a separate branch: https://github.com/MrMha/AnyPS5/tree/test/wait-memory-shutdown-2832
It leaves labels unsatisfied on three queues, then checks that shutdown finishes without executing commands or queued submissions behind those waits. It builds on
056534a9and changes no runtime behavior.GCC compilation against the production headers, conventions, and whitespace checks pass. Runtime execution remains pending.
Could someone with an existing full build test this branch using:
cmake -S . -B build -DBUILD_TESTING=ON
cmake --build build --target agc_driver_wait_shutdown_tests
ctest --test-dir build -R "^agc_driver_wait_shutdown$" --output-on-failure
Could a maintainer also confirm whether persistent waits are the intended policy and whether #2985 can be reopened for review?
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T06:45:36Z.
@MrMha Ran
test/wait-memory-shutdown-2832(3b21873b), merged intomain1690db9a(clean merge), RTX 4070 Laptop (driver 32.0.15.9636), Windows 11 Home (26200), WinLibs GCC 15.2.0 r7, Release, full build (agc_driver_wait_shutdown_testsis built by the normal build).agc_driver_wait_shutdownalone: 5/5, 0.19–0.30 s. Each run logs the 20 msWAIT_REG_MEM ... timed outdiagnostic for queues0x0,0x20and0x28, so all three reach their unsatisfied wait and stay there, then printsunsatisfied label waits cancelled cleanly at shutdown.-j12withANYPS5_NO_SHADER_CACHE=1and__GL_SHADER_DISK_CACHE=0: 771/772;agc_driver_wait_shutdownpasses (0.30 s), and the only failure ispr_overlap_encoding, which also fails onmainhere (Python 3.10).Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T06:47:11Z.
@MrMha ran
test/wait-memory-shutdown-2832(3b21873b) as you asked: Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 5060 Laptop.agc_driver_wait_shutdownbuilds and passes 5/5 (about 0.2 s each). The log shows the waits on the queues timing out at 20 ms, thenunsatisfied label waits cancelled cleanly at shutdown. On the same buildagc_driver,agc_driver_gated_dispatch_captureand_short_timeoutstill pass.Intel is still pending for the same reason as before.
AI-assisted (Claude Code); I ran this on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T08:51:39Z.
Fixed by #2985 (MrMha, with Scramblrrrr's test rework and the shutdown test), merged. Thanks to everyone who tested it.
The Intel side is still open but tracked separately:
agc_driver_gated_dispatch_capturehits the GPU watchdog on Intel iGPUs on plainmainas well (UHD 620 on Linux and my Arrow Lake iGPU on Windows), which is #3345, and the heap-corruption exit seen on that path is #3171. Closing this one.AI-assisted (Claude Code).