Windows AMD: agc_driver_native_multisample_depth fails about one run in five since #10443 (settleImport locks a null settle-queue mutex) #26649

Closed
opened 2026-11-24 13:33:32 +00:00 by Plyxen · 0 comments
Plyxen commented 2026-11-24 13:33:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-24T13:33:32Z.


What happens

agc_driver_native_multisample_depth stops in about one run in five on the AMD iGPU with FATAL: C++ exception St12system_error raised on thread N cannot be delivered: libSceAgcDriver.prx+0xd897e5 has no unwind data.

Title, test or build step

ctest agc_driver_native_multisample_depth

AnyPS5 commit

main e68be05111 and 403fbe6fc1, nothing merged on top

System

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, AMD Radeon gfx1036 iGPU 1002:13c0 (Adrenalin 26.11.2, Vulkan driver 2.0.353). The RTX 5080 (621.24) in the same machine does not fail.

Steps to reproduce

$env:ANYPS5_GPU = 'Radeon'
$env:ANYPS5_REQUIRE_VULKAN = '1'
$env:ANYPS5_NO_SHADER_CACHE = '1'
ctest --test-dir build -R '^agc_driver_native_multisample_depth$' -V

Run it 20 times; each run takes under 3 s.

Log

[write-watch] host imports of write-watched memory keep the write watch: yes (...); direct host imports of private memory are settled and stay watched, separate shared aliases retain guest write tracking

FATAL: C++ exception St12system_error raised on thread 6928 cannot be delivered: 0x00007ffa038697e5 libSceAgcDriver.prx+0xd897e5 has no unwind data
  stack return address candidates:
    libSceAgcDriver.prx+0xd897e5   settleImport [clone .cold]
    libSceAgcDriver.prx+0x44e6f3   the callback importRunAt passes to ImportWatched
    libSceAgcDriver.prx+0x1800e5   GuestMemory::ImportWatched
    libSceAgcDriver.prx+0x44f9a5   importWatching
    libSceAgcDriver.prx+0x45265e   importRunAt
    libSceAgcDriver.prx+0x454083   importAllocation
    libSceAgcDriver.prx+0x45497c   importAccess

The names are from nm on the 403fbe6fc1 build.

What was checked

Radeon Failures
403fbe6fc1 7 of 31 runs
e68be05111 2 of 21 runs
403fbe6fc1 with APS5_SETTLE_FLOOR_KIB=1024 0 of 20
RTX 5080, 403fbe6fc1 0 of 14

Every failure is the same exception at the same address.

Cause. settleImport begins with std::unique_lock queueLock(*context.settleQueueMutex), and the throw is the null check of that lock: the disassembly loads context.settleQueueMutex, tests it and jumps to __throw_system_error(EPERM). The call comes from importRunAt, which on Windows settles a private writable import at the import whenever state.watchPrivateImports is set and the import is at or above PrivateSettleFloorBytes(), without asking whether the context has a settle queue.

decideImportWatch keeps that decision under the VkDevice handle (state.watchDevice) and ClearHostImports does not drop it. The test opens three driver devices (CheckDrawFeedback, CheckDepthAttachmentAlias, CheckStorageAliasRetirement), which have a settle queue and decide "private imports are settled", and afterwards a bare Device whose Context has none. When the driver gives that bare device the handle of the last driver device, decideImportWatch returns early and the bare context inherits the decision. With temporary logging in a failing run:

[TMPDBG] decide device=0000013c8dadfc00 previous=0000013c8d7cd810 previousPrivate=1 settleQueue=0000013c8813ab40 mutex=0000013c8765c400
[TMPDBG] settled import with no settle mutex: device=0000013c8dadfc00 watchDevice=0000013c8dadfc00 stateDevice=0000013c8dadfc00 base=0x200020000 bytes=0x20000 requester=build settleQueue=0000000000000000
FATAL: C++ exception St12system_error raised on thread 12680 cannot be delivered

In a passing run the bare device has a handle of its own and decides again. The AMD driver reused the handle in 12 of 40 runs. I did not log handles on the RTX 5080; it never failed, although the deterministic form below fails there too.

Since #10443. The import is 128 KiB. Before 71dad17b46 only imports of 1 MiB and more settled at the import, so the test did not reach settleImport through the bare context.

Deterministic form. A copy of a driver context with settleQueue and settleQueueMutex cleared, importing 128 KiB of private writable memory, throws the same exception every time, on both GPUs (3 of 3 each).

Not known.

  • Whether AMD 24.30.36 reuses the handle too; I no longer have that driver installed.
  • Whether an inherited decision does harm elsewhere, for example the dma-buf selection on Linux.
  • Why the exception cannot be delivered (has no unwind data for the cold part of settleImport). I did not look into that; with a catchable exception the test would still fail.

A fix for the settle path follows as a pull request.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6582962056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/26649). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-24T13:33:32Z. --- ### What happens `agc_driver_native_multisample_depth` stops in about one run in five on the AMD iGPU with `FATAL: C++ exception St12system_error raised on thread N cannot be delivered: libSceAgcDriver.prx+0xd897e5 has no unwind data`. ### Title, test or build step ctest `agc_driver_native_multisample_depth` ### AnyPS5 commit `main` `e68be05111` and `403fbe6fc1`, nothing merged on top ### System Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, AMD Radeon gfx1036 iGPU `1002:13c0` (Adrenalin 26.11.2, Vulkan driver 2.0.353). The RTX 5080 (621.24) in the same machine does not fail. ### Steps to reproduce ``` $env:ANYPS5_GPU = 'Radeon' $env:ANYPS5_REQUIRE_VULKAN = '1' $env:ANYPS5_NO_SHADER_CACHE = '1' ctest --test-dir build -R '^agc_driver_native_multisample_depth$' -V ``` Run it 20 times; each run takes under 3 s. ### Log ``` [write-watch] host imports of write-watched memory keep the write watch: yes (...); direct host imports of private memory are settled and stay watched, separate shared aliases retain guest write tracking FATAL: C++ exception St12system_error raised on thread 6928 cannot be delivered: 0x00007ffa038697e5 libSceAgcDriver.prx+0xd897e5 has no unwind data stack return address candidates: libSceAgcDriver.prx+0xd897e5 settleImport [clone .cold] libSceAgcDriver.prx+0x44e6f3 the callback importRunAt passes to ImportWatched libSceAgcDriver.prx+0x1800e5 GuestMemory::ImportWatched libSceAgcDriver.prx+0x44f9a5 importWatching libSceAgcDriver.prx+0x45265e importRunAt libSceAgcDriver.prx+0x454083 importAllocation libSceAgcDriver.prx+0x45497c importAccess ``` The names are from `nm` on the `403fbe6fc1` build. ### What was checked | Radeon | Failures | |---|---| | `403fbe6fc1` | 7 of 31 runs | | `e68be05111` | 2 of 21 runs | | `403fbe6fc1` with `APS5_SETTLE_FLOOR_KIB=1024` | 0 of 20 | | RTX 5080, `403fbe6fc1` | 0 of 14 | Every failure is the same exception at the same address. **Cause.** `settleImport` begins with `std::unique_lock queueLock(*context.settleQueueMutex)`, and the throw is the null check of that lock: the disassembly loads `context.settleQueueMutex`, tests it and jumps to `__throw_system_error(EPERM)`. The call comes from `importRunAt`, which on Windows settles a private writable import at the import whenever `state.watchPrivateImports` is set and the import is at or above `PrivateSettleFloorBytes()`, without asking whether the context has a settle queue. `decideImportWatch` keeps that decision under the `VkDevice` handle (`state.watchDevice`) and `ClearHostImports` does not drop it. The test opens three driver devices (`CheckDrawFeedback`, `CheckDepthAttachmentAlias`, `CheckStorageAliasRetirement`), which have a settle queue and decide "private imports are settled", and afterwards a bare `Device` whose `Context` has none. When the driver gives that bare device the handle of the last driver device, `decideImportWatch` returns early and the bare context inherits the decision. With temporary logging in a failing run: ``` [TMPDBG] decide device=0000013c8dadfc00 previous=0000013c8d7cd810 previousPrivate=1 settleQueue=0000013c8813ab40 mutex=0000013c8765c400 [TMPDBG] settled import with no settle mutex: device=0000013c8dadfc00 watchDevice=0000013c8dadfc00 stateDevice=0000013c8dadfc00 base=0x200020000 bytes=0x20000 requester=build settleQueue=0000000000000000 FATAL: C++ exception St12system_error raised on thread 12680 cannot be delivered ``` In a passing run the bare device has a handle of its own and decides again. The AMD driver reused the handle in 12 of 40 runs. I did not log handles on the RTX 5080; it never failed, although the deterministic form below fails there too. **Since #10443.** The import is 128 KiB. Before `71dad17b46` only imports of 1 MiB and more settled at the import, so the test did not reach `settleImport` through the bare context. **Deterministic form.** A copy of a driver context with `settleQueue` and `settleQueueMutex` cleared, importing 128 KiB of private writable memory, throws the same exception every time, on both GPUs (3 of 3 each). **Not known.** - Whether AMD 24.30.36 reuses the handle too; I no longer have that driver installed. - Whether an inherited decision does harm elsewhere, for example the dma-buf selection on Linux. - Why the exception cannot be delivered (`has no unwind data` for the cold part of `settleImport`). I did not look into that; with a catchable exception the test would still fail. A fix for the settle path follows as a pull request. 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#26649
No description provided.