fix(agc): compare host imports when device writes reach the write watch #3226

Merged
oneandonlydean merged 1 commit from upstream-pr/3226 into main 2026-10-11 05:03:00 +00:00
oneandonlydean commented 2026-10-11 02:07:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T02:07:37Z.


What

agc_unit_shadow, registered by #2864, fails in the Linux job on main:

host imports stay watched
AGC graphics: the partial publish did not copy exactly the partly covered unit

This is #1429. The failing check was already there; it never ran in CI before #2864 registered it. The cause is the one @popcoder565 and @Dextroid17 traced there. lavapipe runs command buffers on CPU threads, so its writes into a host import go through the page tables, and the write watch collects them as CPU stores. The import probe only checks a GPU read (0 of 4 pages on lavapipe), so imports stay watched. The whole publish's copy into the import is then collected as a CPU store over unit 3. The next partial publish finds the unit written since its retile and drops it without a copy.

This carries the probe change from #1046 (@aryanrawatispro-ship-it, closed with conflicts), rebased onto current main. The probe also fills the scratch range on the GPU and collects again. When the read or the fill reports pages as written, imported ranges are compared. The dma-buf probe shares runImportProbe, so its decision takes the fill into account too.

On lavapipe the startup line now reads:

[write-watch] host imports resolve write protection: yes (0 of 4 scratch pages written after a GPU read, 4 after a GPU write, 0 after the import); imported ranges are compared

There, agc_unit_shadow reports host imports are compared, not watched: unit shadows not tested, as it already does on devices that compare imports. On the RTX 4090 the fill reports 0 pages, imports stay watched and the shadow checks run.

The rest of #1046 (registering the whole agc_driver_recorder_tests binary and the test changes that came with it) is not included.

Tested

Linux (CachyOS, GCC 16, Release, CI's configure flags) on main 77bd928a:

  • lavapipe from Ubuntu 24.04's mesa-vulkan-drivers 25.2.8, the package the Linux job installs:
    • agc_unit_shadow fails 5/5 on main and passes with this change;
    • full ctest: 754/755. The one failure is agc_driver_image_packed16_load, fixed since by #3208. With both changes, 755/755.
  • RTX 4090 (610.57.04):
    • agc_unit_shadow passes 10/10 on main and with this change;
    • full ctest: 754/755. agc_driver_dcc_keys_first_write fails the same way on main (#3179).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (Claude Code)

Fixes #1429.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4815939129 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3226). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T02:07:37Z. --- ### What `agc_unit_shadow`, registered by #2864, fails in the Linux job on `main`: ``` host imports stay watched AGC graphics: the partial publish did not copy exactly the partly covered unit ``` This is #1429. The failing check was already there; it never ran in CI before #2864 registered it. The cause is the one @popcoder565 and @Dextroid17 traced there. lavapipe runs command buffers on CPU threads, so its writes into a host import go through the page tables, and the write watch collects them as CPU stores. The import probe only checks a GPU read (0 of 4 pages on lavapipe), so imports stay watched. The whole publish's copy into the import is then collected as a CPU store over unit 3. The next partial publish finds the unit written since its retile and drops it without a copy. This carries the probe change from #1046 (@aryanrawatispro-ship-it, closed with conflicts), rebased onto current `main`. The probe also fills the scratch range on the GPU and collects again. When the read or the fill reports pages as written, imported ranges are compared. The dma-buf probe shares `runImportProbe`, so its decision takes the fill into account too. On lavapipe the startup line now reads: ``` [write-watch] host imports resolve write protection: yes (0 of 4 scratch pages written after a GPU read, 4 after a GPU write, 0 after the import); imported ranges are compared ``` There, `agc_unit_shadow` reports `host imports are compared, not watched: unit shadows not tested`, as it already does on devices that compare imports. On the RTX 4090 the fill reports 0 pages, imports stay watched and the shadow checks run. The rest of #1046 (registering the whole `agc_driver_recorder_tests` binary and the test changes that came with it) is not included. ### Tested Linux (CachyOS, GCC 16, Release, CI's configure flags) on `main` 77bd928a: - lavapipe from Ubuntu 24.04's `mesa-vulkan-drivers` 25.2.8, the package the Linux job installs: - `agc_unit_shadow` fails 5/5 on `main` and passes with this change; - full `ctest`: 754/755. The one failure is `agc_driver_image_packed16_load`, fixed since by #3208. With both changes, 755/755. - RTX 4090 (610.57.04): - `agc_unit_shadow` passes 10/10 on `main` and with this change; - full `ctest`: 754/755. `agc_driver_dcc_keys_first_write` fails the same way on `main` (#3179). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (Claude Code) Fixes #1429.
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!3226
No description provided.