feat(agc): track guest memory writes on Linux with async userfaultfd write protection #121

Merged
oneandonlydean merged 2 commits from upstream-pr/121 into main 2026-09-30 15:10:49 +00:00
oneandonlydean commented 2026-09-29 00:24:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T00:24:57Z.


What

GuestMemory::CollectWrites is built on the Windows arena's MEM_WRITE_WATCH and answers 0 on Linux, so every cached copy of guest memory (textures, resident render targets, buffers, DCC key proofs) reads as changed at every check: resident targets are stored and re-uploaded at every refresh and unit shadows stay off.

libc gains GuestWriteWatch, the Linux counterpart of GetWriteWatch:

  • every guest mapping libkernel makes (MapAligned: fixed, hinted, aligned) is registered with one userfaultfd in asynchronous write-protect mode (UFFD_FEATURE_WP_ASYNC: the kernel lifts a page's protection on its first write without a handler thread, for user and kernel-mode writes); Unmap forgets the range;
  • direct memory is now mapped from shared backings (#153) over its reservation, and a fixed remap replaces the mapping with MAP_FIXED, which drops the old registration. Both register the new mapping afresh (AddMapping, RemapFixedIntoRegistered);
  • the watch is per mapping: a write through one mapping of shared physical pages is not seen at another. Physical pages mapped at more than one address therefore leave the watch in every mapping of them, and those ranges compare bytes as unwatched memory does;
  • PAGEMAP_SCAN with PM_SCAN_WP_MATCHING reports the pages written since the last scan of a range and re-protects them in one call.
  • A registered mapping reads as written until a collect covers it. The watch tracks this itself rather than trusting the kernel's view of pages never faulted in: 6.17 reports a range without page tables as not written and leaves it unprotected, while 7.2 reports it as written. The first collect of a fresh range reports it and write-protects it with UFFDIO_WRITEPROTECT, which puts markers on unpopulated pages (UFFD_FEATURE_WP_UNPOPULATED). From then on only real writes report.

Fallback: the userfaultfd is opened with UFFD_USER_MODE_ONLY where vm.unprivileged_userfaultfd=0 requires it, and a startup probe checks the whole mechanism on scratch pages: a populated page and an unpopulated page written after protection report exactly, and untouched pages don't. Without it (kernel < 6.7, no userfaultfd permission, build headers without PAGEMAP_SCAN, or APS5_NO_WRITE_WATCH=1) the watch reports unavailable and the tracker stays unwatched exactly as on main: CollectWrites answers 0 and callers compare bytes; unit shadows stay off. A range with a page outside the registered mappings also answers 0, and a protection or scan that fails reports its remaining pages as written and answers 0.

In the driver the tracker keeps its contract and generations. On Linux its block stamps live in 4 GiB leaves over the user address space made on first stamp; the collect memo now runs on both platforms. GuestMemory::WriteWatched/Watched replace the arena queries in UnitShadowEnabled/ShadowDestinationFor, so unit shadows run on Linux over watched memory. The Windows path is unchanged apart from going through the same stamp helpers; GuestWriteWatch reports unavailable there.

Host imports

@Pacuka found that on an RX 6650 XT (RADV, kernel 7.2.2) the presented image went black with host imports on: every present saw CPU writes all over the resident display image, and StorageTexture::Refresh merged stale guest bytes over the GPU results. His diagnosis is right: amdgpu validates the userptr BO behind a VK_EXT_external_memory_host import with a writable HMM fault on every submission after the pages were protected again, which lifts the async write protection, so PAGEMAP_SCAN reports those pages as written although no CPU store happened. NVIDIA pins the pages once at the import, so there the watch stays exact, and most tracked memory is imported; taking every import off the watch would lose most of the gain on NVIDIA.

So a probe decides per device, at device setup before the first real import:

  • it maps scratch pages through the watch, collects them clean, host-imports them and collects again, then submits a GPU copy that only reads the import, waits for it and collects a third time;
  • pages written after the submission mean the driver resolves write protection on imports. Every import from then on takes its range off the watch (GuestMemory::Unwatch) before it is made, so Watched is false for it, CollectWrites answers 0 and callers compare bytes (as in @Pacuka's fix). GPU writes into watched memory keep their MarkWritten stamps;
  • the result is logged once: [write-watch] host imports resolve write protection: yes/no (N of M scratch pages written after a GPU read, K after the import);
  • a probe that cannot run (a failed import or submission) takes the safe side and unwatches imports;
  • APS5_WRITE_WATCH_IMPORTS=watch|unwatch overrides the probe (default probe, anything else throws). APS5_NO_WRITE_WATCH=1 still turns the whole watch off.
  • the probe is Linux only: on Windows the arena watch is unchanged and imports stay watched.

An unwatched import stays off the watch for the rest of its mapping: a remap registers the range afresh, the import kept over it takes it off again at the next reconcile, and a re-import after an unmap follows the decision. Unwatch also invalidates the collect memo, so a collect memoized before the import answers 0.

The import itself also lifts the protection once where imports stay watched: on the RTX 4090 the pinning at vkAllocateMemory reports every imported page as written (4 of 4 in the probe) with no CPU store, which would read as a CPU write over any GPU results pending there and drop them. So every import of a watched range is made inside an import window (GuestMemory::ImportWatched, under the tracker lock):

  • the range is collected right before the import, so earlier CPU writes are stamped as usual, and again right after it;
  • what the window reports is stamped "maybe written". Readers without pending results see it as a change (UnchangedSince fails), so caches re-upload or compare. Decisions about pending GPU results treat it as untracked: ChangedBlocks now tells BlockMaybeWritten from BlockWritten, and the drop rule, the write-back's keep blocks, the alias checks, the unit shadow's stale drop and the whole-image stale checks (through the new WrittenSince) store the results instead of dropping them;
  • a real CPU store racing an import also races the pending GPU writes to that memory, which has no defined order on hardware either, so the GPU results winning is acceptable;
  • from the second collect on, the range is protected again and watched normally. A range the watch doesn't cover whole, or a failed collect of the window, is taken off the watch instead.

One more case needed care: a storage image may hold a generation taken while its memory was still watched, and then the memory is imported and leaves the watch. ChangedBlocks reports every block of an unwatched range as changed, and the drop rule read that as "the CPU wrote this unit" and dropped the pending GPU results (the same black-image outcome, by another route). ChangedBlocks now says whether the range is watched, and the drop rule, the write-back's keep blocks and the alias borrow treat an unwatched range as untracked: results are stored, never dropped, as with a generation of 0.

Tested

  • Linux (CachyOS kernel 7.2, vm.unprivileged_userfaultfd=0, so the user-mode-only path is used; RTX 4090).
  • guest_memory (ctest) checks the watch through libkernel mappings: CPU store, read, kernel write through read(), another thread, memcpy across pages, mprotect cycle, partial munmap, fixed remap. It also checks a fresh 2 MiB-aligned mapping with no page tables, and direct memory: a direct mapping is watched, an alias takes the shared pages off the watch in both mappings while the unshared pages stay watched, and a fixed direct remap over flexible memory is watched afresh. A failing check names its line and the pages reported.
  • CI (ubuntu-24.04, kernel 6.17.0-azure): the watch is active and guest_memory passes. I confirmed it runs rather than being skipped with a throwaway run that failed if the watch was unavailable. An earlier revision failed here on the fresh-mapping check.
  • agc_driver_recorder_tests: the UnchangedSince, key proof, close race and unit shadow tests now run on Linux against watched memory, and the storage refresh test gains a watched variant (results kept on the GPU reach a CPU reader; a plain CPU store into one unit with newer results pending is found by the watch alone). On main these skip on Linux.
  • Fallback: with APS5_NO_WRITE_WATCH=1 ctest and the recorder tests pass with the watched tests reported as not run.
  • Import probe on this machine (RTX 4090, NVIDIA driver): host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import), so imports stay watched. The AMD path can't run here; @Pacuka, could you re-test on your RX 6650 XT with host imports on? The log line should say yes, and the image should be back.
  • agc_driver_recorder_tests runs the real probe and checks the decision with the result injected. Unwatch: an import leaves the watch, a memoized collect, a partly imported range and the unimported neighbour answer as they should, MarkWritten stamps only watched memory, a remap and a re-import after an unmap follow the decision. Watch: the import stays watched and stamped. A further test checks that results pending when their memory leaves the watch are stored, not dropped; it fails without the ChangedBlocks change. Another imports the memory of a storage image with results pending in watch mode: the results survive and reach guest memory, a cache generation taken before the import sees a change, the window reads as maybe written rather than as a CPU store, and a CPU store after it reads as one again. It fails without the import window.
  • The recorder tests pass with the probe (default), with APS5_WRITE_WATCH_IMPORTS=unwatch (the AMD path forced; unit shadows and the watched storage refresh report themselves as not run), with APS5_WRITE_WATCH_IMPORTS=watch and with APS5_NO_WRITE_WATCH=1; agc_driver_flip_tests passes too.
  • agc_driver_graphics_tests passes with #113 merged in.
  • Windows not built locally (no MinGW here); the Windows code only moved behind the same helpers.
  • Exercised in PPSA21564 on our integration branch before the rebase onto #153: intro from ~3 fps to ~21 fps on Linux. Not re-run since the rebase.
  • ctest: 64/64 pass on current main (65/65 with #113 merged); also with APS5_NO_WRITE_WATCH=1. agc_driver_recorder_tests passes with the probe and with APS5_WRITE_WATCH_IMPORTS=watch, =unwatch and APS5_NO_WRITE_WATCH=1.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: #120 (stacked on it; its commit is the first one here)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4670911202 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/121). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-29T00:24:57Z. --- ### What `GuestMemory::CollectWrites` is built on the Windows arena's `MEM_WRITE_WATCH` and answers 0 on Linux, so every cached copy of guest memory (textures, resident render targets, buffers, DCC key proofs) reads as changed at every check: resident targets are stored and re-uploaded at every refresh and unit shadows stay off. libc gains `GuestWriteWatch`, the Linux counterpart of `GetWriteWatch`: - every guest mapping libkernel makes (`MapAligned`: fixed, hinted, aligned) is registered with one userfaultfd in asynchronous write-protect mode (`UFFD_FEATURE_WP_ASYNC`: the kernel lifts a page's protection on its first write without a handler thread, for user and kernel-mode writes); `Unmap` forgets the range; - direct memory is now mapped from shared backings (#153) over its reservation, and a fixed remap replaces the mapping with `MAP_FIXED`, which drops the old registration. Both register the new mapping afresh (`AddMapping`, `RemapFixedIntoRegistered`); - the watch is per mapping: a write through one mapping of shared physical pages is not seen at another. Physical pages mapped at more than one address therefore leave the watch in every mapping of them, and those ranges compare bytes as unwatched memory does; - `PAGEMAP_SCAN` with `PM_SCAN_WP_MATCHING` reports the pages written since the last scan of a range and re-protects them in one call. - A registered mapping reads as written until a collect covers it. The watch tracks this itself rather than trusting the kernel's view of pages never faulted in: 6.17 reports a range without page tables as not written and leaves it unprotected, while 7.2 reports it as written. The first collect of a fresh range reports it and write-protects it with `UFFDIO_WRITEPROTECT`, which puts markers on unpopulated pages (`UFFD_FEATURE_WP_UNPOPULATED`). From then on only real writes report. Fallback: the userfaultfd is opened with `UFFD_USER_MODE_ONLY` where `vm.unprivileged_userfaultfd=0` requires it, and a startup probe checks the whole mechanism on scratch pages: a populated page and an unpopulated page written after protection report exactly, and untouched pages don't. Without it (kernel < 6.7, no userfaultfd permission, build headers without `PAGEMAP_SCAN`, or `APS5_NO_WRITE_WATCH=1`) the watch reports unavailable and the tracker stays unwatched exactly as on main: `CollectWrites` answers 0 and callers compare bytes; unit shadows stay off. A range with a page outside the registered mappings also answers 0, and a protection or scan that fails reports its remaining pages as written and answers 0. In the driver the tracker keeps its contract and generations. On Linux its block stamps live in 4 GiB leaves over the user address space made on first stamp; the collect memo now runs on both platforms. `GuestMemory::WriteWatched`/`Watched` replace the arena queries in `UnitShadowEnabled`/`ShadowDestinationFor`, so unit shadows run on Linux over watched memory. The Windows path is unchanged apart from going through the same stamp helpers; `GuestWriteWatch` reports unavailable there. ### Host imports @Pacuka found that on an RX 6650 XT (RADV, kernel 7.2.2) the presented image went black with host imports on: every present saw CPU writes all over the resident display image, and `StorageTexture::Refresh` merged stale guest bytes over the GPU results. His diagnosis is right: amdgpu validates the userptr BO behind a `VK_EXT_external_memory_host` import with a writable HMM fault on every submission after the pages were protected again, which lifts the async write protection, so `PAGEMAP_SCAN` reports those pages as written although no CPU store happened. NVIDIA pins the pages once at the import, so there the watch stays exact, and most tracked memory is imported; taking every import off the watch would lose most of the gain on NVIDIA. So a probe decides per device, at device setup before the first real import: - it maps scratch pages through the watch, collects them clean, host-imports them and collects again, then submits a GPU copy that only reads the import, waits for it and collects a third time; - pages written after the submission mean the driver resolves write protection on imports. Every import from then on takes its range off the watch (`GuestMemory::Unwatch`) before it is made, so `Watched` is false for it, `CollectWrites` answers 0 and callers compare bytes (as in @Pacuka's fix). GPU writes into watched memory keep their `MarkWritten` stamps; - the result is logged once: `[write-watch] host imports resolve write protection: yes/no (N of M scratch pages written after a GPU read, K after the import)`; - a probe that cannot run (a failed import or submission) takes the safe side and unwatches imports; - `APS5_WRITE_WATCH_IMPORTS=watch|unwatch` overrides the probe (default `probe`, anything else throws). `APS5_NO_WRITE_WATCH=1` still turns the whole watch off. - the probe is Linux only: on Windows the arena watch is unchanged and imports stay watched. An unwatched import stays off the watch for the rest of its mapping: a remap registers the range afresh, the import kept over it takes it off again at the next reconcile, and a re-import after an unmap follows the decision. `Unwatch` also invalidates the collect memo, so a collect memoized before the import answers 0. The import itself also lifts the protection once where imports stay watched: on the RTX 4090 the pinning at `vkAllocateMemory` reports every imported page as written (4 of 4 in the probe) with no CPU store, which would read as a CPU write over any GPU results pending there and drop them. So every import of a watched range is made inside an import window (`GuestMemory::ImportWatched`, under the tracker lock): - the range is collected right before the import, so earlier CPU writes are stamped as usual, and again right after it; - what the window reports is stamped "maybe written". Readers without pending results see it as a change (`UnchangedSince` fails), so caches re-upload or compare. Decisions about pending GPU results treat it as untracked: `ChangedBlocks` now tells `BlockMaybeWritten` from `BlockWritten`, and the drop rule, the write-back's keep blocks, the alias checks, the unit shadow's stale drop and the whole-image stale checks (through the new `WrittenSince`) store the results instead of dropping them; - a real CPU store racing an import also races the pending GPU writes to that memory, which has no defined order on hardware either, so the GPU results winning is acceptable; - from the second collect on, the range is protected again and watched normally. A range the watch doesn't cover whole, or a failed collect of the window, is taken off the watch instead. One more case needed care: a storage image may hold a generation taken while its memory was still watched, and then the memory is imported and leaves the watch. `ChangedBlocks` reports every block of an unwatched range as changed, and the drop rule read that as "the CPU wrote this unit" and dropped the pending GPU results (the same black-image outcome, by another route). `ChangedBlocks` now says whether the range is watched, and the drop rule, the write-back's keep blocks and the alias borrow treat an unwatched range as untracked: results are stored, never dropped, as with a generation of 0. ### Tested - Linux (CachyOS kernel 7.2, `vm.unprivileged_userfaultfd=0`, so the user-mode-only path is used; RTX 4090). - `guest_memory` (ctest) checks the watch through libkernel mappings: CPU store, read, kernel write through `read()`, another thread, memcpy across pages, mprotect cycle, partial munmap, fixed remap. It also checks a fresh 2 MiB-aligned mapping with no page tables, and direct memory: a direct mapping is watched, an alias takes the shared pages off the watch in both mappings while the unshared pages stay watched, and a fixed direct remap over flexible memory is watched afresh. A failing check names its line and the pages reported. - CI (ubuntu-24.04, kernel 6.17.0-azure): the watch is active and `guest_memory` passes. I confirmed it runs rather than being skipped with a throwaway run that failed if the watch was unavailable. An earlier revision failed here on the fresh-mapping check. - `agc_driver_recorder_tests`: the UnchangedSince, key proof, close race and unit shadow tests now run on Linux against watched memory, and the storage refresh test gains a watched variant (results kept on the GPU reach a CPU reader; a plain CPU store into one unit with newer results pending is found by the watch alone). On main these skip on Linux. - Fallback: with `APS5_NO_WRITE_WATCH=1` ctest and the recorder tests pass with the watched tests reported as not run. - Import probe on this machine (RTX 4090, NVIDIA driver): `host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 4 after the import)`, so imports stay watched. The AMD path can't run here; @Pacuka, could you re-test on your RX 6650 XT with host imports on? The log line should say `yes`, and the image should be back. - `agc_driver_recorder_tests` runs the real probe and checks the decision with the result injected. Unwatch: an import leaves the watch, a memoized collect, a partly imported range and the unimported neighbour answer as they should, `MarkWritten` stamps only watched memory, a remap and a re-import after an unmap follow the decision. Watch: the import stays watched and stamped. A further test checks that results pending when their memory leaves the watch are stored, not dropped; it fails without the `ChangedBlocks` change. Another imports the memory of a storage image with results pending in watch mode: the results survive and reach guest memory, a cache generation taken before the import sees a change, the window reads as maybe written rather than as a CPU store, and a CPU store after it reads as one again. It fails without the import window. - The recorder tests pass with the probe (default), with `APS5_WRITE_WATCH_IMPORTS=unwatch` (the AMD path forced; unit shadows and the watched storage refresh report themselves as not run), with `APS5_WRITE_WATCH_IMPORTS=watch` and with `APS5_NO_WRITE_WATCH=1`; `agc_driver_flip_tests` passes too. - `agc_driver_graphics_tests` passes with #113 merged in. - Windows not built locally (no MinGW here); the Windows code only moved behind the same helpers. - Exercised in PPSA21564 on our integration branch before the rebase onto #153: intro from ~3 fps to ~21 fps on Linux. Not re-run since the rebase. - `ctest`: 64/64 pass on current main (65/65 with #113 merged); also with `APS5_NO_WRITE_WATCH=1`. `agc_driver_recorder_tests` passes with the probe and with `APS5_WRITE_WATCH_IMPORTS=watch`, `=unwatch` and `APS5_NO_WRITE_WATCH=1`. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #120 (stacked on it; its commit is the first one here) - [x] AI-assisted: yes
Pacuka commented 2026-09-29 19:48:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-09-29T19:48:32Z.


Tested #121 locally (Linux 7.2.2, RX 6650 XT / RADV) together with host imports (VK_EXT_external_memory_host, i.e. without APS5_NO_HOST_IMPORT): the presented image became completely black. Every present reported the resident display image as "refreshed first", i.e. GuestMemory::UnchangedSince saw CPU writes all over the display buffer and StorageTexture::Refresh merged stale guest bytes over the GPU results.

Cause as far as I can tell: the amdgpu userptr BO behind a host import is validated with a writable HMM fault per submission, which resolves the async userfaultfd write protection of those pages, so PAGEMAP_SCAN reports them as written although no CPU store happened.

What fixed the black image here: unregistering a range from the write watch (GuestWriteWatchUnregister_nid_postfix) once it is successfully host-imported, so imported ranges fall back to comparison; GPU writes to them are already stamped by MarkWritten in WriteBack. Without host imports the tracking works as intended.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5897476696 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/121#issuecomment-5897476696). Originally posted by [Pacuka](https://github.com/Pacuka) on 2026-09-29T19:48:32Z. --- Tested #121 locally (Linux 7.2.2, RX 6650 XT / RADV) together with host imports (`VK_EXT_external_memory_host`, i.e. without `APS5_NO_HOST_IMPORT`): the presented image became completely black. Every present reported the resident display image as "refreshed first", i.e. `GuestMemory::UnchangedSince` saw CPU writes all over the display buffer and `StorageTexture::Refresh` merged stale guest bytes over the GPU results. Cause as far as I can tell: the amdgpu userptr BO behind a host import is validated with a writable HMM fault per submission, which resolves the async userfaultfd write protection of those pages, so `PAGEMAP_SCAN` reports them as written although no CPU store happened. What fixed the black image here: unregistering a range from the write watch (`GuestWriteWatchUnregister_nid_postfix`) once it is successfully host-imported, so imported ranges fall back to comparison; GPU writes to them are already stamped by `MarkWritten` in `WriteBack`. Without host imports the tracking works as intended.
oneandonlydean commented 2026-09-29 19:52:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T19:52:50Z.


Thanks for testing on AMD, and for tracking it down. Your diagnosis is right: a false "written" from the import's HMM validation makes the refresh merge stale guest bytes over GPU results. Unregistering imported ranges fixes it, but on NVIDIA (where the import pins pages once and the watch stays accurate) most of the tracked memory is imported, so doing it unconditionally would lose most of the benefit there. I'll add a startup probe: import a scratch page, submit work that uses it, and scan it. If the driver's validation resolves the write protection, imported ranges are unregistered and fall back to comparison, as in your fix; otherwise they stay watched. Could you re-test on the RX 6650 XT once it's pushed?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5897540667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/121#issuecomment-5897540667). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-29T19:52:50Z. --- Thanks for testing on AMD, and for tracking it down. Your diagnosis is right: a false "written" from the import's HMM validation makes the refresh merge stale guest bytes over GPU results. Unregistering imported ranges fixes it, but on NVIDIA (where the import pins pages once and the watch stays accurate) most of the tracked memory is imported, so doing it unconditionally would lose most of the benefit there. I'll add a startup probe: import a scratch page, submit work that uses it, and scan it. If the driver's validation resolves the write protection, imported ranges are unregistered and fall back to comparison, as in your fix; otherwise they stay watched. Could you re-test on the RX 6650 XT once it's pushed?
oneandonlydean commented 2026-09-29 20:24:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-09-29T20:24:22Z.


@Pacuka pushed. At startup the driver now imports a few scratch pages, runs a GPU copy from them and scans them. If the scan reports them written after the submission (what you saw on amdgpu), imported ranges are taken off the watch and compared instead; otherwise they stay watched. It logs one line, [write-watch] host imports resolve write protection: yes/no (...). On my RTX 4090 it says "no", so on your RX 6650 XT it should say "yes".

Two related fixes came out of this:

  • Results pending when their memory leaves the watch are now kept rather than dropped, which was a second way to get the black image.
  • On NVIDIA the import itself reports its pages as written once. That window now counts as "maybe written": caches still re-upload, but pending GPU results are kept.

APS5_WRITE_WATCH_IMPORTS=probe|watch|unwatch overrides the decision (default probe). Rebased on current main. Could you re-test with host imports on?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5898116180 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/121#issuecomment-5898116180). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-09-29T20:24:22Z. --- @Pacuka pushed. At startup the driver now imports a few scratch pages, runs a GPU copy from them and scans them. If the scan reports them written after the submission (what you saw on amdgpu), imported ranges are taken off the watch and compared instead; otherwise they stay watched. It logs one line, `[write-watch] host imports resolve write protection: yes/no (...)`. On my RTX 4090 it says "no", so on your RX 6650 XT it should say "yes". Two related fixes came out of this: - Results pending when their memory leaves the watch are now kept rather than dropped, which was a second way to get the black image. - On NVIDIA the import itself reports its pages as written once. That window now counts as "maybe written": caches still re-upload, but pending GPU results are kept. `APS5_WRITE_WATCH_IMPORTS=probe|watch|unwatch` overrides the decision (default `probe`). Rebased on current main. Could you re-test with host imports on?
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!121
No description provided.