AGC: agc_idle_publish_wait fails on RADV since #9521: the idle flush's CPU-side publish drops both units as changed #11889

Closed
opened 2026-10-27 11:50:57 +00:00 by Lander0606 · 0 comments
Lander0606 commented 2026-10-27 11:50:57 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Lander0606 on 2026-10-27T11:50:57Z.


What happens

agc_idle_publish_wait fails on RADV since #9521 merged, with AGC graphics: the idle publish's bytes are wrong; it passes on lavapipe.

Title, test or build step

agc_idle_publish_wait (ctest)

AnyPS5 commit

main 801d5b9bc1 (and 8df2c3ed0e). First bad: c831db72df (merge of #9521). Last good: 22a8590492, its first parent.

System

Fedora 44, kernel 7.2.11, AMD Ryzen AI 7 350 with Radeon 860M (RADV KRACKAN1), Mesa 26.2.5. Built in an Ubuntu 24.04 container with GCC 13.3, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON; tests run on the host.

Steps to reproduce

ctest --test-dir build -R '^agc_idle_publish_wait$' -V

The test sets APS5_PIN_WAIT_MS=3000 and APS5_WRITE_WATCH_IMPORTS=watch itself. It fails after 0.03 s.

Log

[write-watch] host imports stay watched (APS5_WRITE_WATCH_IMPORTS=watch)
[libc] unhandled exception 'St13runtime_error' thrown from 0x...
host imports stay watched
AGC graphics: the idle publish's bytes are wrong

What was checked

build RADV (Radeon 860M) lavapipe
main 801d5b9bc1 fails 3/3 passes 3/3
main 8df2c3ed0e fails 5/5 passes 3/3
c831db72df (merge of #9521) fails 3/3 passes 3/3
22a8590492 (its first parent) passes 3/3 passes 3/3
main 48c160c58b (2026-10-26) passes 5/5

#11696 lists the same failure on main f5e3dc5e3b on an RX 9070 XT (RADV, Mesa 26.2.5), with the same message, so it isn't specific to this GPU. With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.341) it still fails, and no VUID- line is logged. In the full ^agc run on 8df2c3ed0e, the only other failure is agc_driver_tessellation, the Mesa 26.2.5 crash. #9521's own agc_storage_idle_writeback_race passes here.

Where the bytes go. I added two fprintf diagnostics on c831db72df (attached as diagnostic.patch, and removed afterwards): one in the completion of recordCopiesOnCpu (UnitShadow.cpp), one around FlushAllPending("idle") in idlePublishWaitTests. With APS5_TRACE_SHADOW=1:

RADV:

[diag] before idle flush: generation 4
[shadow] publish hook: 0x7efda8b90000+0x20000, 2 units, 0.12 MiB, 1 slabs (packet 0xfffffffe queue 0xffffffff)
[diag] on-cpu publish completion 0x7efda8b90000+0x10000 checked=4 now=6 unchanged=0 first-byte=0x22
[diag] on-cpu publish completion 0x7efda8ba0000+0x10000 checked=4 now=7 unchanged=0 first-byte=0x33
[diag] idle flush returned: generation 7, unit 2 byte 1 = 0x11, unit 3 byte 0 = 0x11

lavapipe:

[diag] on-cpu publish completion 0x7f2e4c430000+0x10000 checked=4 now=6 unchanged=1 first-byte=0x22
[diag] on-cpu publish completion 0x7f2e4c440000+0x10000 checked=4 now=10 unchanged=1 first-byte=0x33
[diag] idle flush returned: generation 13, unit 2 byte 1 = 0x22, unit 3 byte 0 = 0x33
  • On both drivers the idle flush publishes the two retiled units through the new on-CPU path. The completion runs before FlushAllPending("idle") returns, so before the test's own CPU stores, and the host buffer holds the right bytes (0x22, 0x33).
  • On RADV, GuestMemory::UnchangedSinceCollected returns false for both units, so the completion drops them as stale (UnitShadow.cpp:272 on main). Units 2 and 3 still hold 0x11 when the flush returns. On lavapipe it returns true and the bytes land.
  • A likely cause, not confirmed: on this device the write watch sees host-imported pages as written after GPU work. The startup probe here logs [write-watch] host imports resolve write protection: yes (4 of 4 scratch pages written after a GPU read, 4 after a GPU write, 4 after the import); imported ranges are compared. The test forces APS5_WRITE_WATCH_IMPORTS=watch, so the import stays watched, and those page writes then look like guest stores made after the publish collected the units. I did not check which access marks the pages.
  • Without the forced mode: with APS5_WRITE_WATCH_IMPORTS unset, this device compares its host imports, and the test logs host import of the idle publish test block refused or not watched: idle publish wait not tested. I have not checked whether a title is affected.
  • CI uses lavapipe, where the check passes, so it can't catch this.

cc @Raghav314 (#9521), @fisherjoey (#7984)

Logs (main, the merge and its parent, on both drivers), the patch and its output, with an index in README.txt:

anyps5-agc-idle-publish-wait-radv-logs.zip

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6058614147 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/11889). Originally posted by [Lander0606](https://github.com/Lander0606) on 2026-10-27T11:50:57Z. --- ### What happens `agc_idle_publish_wait` fails on RADV since #9521 merged, with `AGC graphics: the idle publish's bytes are wrong`; it passes on lavapipe. ### Title, test or build step `agc_idle_publish_wait` (ctest) ### AnyPS5 commit `main` `801d5b9bc1` (and `8df2c3ed0e`). First bad: `c831db72df` (merge of #9521). Last good: `22a8590492`, its first parent. ### System Fedora 44, kernel 7.2.11, AMD Ryzen AI 7 350 with Radeon 860M (RADV KRACKAN1), Mesa 26.2.5. Built in an Ubuntu 24.04 container with GCC 13.3, Release, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`; tests run on the host. ### Steps to reproduce ``` ctest --test-dir build -R '^agc_idle_publish_wait$' -V ``` The test sets `APS5_PIN_WAIT_MS=3000` and `APS5_WRITE_WATCH_IMPORTS=watch` itself. It fails after 0.03 s. ### Log ```text [write-watch] host imports stay watched (APS5_WRITE_WATCH_IMPORTS=watch) [libc] unhandled exception 'St13runtime_error' thrown from 0x... host imports stay watched AGC graphics: the idle publish's bytes are wrong ``` ### What was checked | build | RADV (Radeon 860M) | lavapipe | |---|---|---| | `main` `801d5b9bc1` | fails 3/3 | passes 3/3 | | `main` `8df2c3ed0e` | fails 5/5 | passes 3/3 | | `c831db72df` (merge of #9521) | fails 3/3 | passes 3/3 | | `22a8590492` (its first parent) | passes 3/3 | passes 3/3 | | `main` `48c160c58b` (2026-10-26) | passes 5/5 | | #11696 lists the same failure on `main` `f5e3dc5e3b` on an RX 9070 XT (RADV, Mesa 26.2.5), with the same message, so it isn't specific to this GPU. With `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (1.4.341) it still fails, and no `VUID-` line is logged. In the full `^agc` run on `8df2c3ed0e`, the only other failure is `agc_driver_tessellation`, the Mesa 26.2.5 crash. #9521's own `agc_storage_idle_writeback_race` passes here. **Where the bytes go.** I added two `fprintf` diagnostics on `c831db72df` (attached as `diagnostic.patch`, and removed afterwards): one in the completion of `recordCopiesOnCpu` (`UnitShadow.cpp`), one around `FlushAllPending("idle")` in `idlePublishWaitTests`. With `APS5_TRACE_SHADOW=1`: RADV: ``` [diag] before idle flush: generation 4 [shadow] publish hook: 0x7efda8b90000+0x20000, 2 units, 0.12 MiB, 1 slabs (packet 0xfffffffe queue 0xffffffff) [diag] on-cpu publish completion 0x7efda8b90000+0x10000 checked=4 now=6 unchanged=0 first-byte=0x22 [diag] on-cpu publish completion 0x7efda8ba0000+0x10000 checked=4 now=7 unchanged=0 first-byte=0x33 [diag] idle flush returned: generation 7, unit 2 byte 1 = 0x11, unit 3 byte 0 = 0x11 ``` lavapipe: ``` [diag] on-cpu publish completion 0x7f2e4c430000+0x10000 checked=4 now=6 unchanged=1 first-byte=0x22 [diag] on-cpu publish completion 0x7f2e4c440000+0x10000 checked=4 now=10 unchanged=1 first-byte=0x33 [diag] idle flush returned: generation 13, unit 2 byte 1 = 0x22, unit 3 byte 0 = 0x33 ``` - On both drivers the idle flush publishes the two retiled units through the new on-CPU path. The completion runs before `FlushAllPending("idle")` returns, so before the test's own CPU stores, and the host buffer holds the right bytes (`0x22`, `0x33`). - On RADV, `GuestMemory::UnchangedSinceCollected` returns false for both units, so the completion drops them as stale (`UnitShadow.cpp:272` on `main`). Units 2 and 3 still hold `0x11` when the flush returns. On lavapipe it returns true and the bytes land. - **A likely cause, not confirmed:** on this device the write watch sees host-imported pages as written after GPU work. The startup probe here logs `[write-watch] host imports resolve write protection: yes (4 of 4 scratch pages written after a GPU read, 4 after a GPU write, 4 after the import); imported ranges are compared`. The test forces `APS5_WRITE_WATCH_IMPORTS=watch`, so the import stays watched, and those page writes then look like guest stores made after the publish collected the units. I did not check which access marks the pages. - **Without the forced mode:** with `APS5_WRITE_WATCH_IMPORTS` unset, this device compares its host imports, and the test logs `host import of the idle publish test block refused or not watched: idle publish wait not tested`. I have not checked whether a title is affected. - CI uses lavapipe, where the check passes, so it can't catch this. cc @Raghav314 (#9521), @fisherjoey (#7984) Logs (`main`, the merge and its parent, on both drivers), the patch and its output, with an index in `README.txt`: [anyps5-agc-idle-publish-wait-radv-logs.zip](https://github.com/user-attachments/files/34015804/anyps5-agc-idle-publish-wait-radv-logs.zip) AI-assisted: yes
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#11889
No description provided.