Skip to content

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

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up4/fix-unit-shadow
Oct 11, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
oneandonlydean:up4/fix-unit-shadow

Conversation

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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 77bd928:

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.

The import probe only checked whether a GPU read of an imported range
reports its pages as written. lavapipe runs command buffers on CPU
threads, so its writes into an import go through the page tables and
are collected as CPU stores. In agc_unit_shadow the whole publish's
copy into the import is then collected as a CPU store over unit 3, and
the next partial publish drops the slab's newer bytes as stale: "the
partial publish did not copy exactly the partly covered unit".

The probe now also fills the scratch range on the GPU and collects
again. When the read or the fill reports pages as written, host and
dma-buf imports are compared. lavapipe reports 0 of 4 pages after the
read and 4 of 4 after the fill; NVIDIA reports 0 after the fill.

The probe change is the first commit of boykopovar#1046.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agc_driver_recorder_tests: partial publish drops a shadowed unit without copying it

1 participant