Skip to content

fix(agc): land GPU writes over guest memory before a host write into it - #6926

Merged
adriadam10 merged 19 commits into
boykopovar:mainfrom
EagleBearerYS:fix/agc-host-write-pending-storage
Nov 8, 2026
Merged

adriadam10 merged 19 commits into
boykopovar:mainfrom
EagleBearerYS:fix/agc-host-write-pending-storage

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

A host write into guest memory doesn't wait for the GPU writes recorded or in flight over the same memory, and doesn't store the storage-image results still pending there.

  • Which writes are host writes: every write made through a GuestArena::HostWrite scope. That covers the APR read (libkernel/Apr/src/Apr.cpp:159-170), AIO, read/pread/readv, recv/recvfrom in libkernel and libSceNet, the fcntl/ioctl outputs, libc's file reads and WebKit's mkstemp.
  • What the scope does today: it never reaches the driver. On Linux it does nothing at all, since GuestWriteWatchBeginHostWrite is Apple-only.

Why that loses data: a storage image's write-back into host-imported guest memory is recorded, not made, while a recorder is active.

  • StorageTexture::writeBackLayers (Graphics/src/Texture.cpp) decides which 64 KiB blocks to keep for the CPU, records the retile and the copy into the open batch, and notes a pending write. The bytes land when that batch runs.
  • So a store recorded before a host write can land after it, over the data the host just wrote.
  • A host write that covers only part of a block over pending results loses the other way. The store keeps the whole block for the CPU, so the image's results in the rest of it never land.

Related: #6636, where the crash below was traced; #6234, the read direction (pending GPU results flushed before file writes), whose hook this one pairs with.

The title. Epic Mickey: Rebrushed (PPSA15657, UE 4.27) crashes now and then while it loads its first level. johnmaia ran it on Linux, RX 7600 (RADV, Mesa 25.2.8), on main 5d9dcc4 + #6236 with no other changes (#6636, comment):

Runs Failed before reaching the level
APS5_STORE_AT_FLIP=1 16 0
Unset, alternated 8 3
  • The three failures:
    • ObjectSerializationError on SM_MachineSet_01b (UE's "Serial size mismatch");
    • LowLevelFatalError [Line: 1609] right after the title opens /savedata0/ue4savegame.dpx.sav;
    • a SIGSEGV in the title's own code.
  • The trace behind them:
    • On main, about 2 runs in 5 crash this way. In those, a 64 KiB block of file data the title had just read is zeroed about 18 ms after the read, with no CPU write path of the driver involved (#6636, comment).
    • In a traced run, the APR read of a crashing pair landed on a block that a storage-image write-back had covered about 50 ms before it (#6636, comment).
  • How this PR fits it: APS5_STORE_AT_FLIP=1 stores pending results at every flip, which closes that window. This PR closes it at the host write itself.
  • Confirmed in the title: on that base, none of johnmaia's 12 runs with this fix failed, against 6 of 24 without it (#6636, comment; Tested below). No open issue tracks this crash. On main from 2026-10-24 the crash no longer shows without this PR either (johnmaia's follow-up); johnmaia names fix(agc): keep storage image results recorded after a direct write when its completion stamps it again #8126 and fix(agc): sync a host read on a store recorded after its snapshot check #8751, merged on 10-23, as plausible changes that cover the same path.

The fix:

  • libc: GuestArenaBeginHostWrite_nid_postfix now calls a hook first, on every platform, for every non-empty range. The setter is GuestArenaSetHostWriteHook_nid_no_patch, so every HostWrite user above gets it with no change at the call site.
  • Driver: it registers GuestMemory::PrepareHostWrite in Driver::Driver and clears it in ~Driver. PrepareHostWrite calls FlushGpuWrites under ReadSiteScope(ReadSite::Store), as the driver's own guest stores (GuestMemory::Write, WriteChanged) already do. That call:
    • waits for every open or in-flight batch whose writes overlap the range;
    • stores the results still pending there;
    • waits for that store too.
  • Teardown (2ff4ed6, from CnRJay's review): the hook is an atomic pointer (GuestArena.cpp). Driver::stop() now clears it first, before the worker joins, then sets a stopped flag and waits up to 1 s for calls already inside the hook to leave. PrepareHostWrite counts itself in flight (seq_cst) before it checks the flag and returns at once if it is set, so either a call sees the flag or stop() sees the call. The wait is bounded because on Windows ExitProcess can end a thread inside the hook before ~Driver runs; if the bound expires, stop() logs it and goes on. ~Driver still clears the hook as before.
  • The macOS import window: it opens its own HostWrite scope under the tracker lock, so it skips the hook through a thread-local guard and can't re-enter the tracker.
  • Locks: no caller holds a mutex when the hook runs.
    • libSceNet releases its g_mutex before its HostWrite.
    • DescriptorControl's lock is the guest record-lock struct, not a mutex.
    • The other sites hold nothing.
    • The GPU waits run with the GPU mutex released when the hook's acquisition is the outermost, as for any CPU access.
    • Checked (c272007, from CnRJay's review): a host write made while the thread holds the GPU mutex is counted (GuestMemory::LockedHostWrites) and logged once with its thread, address and size, then goes on. With APS5_ASSERT_GPU_LOCK=1, the switch AssertGpuLockHeld already reads, it aborts with a [lock] ASSERT: line instead. It doesn't throw in a normal run: with the mutex held, the hook takes FlushForAccess's nested locked wait, which hangs only if completing needs another thread to take the GPU mutex, so a throw would turn a possible hang into a certain crash. The debt file states the rule.
  • The debt entry (docs/dev/debt/libSceAgcDriver.md) narrows main's late-store sentence (agc-driver: write-back drops GPU results of full 64 KiB blocks of 1920x1080 render targets (PPSA12544 backgrounds garbled) #1970) to the title's own CPU stores, which still aren't ordered after a recorded store: they survive only in the 64 KiB blocks the write watch saw written. Its CPU reads after a label still read stale memory.

Cost: the hook adds about 75-90 ns to a 64 KiB host write with nothing to wait for (82.5-97.7 ns against 6.9-7.1 ns, the test's --cost mode). That's the flush hook's fast path, well under the read() it precedes.

  • The slow path (276f67d, from CnRJay's review): with APS5_PROFILE_DRAW=1, a [hostwrite] line every 10 s counts the host writes, those that waited for GPU work over their range, and the total and longest wait, e.g. [hostwrite] 2 host writes, 1 waited for GPU work over their range: 1.34 ms in total, 1.34 ms at most. Without the switch nothing is counted. The title's numbers aren't measured yet.

How:

  1. fix(agc): land GPU writes over guest memory before a host write into it: the hook, the driver's registration, the debt entry and the new test agc_driver_host_write_pending_storage (tests/execution/HostWritePendingStorage.cpp).
    • The setup: a compute dispatch writes a 128×120 RGBA16F, 64 KiB-tiled storage image over a 128 KiB write-watched guest surface.
    • The host write: a file is read into the surface the way libc's _readFile does it, std::ifstream::read inside a GuestArena::HostWrite scope. A later FlushGpuWrites plays the guest's read.
    • The check: the file's bytes must survive, and the image's texels must be everywhere else.
    • Its four cases:
      • a store recorded before a 64 KiB host write;
      • the same with a 4 KiB host write;
      • a 64 KiB host write over pending results;
      • a 4 KiB host write over pending results.
  2. refactor(agc): name the host write hook as a pair to the host read hook: names the setter and the driver function after fix(libs): flush pending GPU results before file writes #6234's host read hook (GuestArenaSetHostReadHook_nid_no_patch, PrepareHostRead). The _nid_no_patch suffix follows CONTRIBUTING.md for helper symbols that must not become NIDs.

Tested

  • Epic Mickey: Rebrushed (PPSA15657), johnmaia's runs: Linux, RX 7600 (RADV, Mesa 25.2.8), short runs to the first level, APS5_STORE_AT_FLIP unset (#6636, comment). Current main rarely shows the crash, so they ran the fix on the base where it fails:

    Tree Runs Failed before reaching the level
    main 5d9dcc4 + fix(libScePlayGo): let users answer unlisted chunks #6236 8 3
    the same + fix(agc): store pending image results after the range's writers finish #6364 (unrelated to this case) 16 3
    the same + this PR's first two commits (99af947, 082c326) 12 0
    main e751dd2 8 0
    • All 12 runs with the fix reached the level and played to the end of the run. None showed the ObjectSerializationError, the LowLevelFatalError [Line: 1609] or the SIGSEGV.
    • The title's log line: in a traced run with the fix (APS5_TRACE_APR=1 APS5_TRACE_FLUSH=1), 23 APR reads were each followed at once by the hook storing a pending image over their destination, before the read's bytes were written:
      [apr] read …/recolored-ps5.ucas offset=0x10a89ca0 size=0x41338 -> 0x204c540000
      [flush] image 0x204c540000+0x60000 for memory access 0x204c540000+0x41338
      
    • They ran the first two commits. The three after them (the teardown, the lock check and the counters) keep the same flush: PrepareHostWrite still calls FlushGpuWrites over the written range.
  • Alone in the Dark (PPSA08240, v1.00), LeoFeitosa's runs (comment): Windows 11 (26200), RTX 5070 Ti (driver 617.42), WinLibs GCC 15.2.0, Release.

    • Both sides were built from the same tree, with the same shader cache and save state. Every run sets APS5_PLAYGO_UNLISTED_CHUNKS=installed, and has no input until the main menu.
    • Six alternating pairs, each from launch to the main menu or the crash:
    Tree Runs Reached the main menu
    main cd700fe 6 1
    this PR (2c5b772) 6 5
    main + APS5_STORE_AT_FLIP=1 3 3
    • The crashes on main, all while loading:
      • 2 × LowLevelFatalError [Line: 3230], "Serial size mismatch" on UI textures;
      • 1 × 0xc000001d on FAsyncLoadingThread;
      • 2 × 0xc0000005 at Alone in the Dark.exe+0x20ec0bc.
    • The one crash with this PR is the last kind, 0xc0000005 at +0x20ec0bc. Whether it shares the cause isn't traced.
    • Eight more runs with this PR under APS5_TRACE_APR=1 APS5_TRACE_FLUSH=1 all reached the main menu, so this PR (2c5b772; the head since only merges main) has reached it in 13 of 14 runs (comment). The tracing changes the timing, so those eight runs don't rule the remaining crash out.
  • Linux (lavapipe, Mesa 25.2.8, gcc 13.3, CI's Linux configure), on main 66e290f. Each check ran in all three write-watch modes: userfaultfd user-mode only (unprivileged), full userfaultfd (root), and unwatched (APS5_NO_WRITE_WATCH=1).

    • Red (only the driver's registration reverted, so libc calls nothing, as on main): 0/20 in each mode. Every run fails the same three cases:
      host write over pending storage, a store recorded before a 64 KiB host write: FAILED, byte 0x0 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
      host write over pending storage, a store recorded before a 4 KiB host write: FAILED, byte 0x3000 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
      host write over pending storage, a 4 KiB host write over pending results: FAILED, byte 0x5 outside the file read holds 0x0, not the image's 0x47, so its results there never landed
      
      The recorded store zeroes the file's bytes, which is the zeroed block of the title's trace. The case of a whole-block host write over pending results already passes on main.
    • Green: 20/20 in each mode, at both commits.
    • ctest -R '^agc' --parallel 4 --timeout 120: 625/625 at the head, 43 skipped as expected.
    • ctest -R 'guest|libc|kernel': the same as main on that machine. The 5 failures are IPv6 tests the container always fails.
  • GitHub runners (run 38952984815), with only the registration reverted for the red:

    • Linux: red, the test failed in each of 5 runs; green 20/20. The libc and libkernel suites pass both ways.
    • Windows: it builds with MinGW, but the test skips on that runner, which has no Vulkan device. guest_kqueue fails there with and without the change.
  • Merged with fix(libs): flush pending GPU results before file writes #6234 (0f5651f) and with fix(agc): cache inaccessible guest pages #6184 (4a96406), each on its own, on lavapipe. The new test passes 10/10 on both merges.

  • Windows code: MinGW -fsyntax-only of GuestMemory.cpp, Lifecycle.cpp, GuestArena.cpp and the test: 0 errors.

  • The review follow-ups (Linux, lavapipe, CI's configuration), each with its case in the new agc_driver_host_write_hook, in the same commit as its change:

    • Teardown: after Driver::Shutdown, a host write over a range with a recorded store must not reach the driver's flush hook. Red at the previous head: "a host write over a range with a recorded store reached the driver's flush hook 1 time(s) after Driver::Shutdown".
    • The lock check: a host write made while holding the GPU mutex returns and moves the count by one. Red on a base with only the counter's accessor: "the count moved by 0, not 1". With APS5_ASSERT_GPU_LOCK=1 the test aborts at the [lock] ASSERT: line, as intended.
    • The counters: a host write over a recorded store counts one call that waited; one over an idle surface counts a call that didn't.
    • agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass 20/20 in each of the three write-watch modes, and ^agc passes 626/626.
    • GitHub runners (run, with test(agc): align the indirect arguments block at run time #6452's MinGW fix for an unrelated test applied for this check only): on Linux both tests pass 10/10; on Windows they skip without a Vulkan device and the build is clean. The ^agc sweeps' only failures are agc_driver_preparation_scope_settle on Linux, a timing check under parallel load, and agc_driver_pm4_replay_tool (0xc0000139) on Windows, which fails on main there too.
  • AMD Radeon 780M (RDNA 3, AMD driver 25.10.20.01), Windows 11 (WinLibs GCC 15.2.0, Release), run by keravyn-ops at 276f67d (comment): agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass.

  • NVIDIA GeForce RTX 3080 (NVIDIA 617.42), Windows 10 Pro 22H2 (WinLibs GCC 15.2.0, Release), run by TheSovietWaffle at 276f67d (comment): agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass 5 of 5 runs each, and the 12 guest_socket_host_write_* tests, which go through the changed GuestArena host-write path, pass.

  • NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04 (GCC 15.2, Release), run by jotitadev at 276f67d merged onto main 12a71f3 (review): both new tests pass, 3/3 on the 3070. ^agc has no new failures against main: 636 of 638 on the 3070, where agc_driver_f16_fma_denormal_modes and agc_driver_fma_mix_f16_denormal_modes fail on main too, and 638 of 638 on lavapipe. With only the hook's registration in Driver::Driver removed, the same three cases fail on both devices as in the red above, and the whole-block case passes.

  • Merged with main cd700fe and 86b8424 (2c5b772, then 9f5745d, the head). Each conflicted only in the debt file, where both sides' entries are kept. On GitHub's runners at the head (run), agc_driver_host_write_pending_storage, agc_driver_host_write_hook, agc_driver_storage_file_write and agc_driver_graphics pass 3 runs in a row on Linux. On Windows three of the four skip without Vulkan and agc_driver_graphics passes. The libc and libkernel suites pass on both.

  • Merged with main 0d078f7 (46d8f39, no conflicts), on GitHub's runners (run): in one run on Linux the ^agc tests pass, 711 tests: 662 pass, 49 skip, 0 fail. The libc and libkernel suites pass on both runners. On Windows, of 711 ^agc tests 173 pass and 536 skip, since the runner has no Vulkan device; the only failures are agc_driver_pm4_replay_tool and agc_shader_replay_tool, which fail the same way on that runner for an unrelated branch (run).

  • Merged with main 5949d8b and 5d48c62 (3080b8f, then b7794a5, the head; run). main's fix(agc): store resident linear color targets at completion points, limited to their drawn rectangles #9685 excepts drawn resident linear targets from the pending storage-image results debt entry this PR rewrites, and adds two entries after it; the merge keeps main's opening, this PR's text, main's two entries, then this PR's host-write entry. main's fix(agc): let imports that cannot write guest memory keep the watch armed #10369 opens a watched import's host-write window only when the import may write guest memory; the merge keeps this PR's OwnHostWrite mark, then main's optional window. The agc_driver_host_write_ and agc_driver_linear_target_ tests, agc_driver_address_passes_draw_transitions, agc_driver_graphics, agc_driver_preparation_scope_settle, agc_driver_storage_file_write, guest_kqueue and public_headers pass 10 runs in a row. Linux: 18 run, 17 pass, 1 skip (agc_driver_linear_target_direct_write_completion), 0 fail. Windows: 18 run, 3 pass, 15 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (144 and 208) and on Windows (171 and 224). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.

  • LEGO Horizon Adventures (PPSA14632), run by winstrex (comment): Windows 11, NVIDIA GeForce RTX 5070 Ti (NVIDIA 591.86), warm shader cache, the same input script each run.

    • With this PR, the [hostwrite] line shows host writes landing on pending GPU work over their range in every run (4 to 60 per run).
    • The FAsyncLoadingThread crash with ObjectSerializationError ... Serial size mismatch after the graphics quality screen came in 2 of 2 runs on main 7ce3b1d, 1 of 6 on this PR's base 86b8424 and 0 of 7 with this PR (9f5745d). winstrex calls that not conclusive at these counts.
    • One of the 7 runs with this PR crashed later with a different corruption (UObjectHash.cpp line 42).
  • Epic Mickey: Rebrushed (PPSA15657) on newer main, johnmaia's follow-up (comment): the same setup (i3-12100, RX 7600, RADV), where a run fails on ObjectSerializationError / Serial size mismatch, LowLevelFatalError or a crash before the level.

  • Alone in the Dark (PPSA08240) on current main, LeoFeitosa's rerun (comment): main b1f023d (10-25) without this PR, the same harness (Windows 11 26200, RTX 5070 Ti, driver 617.42, APS5_PLAYGO_UNLISTED_CHUNKS=installed, the exe and .guest.prx relinked with this build's relinker).

    • 3 of 6 runs fail: one closes before the menu on LowLevelFatalError [Line: 3230] "Serial size mismatch" on a loading-screen texture, and two crash in the async loader right after the menu (0xc0000005 on FAsyncLoadingThread, and LowLevelFatalError [Line: 197] allocating 34043592704 bytes).
    • So this title still fails on current main, unlike Epic Mickey.
    • With this PR (b7794a5 merged cleanly onto the same b1f023d, the same harness and machine, the installed libSceAgcDriver.prx checked against the package), 6 of 6 runs reach the main menu with no fatal error (menu at 260, 90, 90, 90, 90 and 90 s) (comment).
  • LEGO Horizon Adventures (PPSA14632) on current main, winstrex's pair (comment): Windows 11 (26300), RTX 5070 Ti (driver 621.01). On main abed035 all 12 runs, with and without this PR, stopped 19 to 40 s in on the refusal from GTA V (PPSA04264) stops when the save loads: compute shader reads or writes a converted float image with 16-bit data #11425 (a compute shader reading or writing a converted float image with 16-bit data), so both sides had fix(shader): load and store 16-bit data of converted packed images #11580 merged, which fixes it. 240 s per run, alternating, with the saves and a warm shader cache restored before each run.

    • main abed035 + fix(shader): load and store 16-bit data of converted packed images #11580: 6 of 6 reached the load after the graphics quality screen, with no Serial size mismatch or FAsyncLoadingThread crash.
    • The same + this PR (bc288ff): 5 of 6, with no loader crash; the sixth stopped on VK_ERROR_DEVICE_LOST at 81 s, which winstrex also saw once without this PR, in a warm-up run that isn't counted.
    • Neither side hit the loader crash, so this pair doesn't reproduce in this title what this PR fixes, and it isn't conclusive either way.
  • tools/check_conventions.py: passed.

Overlap. On main 1b1f848, the overlap check finds three open PRs that conflict with this one. 37 others that touch the same files conflict with main themselves, so they couldn't be checked.

  • fix(libs): flush pending GPU results before file writes #6234 (Ondra97) adds the read direction: pending GPU results are flushed before file writes, through a host read hook next to this one.
    • Merging the two gives three conflicts: adjacent additions in GuestArena.hpp and GuestArena.cpp, and the debt entry, which both PRs rewrite. Each resolves by keeping both sides.
    • The two hooks never run for the same call. fix(libs): flush pending GPU results before file writes #6234's runs where the host reads guest memory, this one where the host writes it.
    • Both end in the same FlushGpuWrites.
  • fix(agc): cache inaccessible guest pages #6184 (MarcZX100) adds an access observer for protection changes, commits and maps.
    • It conflicts in one place, where both setters follow GuestArenaWriteWatched_nid_postfix.
    • Its observer never runs in GuestArenaBeginHostWrite, so the two compose independently.
  • fix(agc): stop and join the driver's thread pools at shutdown #6641 (ours) edits neighbouring lines of Execution/src/Driver/Lifecycle.cpp. Whichever lands second takes a one-line merge.
  • Stray (PPSA02100) on Windows, by @dantdmdarealguy (comment): Windows 11 Pro, i9-14900K, RTX 5080 (617.42), main 32b7331 and main with b7794a5 merged (clean), the same app.exe, save state and pad script, runs alternated, 125 s from launch through the New Game load, 6 runs each. On main, 4 stop at the fix(agc): save the guest bytes of results that become pending over a surface that is no longer fully write-watched #7048 refusal at about 20 s, 1 on an access violation before the menu, and the one that reached the New Game load crashed there (Serial size mismatch). With this PR, 2 are clean, 2 stop at the fix(agc): save the guest bytes of results that become pending over a surface that is no longer fully write-watched #7048 refusal and 1 on an access violation before the menu; of the 3 that reached the load, 1 crashed there (an FAsyncLoadingThread access violation). So the loader crash still occurred once with this PR. He notes that the rate drifts a lot with the state of the machine, so counts this small are only indicative.
  • ASTRONEER (PPSA27623), by @JJenkx (comment): Linux, AMD Radeon RX 6650 XT (RADV, Mesa 26.2.6), Release, APS5_PLAYGO_UNLISTED_CHUNKS=installed, 60 s from boot. The title sometimes crashes during its first load, with a UE4 "Serial size mismatch" LowLevelFatalError or a SIGSEGV in package loading. JJenkx traced it with local read diagnostics that aren't in any PR. The file reads match the pak, but the failing exports are read into memory that held one of the title's colour targets about a second earlier, and the driver's idle store then writes that target's drawn rectangle over the file data (5.6 ms after the read, in the logged crash). This PR's host-write hook stores the pending target before the read.
    • With the diagnostics on, arms interleaved in blocks of 4: main 1e24993 crashed in 5 of 12 runs, and main with this PR at 75ffc81 in 0 of 12 (one-sided Fisher p ≈ 0.019). The write-backs over the failing buffers within 300 ms of each read were 47 idle stores on main, 26 of them after the read, and with this PR 4 stores by its hook before the read, 1 idle store and none after.
    • Without the diagnostics, earlier series on main crashed in about 1 run in 5, but in this paired series both arms ran 0 of 12, so those runs say nothing either way.
    • JJenkx's fix(agc): finish an idle store's write-back before returning #16011 fixes a separate idle-store ordering race found on the way. With the diagnostics, 3 of its 12 runs still crashed.
  • bc288ff, a merge of main 263eee0 (run). thuanquang's perf(agc): create the host import of a linear color target in registered memory #9879 adds a "Linear color targets" entry to docs/dev/debt/libSceAgcDriver.md where this PR adds its "Host writes into guest memory" entry; the merge keeps both, and this PR's changed lines are the same. agc_driver_host_write_hook and agc_driver_host_write_pending_storage, with the tests for the files the merge changes, pass 10 runs in a row. Linux: 326 run, 316 pass, 10 skip (seven AGC tests on lavapipe and three video-out tests with no display or Vulkan device), 0 fail. Windows: 344 run, 256 pass, 88 skip (85 AGC tests, this PR's two among them, and the same three video-out tests, no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (145 and 212) and on Windows (174 and 233). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • d0b755a, a merge of main facac6a (run). The one conflict was the include block of GuestMemory.cpp, where main now has the <thread> include this PR added and adds <system_error> next to it; the merge keeps main's lines, and this PR's other changed lines are the same. agc_driver_host_write_pending_storage, agc_driver_host_write_hook, agc_driver_graphics, agc_driver_linear_target_direct_write_completion, agc_driver_preparation_scope_settle and agc_driver_storage_file_write ran 10 times in a row with no failure. Linux: 6 run, 5 pass, 1 skip, 0 fail. Windows: 6 run, 1 pass, 5 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (166 and 264). On Windows libc passes (194), and libkernel has 4 failures of 286. guest_raise_exception aborted with 0xc0000409 after "address waking round 37: the handler did not run within 5 s". Run again on this commit (run) it aborted the same way at round 7, and so did main 9fc181d in the same verify setup (run, round 5). That is libkernel (Windows): guest_raise_exception slowed about 3x and sometimes aborts at "address waking" since 540364a24 (#10666) #11813, which traces it to fix(libkernel): deliver a raised exception at the guest return of a thread in host code #10666 on main; this PR doesn't touch libkernel. The other three, exec_arguments, guest_timed_join_import_libkernel_sys and guest_timed_join_import_libkernel_web, fail at their setup in the verify's Windows build (FileNotFoundError starting the title, or copying the libraries they load), and pass in main's own Windows job at 1829def (job). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 11cd12b, a merge of main ba62780 (run, validation run).
    • The conflict: only docs/dev/debt/libSceAgcDriver.md. Gonic0's perf(agc): trap CPU reads of label readbacks on macOS instead of storing them #13499 (label read traps, macOS) adds a "Label read traps" entry right after the "Pending storage-image results" entry this PR rewrites, and perf(agc): trap label reads of small images inside pending large ones on macOS #13678 has since changed it. The merge keeps this PR's Pending entry, then main's Label read traps entry, each unchanged. The other files merged on their own, and this PR's diff against main is the same as before in every file.
    • perf(agc): trap CPU reads of label readbacks on macOS instead of storing them #13499's traps and this PR's store-and-wait (read at a merge with main e67cc81, result): GuestArenaBeginHostWrite calls this PR's host-write hook first, which stores a trapped image whole and releases its trap. Only then does the write watch's BeginHostWrite resolve any trap left on the range and open the pages. On Linux every trap path is under #if defined(__APPLE__), so only this PR's path is compiled there.
    • ×10 on GitHub's runners: this PR's agc_driver_host_write_pending_storage and agc_driver_host_write_hook, with agc_driver_graphics, agc_driver_linear_readback_label_off, agc_driver_linear_target_direct_write_completion, agc_driver_preparation_scope_settle, agc_driver_storage_file_write and agc_recorder_completion_labels. Linux: 8 run, 7 pass, 1 skip, 0 fail. Windows: 8 run, 1 pass, 7 skip (no Vulkan device), 0 fail. The libc and libkernel suites run 208 and 308 tests on Linux and 235 and 330 on Windows, with 0 failed. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • Validation (VERIFY_VALIDATION=1 on GitHub's Linux runner, main against this head, the same tests where main has them): both pass. The loader inserted VK_LAYER_KHRONOS_validation 9 times on main and 13 with this head, and neither log has was not found. Both report only VUID-VkDeviceCreateInfo-pNext-pNext, so the change adds none.
  • 3c3c2ca, the Pending storage-image results entry cut to the gap still open, for fogydes' review. This PR's rewrite of the entry had grown it from main's 985 characters to 1,396, over check_conventions.py's 1,000-character warning, and described the new ordering. It's now main's entry with only the late-store sentence narrowed to a title's own CPU stores, 993 characters. Docs only: check_conventions.py --base ba627802e2 passes with no warnings.
  • 59a6f5e, a merge of main 3c3b3cd (run). The one conflict was in docs/dev/debt/libSceAgcDriver.md: this PR's narrowed "Pending storage-image results" entry and its "Host writes into guest memory" entry sit beside main's new active-recorder entry and two write-watch entries, and the merge keeps all of them. This PR's diff over main is unchanged. This PR's agc_driver_host_write_pending_storage and agc_driver_host_write_hook, with agc_driver_graphics, agc_driver_linear_readback_label_off, agc_driver_linear_target_direct_write_completion, agc_driver_preparation_scope_settle, agc_driver_storage_file_write and agc_recorder_completion_labels, ran 10 times with no failure. Linux: 8 run, 7 pass, 1 skip (agc_driver_linear_target_direct_write_completion), 0 fail. Windows: 8 run, 1 pass, 7 skip (no Vulkan device), 0 fail. Suites: libc and libkernel pass on Linux (214 and 316) and on Windows (241 and 337). The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
  • 75ffc81, a merge of main b611e63 (×10, every agc test), which brings mrfelek's perf(agc): keep moved read-only draw inputs within the draw snapshot cap #15783 (moved read-only draw inputs kept within the draw snapshot cap).
    • The conflict: one, in docs/dev/debt/libSceAgcDriver.md, where perf(agc): keep moved read-only draw inputs within the draw snapshot cap #15783 extends the "Draw input snapshots" entry next to this PR's narrowed "Pending storage-image results" entry. The merge keeps both. The code merged without conflicts, GuestMemory.cpp and GuestArena.cpp included, which main changed since 3c3b3cd. This PR's diff over main is unchanged.
    • ×10: agc_driver_host_write_pending_storage and agc_driver_host_write_hook, with agc_driver_graphics, agc_driver_linear_readback_label_off, agc_driver_linear_target_direct_write_completion, agc_driver_preparation_scope_settle, agc_driver_storage_file_write and agc_recorder_completion_labels. Linux: 8 run, 7 pass, 1 skip (agc_driver_linear_target_direct_write_completion), 0 fail. Windows: 8 run, 1 pass, 7 skip (no Vulkan device), 0 fail.
    • Suites: libc passes on Linux (303) and on Windows (335), and libkernel on Windows (360). On Linux, libkernel ran 329 tests and guest_kernel_stack_protect failed once (GuestKernelStackProtect failed at line 276, the mprotect of the test's own host pages). This PR changes no libkernel code, and in the agc run the same head's libkernel suite passed all 329. The suites ran with APS5_SKIP_TIMING_TESTS=1, which relaxes precise_wait's median bounds on GitHub's hosted runners.
    • Every agc test, once: Linux: 1,334 run, 1,247 pass, 85 skip, 2 fail. Windows: 1,373 run, 411 pass, 962 skip (no Vulkan device), 0 fail. Both failures are main's:
    • AMD Radeon RX 6300 (RADV NAVI24) at this head, from TechLevelZero's AMD bot (report): merged onto main b611e63, Mesa 25.2.8, Ubuntu 26.04.1, 3,899 of 3,946 tests selected. 3,819 passed, 18 failed and 62 skipped. None of the failures is new: 13 also fail on main, and 5 are unstable on main. With VK_LAYER_KHRONOS_validation, there are no new validation IDs against main, over 1,391 tests on the GPU.
    • NVIDIA RTX 2000 Ada Generation at this head, from TechLevelZero's NVIDIA bot (report): merged onto main acac7c8, driver 595.99.02, Ubuntu 26.04.1, 3,913 of 3,960 tests selected. 3,848 passed, 6 failed and 59 skipped. None of the failures is new: 2 also fail on main, and 4 are unstable on main. With VK_LAYER_KHRONOS_validation, there are no new validation IDs against main, over 1,399 tests on the GPU.
    • @BunnyFl's re-review (review, approved; their first approval was at 59a6f5e): git range-diff from 59a6f5e shows this PR's six commits unchanged. On this head merged onto main 78e4248, Windows 11, AMD Radeon RX 9070 XT (driver 32.0.32015.12012), WinLibs GCC 15.2.0, Release, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and the validation layer: agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass, 2 of 2, the hook's GPU path ran ([hostwrite] 2 host writes, 1 waited for GPU work over their range), and there's no VUID- message.

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 under Silent stubs in their library's technical debt
  • 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
  • Fixes: none
  • Related: perf(agc): reuse address-based draw builds whose inputs are unchanged #6636, fix(libs): flush pending GPU results before file writes #6234, ASTRONEER (PPSA27623) #8746 (ASTRONEER (PPSA27623)'s discussion)
  • Unblocks: Alone in the Dark (PPSA08240), its crashes while loading to the main menu, which still happen on current main (LeoFeitosa: on main b1f023d, the main menu with no fatal error in 3 of 6 runs without this PR and 6 of 6 with it; earlier, 13 of 14 runs with this PR and 1 of 6 on main cd700fe). It has no Game bring-up discussion yet. Epic Mickey: Rebrushed (PPSA15657, Disney Epic Mickey: Rebrushed (PPSA15657) on Linux #2255) was the first title: its first-level load crash from perf(agc): reuse address-based draw builds whose inputs are unchanged #6636's thread, on main 5d9dcc4 (johnmaia: 0 of 12 runs failed with the fix, 6 of 24 without), no longer reproduces on main from 10-24 without this PR.
  • GPUs tested: lavapipe (Mesa 25.2.8) on Linux; johnmaia's RX 7600 (RADV, Mesa 25.2.8) in the title; NVIDIA GeForce RTX 5070 Ti (617.42), Windows 11, in Alone in the Dark (LeoFeitosa); AMD Radeon 780M (RDNA 3, AMD driver 25.10.20.01), Windows 11: both new tests pass (keravyn-ops); NVIDIA GeForce RTX 3080 (NVIDIA 617.42), Windows 10: both new tests pass 5 of 5 (TheSovietWaffle); NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04: both new tests pass (jotitadev); NVIDIA GeForce RTX 5070 Ti (NVIDIA 591.86), Windows 11, in LEGO Horizon Adventures (winstrex); AMD Radeon RX 9070 XT (driver 32.0.32015.12012), Windows 11: both new tests pass (BunnyFl); AMD Radeon RX 6300 (RADV NAVI24, Mesa 25.2.8) and NVIDIA RTX 2000 Ada Generation (driver 595.99.02), Ubuntu 26.04.1 (TechLevelZero's bots); AMD Radeon RX 6650 XT (RADV, Mesa 26.2.6), Linux, in ASTRONEER (JJenkx); the Windows runner has no Vulkan device
  • AI-assisted: yes

A host write into guest memory (a file, AIO or APR read, a socket receive) went straight to the pages. Storage image results pending over the range were stored later, when something read the memory, and a store already recorded or in flight landed whenever its batch ran. Either could overwrite the host's bytes: a write-back recorded before an APR read landed over the file data after it, and a host write into part of a 64 KiB block left the rest of the block without the image's results.

libc now calls a host write observer at the start of every GuestArena::HostWrite scope, on every platform. The driver registers one that does what its own guest stores do: it stores the results pending over the range and waits for every recorded or in-flight GPU write there, so the host's bytes land last, as on the console. The driver's own import window on macOS skips it.

The test reads a file into guest memory under a HostWrite scope over a storage image's results, with the image's store recorded before the read and with the results still pending, over a whole 64 KiB block and over 4 KiB inside one.
GuestArenaSetHostWriteObserver_nid_postfix becomes GuestArenaSetHostWriteHook_nid_no_patch, taking the address as std::uintptr_t, and the driver's GuestMemory::FlushBeforeHostWrite becomes PrepareHostWrite, so they read as one pair with the host read hook boykopovar#6234 adds (GuestArenaSetHostReadHook_nid_no_patch and PrepareHostRead). The setter is a helper that must not become a NID, so it takes the _nid_no_patch suffix. Behaviour is unchanged.
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8707 docs/dev/debt/libSceAgcDriver.md L212-213

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1835 core/libs/prx/libc/src/GuestArena.cpp
PR 5021 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
core/libs/prx/libc/src/GuestArena.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6209 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6481 docs/dev/debt/libSceAgcDriver.md
PR 6804 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7604 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7622 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9508 docs/dev/debt/libSceAgcDriver.md
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9893 docs/dev/debt/libSceAgcDriver.md
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9915 docs/dev/debt/libSceAgcDriver.md
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10233 docs/dev/debt/libSceAgcDriver.md
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 11435 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 11436 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
PR 11551 docs/dev/debt/libSceAgcDriver.md
PR 11587 docs/dev/debt/libSceAgcDriver.md
PR 11825 docs/dev/debt/libSceAgcDriver.md
PR 12904 docs/dev/debt/libSceAgcDriver.md
PR 13809 core/libs/prx/libc/include/GuestArena.hpp
core/libs/prx/libc/src/GuestArena.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13863 docs/dev/debt/libSceAgcDriver.md
PR 13920 docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14212 docs/dev/debt/libSceAgcDriver.md
PR 14296 docs/dev/debt/libSceAgcDriver.md
PR 14344 docs/dev/debt/libSceAgcDriver.md
PR 14561 docs/dev/debt/libSceAgcDriver.md
PR 14944 docs/dev/debt/libSceAgcDriver.md
PR 14982 docs/dev/debt/libSceAgcDriver.md
PR 15136 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 15169 docs/dev/debt/libSceAgcDriver.md
PR 15529 core/libs/prx/libSceAgcDriver/Execution/include/GuestMemory.hpp
core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
docs/dev/debt/libSceAgcDriver.md
PR 15548 docs/dev/debt/libSceAgcDriver.md
PR 15621 docs/dev/debt/libSceAgcDriver.md
PR 15807 core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp
PR 16260 docs/dev/debt/libSceAgcDriver.md

@CnRJay CnRJay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right place to fix this (the host write itself, rather than a store at every flip), and the fast path is cheap (82-98 ns against 7 ns for a 64 KiB write with nothing to wait for). Three questions on the slow path and on teardown.

  • When a host write does overlap pending results, PrepareHostWrite waits for the in-flight batches and the store. The call comes from whatever thread did the read()/recv()/APR read: file I/O threads, the network thread, and the title's own loader threads. A loader that streams into a buffer the GPU is still writing now stalls on a GPU round trip per read, which is the stall the description describes as the cost of the flip-time store, only moved. The PR measures the empty case only. Please add counters (hook calls, calls that waited, time waited) to the [rescache]-style profile line and post them for Epic Mickey's first-level load, so the cost of the slow path is seen on a real title, not only in the test.
  • GuestArenaSetHostWriteHook_nid_no_patch(&PrepareHostWrite) is registered in Driver::Driver and cleared in ~Driver. A thread inside a HostWrite scope when the driver is destroyed can call the hook after the clear started, or while Driver members it uses are gone. State that the hook is an atomic pointer and what makes PrepareHostWrite safe once the driver is stopping (it should do nothing after stop()).
  • The lock audit is in the description, but nothing enforces it. A future HostWrite call under a mutex the GPU wait needs (the GPU mutex, a libSceNet lock) deadlocks. Add a check in the hook that throws when the thread holds the GPU mutex outside the supported case, the way DrawPipeline::Drain does, so a violation is an error and not a hang.

Also: the description says the title has not run the fix yet ("Related", not "Fixes"). A log line from Epic Mickey (PPSA15657) on this branch reaching the first level is what the maintainers will ask for; it is worth getting from the reporter before this is looked at in detail.

Only the driver's destructor cleared the host write hook, so a host
write made after Driver::Shutdown still ran PrepareHostWrite and the
flush hook behind it: the queued-label branch takes the GPU mutex and
records labels against the reset device, and on Linux exit() runs the
destructor while title threads still run.

stop() now clears the hook before the workers are joined, sets a
stopped flag PrepareHostWrite checks after counting itself in flight,
and waits for the calls already inside to leave. The wait is bounded
to 1 s, as a thread ExitProcess killed inside the hook never leaves.

The test records a storage image's store over a range, shuts the
driver down, then makes a host write over the range and checks that
it no longer reaches the flush hook.
A host write waits for the GPU work over its range before its bytes
land. Every HostWrite site is a guest I/O path that holds no driver
lock, but one made with GuestMemory::GpuMutex held would take the flush
hook's nested locked wait, which hangs if that work needs another
thread's hold of the mutex to complete.

PrepareHostWrite now counts such a call (GuestMemory::LockedHostWrites)
and logs the first one with its thread tag, address and size, then
continues. Under APS5_ASSERT_GPU_LOCK=1 it aborts with a [lock]
ASSERT: line instead. The debt notes the rule.

The test makes a host write while holding the GPU mutex, checks that
it returns and that the count moved by one, and that a host write
without the mutex is not counted.
Under APS5_PROFILE_DRAW, PrepareHostWrite reads the calling thread's
GPU waits (Recorder::ThreadWaitedMs, given to GuestMemory by the driver
as it gives ShaderMemory) before and after its flush, and counts the
calls, the calls that waited, and the total and longest wait. A
[hostwrite] line reports them every 10 s with the other profile lines.

The test makes a host write over a range with a recorded store, which
counts one call that waited, and one over an idle range, which counts
a call that did not.
@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

@CnRJay Thanks. All three are in, each with its test in the same commit:

  • The slow path (276f67d): with APS5_PROFILE_DRAW=1, a [hostwrite] line every 10 s gives the host writes, those that waited for GPU work over their range, and the total and longest wait. For example, from the test: [hostwrite] 2 host writes, 1 waited for GPU work over their range: 1.34 ms in total, 1.34 ms at most. @johnmaia, when you next run Epic Mickey: Rebrushed (PPSA15657) on this branch, could you add APS5_PROFILE_DRAW=1 and post the [hostwrite] lines from the first-level load? That run would also give the log line for "Fixes".
  • Teardown (2ff4ed6): the hook is an atomic pointer. Driver::stop() now clears it first, then sets a stopped flag and waits up to 1 s for calls already inside the hook. PrepareHostWrite counts itself in flight before it checks the flag and returns immediately once it's set, so it does nothing after stop(). The wait is bounded because on Windows ExitProcess can end a thread inside the hook before ~Driver runs. The new test shuts the driver down and checks that a host write over a recorded store no longer reaches it; it reached it once at the previous head.
  • The lock check (c272007): a host write made while the thread holds the GPU mutex is counted and logged once, with its thread, address and size. Under APS5_ASSERT_GPU_LOCK=1 (the switch AssertGpuLockHeld reads) it aborts instead. I didn't make it throw in a normal run. With the mutex held, the hook takes FlushForAccess's nested locked wait, which only hangs if completing needs another thread to take the GPU mutex, so a throw would turn a possible hang into a certain crash. The debt file now states the rule.

@keravyn-ops

Copy link
Copy Markdown
Contributor

AMD / Windows run of this PR at 276f67d: Radeon 780M (RDNA 3, 0x15bf), AMD driver 25.10.20.01 (32.0.21020.1007), Windows 11 Home 10.0.26100, WinLibs GCC 15.2.0 r7, Release.

Every ctest entry built from the test targets this PR changes passes (2):

  • agc_driver_host_write_hook (0.37 s): 463: host write hook tests passed
  • agc_driver_host_write_pending_storage (0.40 s): 464: host write pending storage tests passed

AI-assisted: yes (runs made on the device above).

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

Thanks @keravyn-ops for the AMD runs here, on #6911 and on #6944; they're in each PR's Tested and GPUs-tested lines now.

@TheSovietWaffle

Copy link
Copy Markdown
Contributor

NVIDIA data point for this PR: head 276f67d36, RTX 3080 (NVIDIA 617.42), Ryzen 7 7800X3D, Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7, Release, libraries rebuilt from the head.

  • agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass 5 of 5 runs each on the RTX 3080 (device selected in the log, not skipped).
  • The 12 guest_socket_host_write_* tests, which go through the changed GuestArena host-write path, pass.

Not checked: whether the new tests fail on main without the change on this GPU, and titles (I don't have Epic Mickey: Rebrushed).

AI-assisted: yes (Claude Code).

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

Thanks @TheSovietWaffle for the RTX 3080 runs; they're in the Tested and GPUs-tested lines now.

main 4827f36 adds the shader disk cache include to the driver
lifecycle (boykopovar#6641) where this branch adds the guest arena's. Keep both.

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Linux run on NVIDIA and lavapipe, with the hook taken out to see what the new tests catch.

Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8) on the same host. PR merged onto main 12a71f3f5 (clean). ANYPS5_NO_SHADER_CACHE=1, -j1 --timeout 30.

Run RTX 3070 lavapipe
agc_driver_host_write_hook, agc_driver_host_write_pending_storage pass 3/3 pass
^agc (638 tests), PR vs main no new failures (636/638; agc_driver_f16_fma_denormal_modes and agc_driver_fma_mix_f16_denormal_modes fail on main on this GPU too) 638/638 on both

The tests don't build on main (they use HostWritesCounted), so as the negative control I removed only the GuestArenaSetHostWriteHook_nid_no_patch(&GuestMemory::PrepareHostWrite) line from Driver::Driver. Both tests fail on both devices, 3/3 on the 3070:

host write over pending storage, a store recorded before a 64 KiB host write: FAILED, byte 0x0 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
host write over pending storage, a store recorded before a 4 KiB host write: FAILED, byte 0x3000 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
host write over pending storage, a 64 KiB host write over pending results: the file's bytes survived the image's store and its texels landed around them
host write over pending storage, a 4 KiB host write over pending results: FAILED, byte 0x5 outside the file read holds 0x0, not the image's 0x47, so its results there never landed

So on Linux the file-read path reaches the driver only through this hook, and three of the four cases catch it missing. The third case, a 64 KiB host write over pending results, passes without the hook on both devices, so it does not cover the fix on this platform.

Run on 276f67d36; the current head be2be36b5 only merges main, the PR's five commits are unchanged.

Not run: Windows, AMD, Epic Mickey or any title.

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

Thanks for the Linux runs and the negative control. Your three failures are the same ones the red in Tested shows, and the whole-block case passes on main there too, as Tested says. That case isn't a red/green case: it checks that after a whole-block host write over pending results, the file's bytes survive and the image's texels land around them, which main already gets right. I've added your runs to Tested and the GPU list.

@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line needs rebase Conflicts with main, rebase needed labels Oct 18, 2026
Keeps the host-write hook setter next to boykopovar#6184's access observer setter in GuestArena.
# Conflicts:
#	docs/dev/debt/libSceAgcDriver.md
@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed needs rebase Conflicts with main, rebase needed labels Nov 2, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 59a6f5e merged onto main 1d91f29 · tested 2026-11-02 19:54 UTC · 33 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,438 passed · 6 failed (0 new, 3 also fail on main, 3 unstable on main) · 52 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 3,496 of 3,544 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (1297 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_bda_device 61.5 s, ⚠️ agc_driver_graphics_maps_fallback 30.2 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
agc_driver_submit_progress: failed in 7 of the last 10 main runs
agc_submit_progress: failed in 8 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validated but not compared (2, not in the main baseline's validation pass)
agc_driver_host_write_hook
agc_driver_host_write_pending_storage
Validation IDs already present on main (4 IDs in 746 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (746 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 738 more
VUID-vkCmdCopyImage-srcImage-01548 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-vkCmdCopyImage-srcImage-01551 (13 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 5 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (52)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan suppor
Reproduce
git fetch origin 59a6f5e41e82a2a7049715f0844da5ffb24a45f4 1d91f2966d0eef82a021628a7aa8e78e615ac807
git checkout 1d91f2966d0eef82a021628a7aa8e78e615ac807 && git merge --no-ff 59a6f5e41e82a2a7049715f0844da5ffb24a45f4
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@BunnyFl BunnyFl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the Windows/AMD run this PR didn't have yet. Windows 11, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT, with this head merged onto current main: agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass, nothing skipped. The hook's path ran on the GPU, not just the fast path: the log shows [hostwrite] 2 host writes, 1 waited for GPU work over their range: 0.08 ms in total, 0.08 ms at most and host write waits: the write over the recorded store waited, the one over the idle range did not. With main's GuestMemory, Lifecycle.cpp and GuestArena sources the tests don't build (HostWritesCounted is new), so a runtime negative control isn't possible here. jotitadev's run without the hook covers that.

CnRJay's slow-path and teardown questions are answered in 276f67d (the [hostwrite] accounting) and 2ff4ed6 (clearing the hook and waiting for calls in flight at stop), and the paired Alone in the Dark runs on current main (3 of 6 without, 6 of 6 with) back the Unblocks line.

@XairRrR XairRrR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — approved

The host-write hook (libc → GuestMemory::PrepareHostWrite → FlushGpuWrites) builds and both new tests pass on lavapipe with no new VUIDs. Removing the hook's registration or the teardown in stop() makes the tests fail exactly as the description says. I found nothing blocking.

What I ran

  • PR head 59a6f5e41e82a2a7049715f0844da5ffb24a45f4
  • main 4f41f4c375f5abb487dbd184fbc150f31994d762
  • Merged tree d1a8dc054612ad49da165b21bf50e32b6d0a6f79
  • Machine: Debian 13 VM (32 vCPU, Xeon Gold 6136), GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19)
git diff --check 4f41f4c375f5abb487dbd184fbc150f31994d762...59a6f5e41e82a2a7049715f0844da5ffb24a45f4
python3 tools/check_conventions.py --base 4f41f4c375f5abb487dbd184fbc150f31994d762
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer ctest --test-dir build -V -R '^agc_driver_host_write_(hook|pending_storage)$'
env VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build -V -R '^agc_driver_native_depth_uniform_planes$'   # merged tree, then main's production files
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R '^agc_driver_(host_write_(hook|pending_storage)|storage_file_write|graphics|linear_target_direct_write_completion|preparation_scope_settle)$'
# negative controls (see below), each followed by
ninja -C build -j32 -l32 agc_driver_host_write_hook_tests agc_driver_host_write_pending_storage_tests
ctest --test-dir build --output-on-failure -R '^agc_driver_host_write_(hook|pending_storage)$'

Results

Check Result
git diff --check clean
check_conventions.py passed
Configure, build, libs (script) ok
Selected tests (script, 3702 run) no new failures, no timeouts; the 9 known failures also fail on main
check_skips.py guest_net_ctl skipped, which also happens on main (not this PR)
agc_driver_host_write_hook with the validation layer passed in 0.46 s, layer inserted, no VUID-
agc_driver_host_write_pending_storage with the validation layer passed in 0.47 s, all 4 cases, write watch "userfaultfd, user mode only", no VUID-
Script's validation comparison one test flagged: agc_driver_native_depth_uniform_planes, VUID-vkCmdDispatch-groupCountX-00386, "test not run on main". The test was added to main after the baseline d1ae628bc2. With main's production files restored it reports the same VUID 4 times, as on the merged tree, so it comes from main.
Related tests: storage_file_write, graphics, preparation_scope_settle, linear_target_direct_write_completion 5 passed, 1 skipped (linear_target_direct_write_completion, as in the description's runs)
New tests, merged tree
[hostwrite] 2 host writes, 1 waited for GPU work over their range: 5.85 ms in total, 5.85 ms at most
[lock] a host write of 0x10000 bytes at 0x7faba6c80000 was made under GuestMemory::GpuMutex on thread tagged 0xffffffff; it waits for GPU work with the mutex held (counted, logged once)
host write waits: the write over the recorded store waited, the one over the idle range did not
host write under the GPU mutex: it returned and was counted once
host write after shutdown: the host write did not reach the stopped driver
host write hook tests passed
host write over pending storage, a store recorded before a 64 KiB host write: the file's bytes survived the image's store and its texels landed around them
host write over pending storage, a store recorded before a 4 KiB host write: the file's bytes survived the image's store and its texels landed around them
host write over pending storage, a 64 KiB host write over pending results: the file's bytes survived the image's store and its texels landed around them
host write over pending storage, a 4 KiB host write over pending results: the file's bytes survived the image's store and its texels landed around them
host write pending storage tests passed

Negative control

Both new tests call new API (HostWritesCounted, GuestArenaSetHostWriteHook_nid_no_patch), so they can't build against main's production files. I ran two narrower controls instead.

  1. Only the GuestArenaSetHostWriteHook_nid_no_patch(&GuestMemory::PrepareHostWrite) line removed from Driver::Driver: both tests fail.

    • agc_driver_host_write_hook: "a host write over a recorded store counted 0 call(s), 0 that waited".
    • agc_driver_host_write_pending_storage: the same three cases fail as in the description and jotitadev's review. The whole-block case over pending results passes, as already noted there.
    Output
    host write over pending storage, a store recorded before a 64 KiB host write: FAILED, byte 0x0 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
    host write over pending storage, a store recorded before a 4 KiB host write: FAILED, byte 0x3000 of the file read was overwritten by the image's store after it (0x0, the file has 0x40)
    host write over pending storage, a 64 KiB host write over pending results: the file's bytes survived the image's store and its texels landed around them
    host write over pending storage, a 4 KiB host write over pending results: FAILED, byte 0x5 outside the file read holds 0x0, not the image's 0x47, so its results there never landed
    
  2. Only the two teardown lines in Driver::stop() removed (the hook clear and StopHostWrites(1000)): agc_driver_host_write_hook fails with "a host write over a range with a recorded store reached the driver's flush hook 1 time(s) after Driver::Shutdown".

After the controls I restored the merged files and rebuilt. git status --porcelain is empty, and the tests above pass again.

Findings

Blocking

None.

Non-blocking

  • Duplicate include (core/libs/prx/libSceAgcDriver/Execution/src/Driver/Lifecycle.cpp:16): the PR adds #include "prx/libc/include/GuestArena.hpp", but main already includes it two lines below (line 18). The duplicate is left over from the merge with #6641's ShaderDiskCache.hpp include. It does no harm, but the PR's line can be dropped.
  • The "Unblocks" line has no Game bring-up discussion: CONTRIBUTING asks for the title ID and its Game bring-up discussion. The line gives PPSA15657 and PPSA08240, but no discussion numbers. Separately, the description itself says the Epic Mickey crash no longer reproduces on current main. Only the Alone in the Dark pair on main b1f023d (3 of 6 without, 6 of 6 with) is current evidence, so the Unblocks claim rests on that title.
  • hostWritesStopped is never reset (core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp, StopHostWrites): this is correct today, since Driver::Get() is a function-local static and stop() is final. If the driver ever restarts after Shutdown, though, the hook would be registered again but return at once. Worth keeping in mind if restart support is added.

Not verified

  • Hardware GPUs (only lavapipe here), Windows and macOS (the OwnHostWrite import window is __APPLE__-only), and any title. The title results are the reporters' runs, quoted in the description and discussion.
  • Only the default write-watch mode on this machine (userfaultfd, user mode only). I did not run the root or APS5_NO_WRITE_WATCH=1 modes.
  • The --cost timing claim (75–90 ns on the fast path).
  • agc_driver_graphics took 36 s here, under parallel load. This PR doesn't change that test, and I didn't compare its time with main.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 59a6f5e merged onto main 4f41f4c · tested 2026-11-03 10:39 UTC · 31 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,684 passed · 19 failed (0 new, 13 also fail on main, 6 unstable on main) · 60 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 3,763 of 3,811 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (1331 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.8 s, ⚠️ agc_driver_graphics 120.2 s, ⚠️ agc_driver_graphics_maps_fallback 120.1 s, ⚠️ agc_driver_lazy_resolved_abi_switch_set 65.3 s, ⚠️ agc_driver_bda_device 54.4 s
Unstable on main (6, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_array_layer_target_cpu: failed in 1 of the last 9 main runs
agc_driver_graphics: failed in 1 of the last 9 main runs
agc_driver_graphics_maps_fallback: failed in 1 of the last 9 main runs
agc_driver_pipeline_journal: failed in 7 of the last 9 main runs
agc_driver_store_over_untracked: failed in 1 of the last 9 main runs
agc_driver_two_sample_alpha_to_coverage_sample_mask_export: failed in 1 of the last 9 main runs
Failing on main too (13, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_recorder: Timeout in the parallel run; also passed only on retry in 5 other runs in the last 7 days
Validated but not compared (2, not in the main baseline's validation pass)
agc_driver_host_write_hook
agc_driver_host_write_pending_storage
Validation IDs already present on main (4 IDs in 764 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (764 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_alpha_to_coverage_sample_mask_export, and 756 more
VUID-vkCmdCopyImage-srcImage-01548 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 4 more
VUID-vkCmdCopyImage-srcImage-01551 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_storage_dispatch, and 4 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (60)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support i
Reproduce
git fetch origin 59a6f5e41e82a2a7049715f0844da5ffb24a45f4 4f41f4c375f5abb487dbd184fbc150f31994d762
git checkout 4f41f4c375f5abb487dbd184fbc150f31994d762 && git merge --no-ff 59a6f5e41e82a2a7049715f0844da5ffb24a45f4
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 4, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 75ffc81 merged onto main b611e63 · tested 2026-11-04 23:26 UTC · 31 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,819 passed · 18 failed (0 new, 13 also fail on main, 5 unstable on main) · 62 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 3,899 of 3,946 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (1391 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 121.4 s, ⚠️ agc_driver_graphics_maps_fallback 120.2 s, ⚠️ agc_driver_graphics 120.1 s, ⚠️ agc_driver_bda_device 62.5 s, ⚠️ agc_driver_image_sample_unnormalized 50.0 s
Unstable on main (5, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_array_layer_target_cpu: failed in 3 of the last 10 main runs
agc_driver_graphics: failed in 3 of the last 10 main runs
agc_driver_graphics_maps_fallback: failed in 2 of the last 10 main runs
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
agc_driver_two_sample_alpha_to_coverage_sample_mask_export: failed in 4 of the last 10 main runs
Failing on main too (13, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
agc_driver_image_gather_volume
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_emulated_color_compare_srgb_decode: Timeout in the parallel run; also passed only on retry in 28 other runs in the last 7 days
Validated but not compared (2, not in the main baseline's validation pass)
agc_driver_host_write_hook
agc_driver_host_write_pending_storage
Validation IDs already present on main (4 IDs in 807 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (807 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_draw_space_reuse_held, agc_driver_address_draw_space_reuse_off, agc_driver_address_draw_space_reuse_transitions, agc_driver_address_draw_space_reuse_verify, agc_driver_address_passes, and 799 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (62)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergp
Reproduce
git fetch origin 75ffc81473672b8134b415e1d6744f9a9f36098a b611e634f7fc024f0c13e342d96de744448ef1d9
git checkout b611e634f7fc024f0c13e342d96de744448ef1d9 && git merge --no-ff 75ffc81473672b8134b415e1d6744f9a9f36098a
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 5, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 75ffc81 merged onto main acac7c8 · tested 2026-11-05 02:56 UTC · 27 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,848 passed · 6 failed (0 new, 2 also fail on main, 4 unstable on main) · 59 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 3,913 of 3,960 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (1399 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_bda_device 41.7 s, ⚠️ agc_driver_graphics_maps_fallback 31.0 s, ⚠️ agc_driver_graphics 30.5 s
Unstable on main (4, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
agc_driver_submit_progress: failed in 2 of the last 10 main runs
agc_submit_progress: failed in 3 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 2 of the last 10 main runs
Failing on main too (2, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
Validated but not compared (2, not in the main baseline's validation pass)
agc_driver_host_write_hook
agc_driver_host_write_pending_storage
Validation IDs already present on main (9 IDs in 808 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (808 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_draw_space_reuse_held, agc_driver_address_draw_space_reuse_off, agc_driver_address_draw_space_reuse_transitions, agc_driver_address_draw_space_reuse_verify, agc_driver_address_passes, and 800 more
VUID-vkCmdCopyImage-srcImage-01548 (15 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, and 7 more
VUID-vkCmdCopyImage-srcImage-01551 (15 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, and 7 more
VUID-VkShaderModuleCreateInfo-pCode-08737 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08739 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08741 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkPipelineShaderStageCreateInfo-module-parameter (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849 (1 test): agc_driver_float16_unused_nan_payloads
Skipped (59)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_height_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_limit: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_malformed: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_width_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current 
Reproduce
git fetch origin 75ffc81473672b8134b415e1d6744f9a9f36098a acac7c854182a1674162f5e623aa25a6469985ae
git checkout acac7c854182a1674162f5e623aa25a6469985ae && git merge --no-ff 75ffc81473672b8134b415e1d6744f9a9f36098a
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@BunnyFl BunnyFl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EagleBearerYS re-checked at 75ffc81473. The only new commits are merges of main. git range-diff from 59a6f5e41e, the head I approved, shows all six of your commits unchanged.

On 75ffc81473 merged onto main 78e4248fea (Windows 11, WinLibs GCC 15.2.0, Release, AMD Radeon RX 9070 XT, driver 32.0.32015.12012), ctest -V with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: agc_driver_host_write_hook and agc_driver_host_write_pending_storage pass, 2 of 2, and the hook's GPU path ran again ([hostwrite] 2 host writes, 1 waited for GPU work over their range). No missing-layer line and no VUID- message. As in my first review, a runtime negative control can't be built here: the tests use HostWritesCounted, which main doesn't have.

check_conventions.py passes. pr_overlap.py --branch finds no shared exports; #8707 shares lines in docs/dev/debt/libSceAgcDriver.md, and 60 PRs that conflict with main couldn't be compared.

Approving again at 75ffc81473.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 6, 2026
@adriadam10
adriadam10 merged commit a2624e4 into boykopovar:main Nov 8, 2026
26 of 27 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked at 75ffc81: the commits since the last review are merges of main only (range-diff of the six commits unchanged, as @BunnyFl found), the earlier red guest_avplayer was a flake in a test this diff doesn't touch, and the current checks are green. The hook, its teardown and the debt entry hold; both new tests pin the file's bytes and the image's texels, and the three red cases are confirmed by jotitadev's negative control. Confirmed by @BunnyFl and @XairRrR (approved), the AMD and NVIDIA bot runs (no new failures or VUIDs) and @LeoFeitosa's Alone in the Dark pair. Minor: GuestArena.hpp is still included twice in Lifecycle.cpp. Merged.

@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 8, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@adriadam10 @EagleBearerYS a report from a bisect on PPSA15304 (Linux, NVIDIA). Not a revert request: I know this fixed a real loss for PPSA15657.

Since this merge PPSA15304 dies in about half of its boots: one or two presents, then SIGSEGV (SEGV_MAPERR, a null pointer fault) in the title's own code on a title thread, 80 to 140 s in, while the main thread is in sceKernelUsleep.

170 s runs, same machine:

build bad runs
66db234 (first parent of this merge) 0 of 16
a2624e4 (this merge) 5 of 10
main f86ca3f 5 of 8
main f86ca3f without the line GuestArenaSetHostWriteHook_nid_no_patch(&GuestMemory::PrepareHostWrite); in Lifecycle.cpp 0 of 8

The two older builds carry the Ajm fix from #16974 in the working tree, which the title needs to get this far.

So the host write hook is needed for the crash. What inside it goes wrong I have not shown. My guess is that the wait in FlushGpuWrites, or the write-back of pending storage, races a title thread that uses the same range. I can log the host writes of a bad run (range, calling thread, what was written back) if that helps to narrow it.

@EagleBearerYS

Copy link
Copy Markdown
Contributor Author

@oneandonlydean thanks for the bisect. The A/B with only the hook registration removed narrows it a lot.

Reading the hook on main (74900e8; f86ca3f has the same code), I don't think the wait or the pending-storage write-back is the problem. The unit shadows leave a window, though:

So a title thread that reads those bytes later, such as a file read buffer, can get the GPU's older data. I can't tell from the code alone whether that is what METAL GEAR SOLID Δ: SNAKE EATER (PPSA15304) hits. A null-pointer fault on a title thread would fit it, though.

Mouhand-Kaddo's #17787 (with JJenkx) addresses that race:

  • A host write publishes every unit over its range before writing.
  • A host write that meets a publish in progress waits for its copies.

These titles had a crash bisected to #6926 that #17787 or APS5_NO_UNIT_SHADOW=1 stopped:

moong15 posted a matching bisect on #17787 today for Stellar Blade (PPSA13197), on Windows with an RX 9070 XT (comment):

Could you run PPSA15304 on f86ca3f with APS5_NO_UNIT_SHADOW=1, or on #17787's head (0c2c1a8), and see whether the 5 of 8 moves?

If neither clears it, your host-write log would help. These would tell the two ideas apart:

  • for each host write: its range, its thread, and whether its flush stored or published anything;
  • every publish that overlaps a host-written range before that range is written again, with its reason. APS5_TRACE_SHADOW=<n> prints the first n publishes with their range and reason.

If the faulting pointer was read from a 64 KiB unit that a publish copied over after the host write, it's this race. If no publish touches those bytes, the wait or the write-back ordering is the next place to look.

moong15 added a commit to moong15/AnyPS5 that referenced this pull request Nov 14, 2026
…dow fix lands

Fork only. Since boykopovar#6926 the hook flushes pending GPU results over every host
write; Stellar Blade's loader then reads clobbered package summaries and
crashes in about 85% of launches (0 of 8 with the hook off, 2026-11-14).
Drop this commit once boykopovar#17787 or another fix is on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs libc unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.