agc_driver_recorder_tests: partial publish drops a shadowed unit without copying it #1429

Closed
opened 2026-10-08 05:06:12 +00:00 by NahuelGenchi · 3 comments
NahuelGenchi commented 2026-10-08 05:06:12 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-08T05:06:12Z.


agc_driver_recorder_tests is built but not registered in ctest, and on main (0c952fe5) it fails on lavapipe at the partial publish check in core/libs/prx/libSceAgcDriver/tests/Recorder.cpp (around line 1387). The test is not affected by GPU hardware, so this doesn't depend on any particular card.

The test sets up three units, unit3, unit4 and unit5, and checks that these are shadowed before the publish:

Require(AnyShadowedOverlaps(unit3, unit) && AnyShadowedOverlaps(unit4, unit))   passes
PublishShadow(unit3 + 100, 2*unit - 100, PartialUnits, Fill)                     returns 0, expected 1

Adding a print right before the check shows the publish returns 0 and afterwards unit3 is no longer reported as shadowed, while unit4 still is. So the shadow flag for unit3 gets cleared without anything being copied.

publishUnits in UnitShadow.cpp skips a selected unit that is no longer live, and its comments say a unit whose pages the CPU stored to is dropped without a copy. The test's last section covers that exact case. Whether anything in the test's own setup stores to unit3's guest pages between the retile and the publish is the question I couldn't settle: if it does, the test expectation is stale; if nothing does, the publish is dropping a unit it shouldn't.

Could someone who knows the shadow stamping rules say which of those applies? Once that's clear the fix is either a test change or a code change, and I can send a PR for whichever it is.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5756232205 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1429). Originally posted by [NahuelGenchi](https://github.com/NahuelGenchi) on 2026-10-08T05:06:12Z. --- `agc_driver_recorder_tests` is built but not registered in ctest, and on main (`0c952fe5`) it fails on lavapipe at the partial publish check in `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` (around line 1387). The test is not affected by GPU hardware, so this doesn't depend on any particular card. The test sets up three units, `unit3`, `unit4` and `unit5`, and checks that these are shadowed before the publish: ``` Require(AnyShadowedOverlaps(unit3, unit) && AnyShadowedOverlaps(unit4, unit)) passes PublishShadow(unit3 + 100, 2*unit - 100, PartialUnits, Fill) returns 0, expected 1 ``` Adding a print right before the check shows the publish returns 0 and afterwards `unit3` is no longer reported as shadowed, while `unit4` still is. So the shadow flag for `unit3` gets cleared without anything being copied. `publishUnits` in `UnitShadow.cpp` skips a selected unit that is no longer live, and its comments say a unit whose pages the CPU stored to is dropped without a copy. The test's last section covers that exact case. Whether anything in the test's own setup stores to `unit3`'s guest pages between the retile and the publish is the question I couldn't settle: if it does, the test expectation is stale; if nothing does, the publish is dropping a unit it shouldn't. Could someone who knows the shadow stamping rules say which of those applies? Once that's clear the fix is either a test change or a code change, and I can send a PR for whichever it is.
popcoder565 commented 2026-10-08 06:23:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-08T06:23:27Z.


#1046 answers this one: nothing in the test stores to unit3's pages. lavapipe runs command buffers on CPU threads, so the whole publish's copy into the host import goes through the page tables, and the write watch collects it as a CPU store over unit3. The partial publish then finds the unit written since its retile and drops it without a copy. Per #1046's description, the import probe only checks a GPU read, which reports 0 of 4 pages on lavapipe, so imports stay watched there. #1046 makes the probe also fill the scratch import on the GPU, compares imported ranges when either step reports pages, and registers agc_driver_recorder in ctest.

For comparison, on Windows 10 with an RTX 3060 (driver 616.92) the test passes 10 of 10 runs on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6053773441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1429#issuecomment-6053773441). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-08T06:23:27Z. --- #1046 answers this one: nothing in the test stores to `unit3`'s pages. lavapipe runs command buffers on CPU threads, so the whole publish's copy into the host import goes through the page tables, and the write watch collects it as a CPU store over `unit3`. The partial publish then finds the unit written since its retile and drops it without a copy. Per #1046's description, the import probe only checks a GPU read, which reports 0 of 4 pages on lavapipe, so imports stay watched there. #1046 makes the probe also fill the scratch import on the GPU, compares imported ranges when either step reports pages, and registers `agc_driver_recorder` in ctest. For comparison, on Windows 10 with an RTX 3060 (driver 616.92) the test passes 10 of 10 runs on current `main`.
Dextroid17 commented 2026-10-08 11:24:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-08T11:24:21Z.


Reproduced on main (084aeeb6), under lavapipe with the CI environment (VK_ICD_FILENAMES → lavapipe, ANYPS5_REQUIRE_VULKAN=1, GALLIUM_OVERRIDE_CPU_CAPS=avx):

[write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 0 after the import); imported ranges stay watched
AGC graphics: the partial publish did not copy exactly the partly covered unit
EXIT=1

That is the failure and the assertion the report names, and the startup line is the mechanism @popcoder565 describes: the probe reports 0 of 4 pages after a GPU read, so imports stay watched, and on this device the publish's copy into the import is collected as a CPU store over the unit, which the partial publish then drops as written since the retile. So nothing in the test's setup stores to unit3's pages — the expectation is right and the probe is what needs the fix, not the test's fixture.

The fix is #1046, which is still open and CONFLICTING. I resolved its four conflicts onto 084aeeb6 (main has since added its own CPU-store probe to the same two functions, which is why all four are real) and ran the result:

  • lavapipe, three runs (CI's --repeat until-fail:3): 3/3 pass, exit 0, with the predicted line —
    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
    
  • real GPU (RTX 3080 Ti): the added term reads 0, so the watch decision is unchanged — the log differs from main's only in the added diagnostic.

Details of the four resolutions and the evidence are on #1046. It also fixes the other half of this report — agc_driver_recorder_tests being built but not registered — by adding it to the foreach that turns EXCLUDE_FROM_ALL off and registers it; tools/check_test_registration.py records it by name today, so the gap is at least measured until then.

One thing that should not be attached to #1046: on this GPU the same binary already fails on main at a different assertion (Recorder.cpp:2130, (w) a cache over the pages the import reported sees no change), identically with and without that PR — filed as #1532. Registering the test makes CI green on lavapipe and leaves that one red on NVIDIA, which is worth knowing before the merge.

So: this issue is answered and its fix is #1046. Would you like it closed in favour of that PR, or left open as the marker for the unregistered test?

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058793277 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1429#issuecomment-6058793277). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-08T11:24:21Z. --- Reproduced on `main` (`084aeeb6`), under lavapipe with the CI environment (`VK_ICD_FILENAMES` → lavapipe, `ANYPS5_REQUIRE_VULKAN=1`, `GALLIUM_OVERRIDE_CPU_CAPS=avx`): ``` [write-watch] host imports resolve write protection: no (0 of 4 scratch pages written after a GPU read, 0 after the import); imported ranges stay watched AGC graphics: the partial publish did not copy exactly the partly covered unit EXIT=1 ``` That is the failure and the assertion the report names, and the startup line is the mechanism @popcoder565 describes: the probe reports 0 of 4 pages after a GPU read, so imports stay watched, and on this device the publish's copy into the import is collected as a CPU store over the unit, which the partial publish then drops as written since the retile. So **nothing in the test's setup stores to `unit3`'s pages** — the expectation is right and the probe is what needs the fix, not the test's fixture. **The fix is #1046**, which is still open and `CONFLICTING`. I resolved its four conflicts onto `084aeeb6` (main has since added its own CPU-store probe to the same two functions, which is why all four are real) and ran the result: - lavapipe, three runs (CI's `--repeat until-fail:3`): **3/3 pass**, exit 0, with the predicted line — ``` 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 ``` - real GPU (RTX 3080 Ti): the added term reads 0, so the watch decision is unchanged — the log differs from `main`'s only in the added diagnostic. Details of the four resolutions and the evidence are on #1046. It also fixes the other half of this report — `agc_driver_recorder_tests` being built but not registered — by adding it to the `foreach` that turns `EXCLUDE_FROM_ALL` off and registers it; `tools/check_test_registration.py` records it by name today, so the gap is at least measured until then. One thing that should not be attached to #1046: on this GPU the same binary already fails on `main` at a *different* assertion (`Recorder.cpp:2130`, `(w) a cache over the pages the import reported sees no change`), identically with and without that PR — filed as **#1532**. Registering the test makes CI green on lavapipe and leaves that one red on NVIDIA, which is worth knowing before the merge. So: this issue is answered and its fix is #1046. Would you like it closed in favour of that PR, or left open as the marker for the unregistered test? Written with AI assistance.
klosixgaming-arch commented 2026-10-08 11:50:32 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-08T11:50:32Z.


Based on my review of recent PRs, I can provide some context on this issue. The test agc_driver_recorder_tests is currently built but not registered in ctest (it uses EXCLUDE_FROM_ALL). This means it's one of the tests that tools/check_test_registration.py records by name as built-but-not-run.

The question raised in the issue - whether the test expectation is stale or the publish is dropping a unit incorrectly - would require someone familiar with the shadow stamping rules to answer definitively. However, based on similar issues I've seen reviewed:

  1. If the test's own setup stores to unit3's guest pages between retile and publish, then the test expectation should be updated
  2. If nothing stores to those pages, then there may be a bug in the publish logic

Given that this test has been failing on lavapipe for some time without being registered in ctest, it's possible the test expectations have become stale as the shadow stamping implementation evolved. I'd recommend investigating whether any of the recent changes to UnitShadow.cpp or related files might have changed the behavior that this test expects.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6059225994 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/1429#issuecomment-6059225994). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-08T11:50:32Z. --- Based on my review of recent PRs, I can provide some context on this issue. The test `agc_driver_recorder_tests` is currently built but not registered in ctest (it uses `EXCLUDE_FROM_ALL`). This means it's one of the tests that `tools/check_test_registration.py` records by name as built-but-not-run. The question raised in the issue - whether the test expectation is stale or the publish is dropping a unit incorrectly - would require someone familiar with the shadow stamping rules to answer definitively. However, based on similar issues I've seen reviewed: 1. If the test's own setup stores to `unit3`'s guest pages between retile and publish, then the test expectation should be updated 2. If nothing stores to those pages, then there may be a bug in the publish logic Given that this test has been failing on lavapipe for some time without being registered in ctest, it's possible the test expectations have become stale as the shadow stamping implementation evolved. I'd recommend investigating whether any of the recent changes to `UnitShadow.cpp` or related files might have changed the behavior that this test expects.
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#1429
No description provided.