fix(agc): keep the saved guest bytes of units a fill or image copy does not cover #5707

Merged
oneandonlydean merged 1 commit from upstream-pr/5707 into main 2026-10-14 10:14:39 +00:00
oneandonlydean commented 2026-10-14 07:35:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T07:35:08Z.


What

Follow-up to #5657 and #5671, for the throw still reported in #361 on Disney Epic Mickey: Rebrushed (PPSA15657) by @johnmaia:

AGC graphics: storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented

The trace on #5657 shows every stored image at generation 0: their memory was already outside the write watch when the results were written, so this is not a range leaving the watch (what #5657 and #5671 handle). On such memory, a fill (FillClear) or image copy (CopyFrom) into a range another image overlaps cleared that image's saved guest bytes for every unit. The flush before it only stores the units the fill or copy overlaps, so units elsewhere in that image still had results pending and no saved bytes, and their next store threw.

StorageTexture::forgetSavedOver drops the saved bytes only of the units over the filled or copied range. The others are compared with them at their store as before.

Tested

Linux (CachyOS, GCC 16.2.1, RTX 4090), Release, BUILD_TESTING=ON, on main:

  • agc_driver_store_over_untracked: new case, an image copy into another block of a surface with results pending outside it. It fails on main with the message above and passes with the change.
  • ctest -R agc_driver: 386 of 386 pass (one existing skip).
  • tools/check_conventions.py passes.

Not run on Windows or with the title.

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 under Silent stubs in their library's technical debt file
  • 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 (independent of #5671; both merge cleanly together)
  • Unblocks: PPSA15657 #361 (the path the #5657 trace points to)
  • GPUs tested: NVIDIA RTX 4090, Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4854540858 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5707). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T07:35:08Z. --- ### What Follow-up to #5657 and #5671, for the throw still reported in #361 on Disney Epic Mickey: Rebrushed (PPSA15657) by @johnmaia: ``` AGC graphics: storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented ``` The trace on #5657 shows every stored image at generation 0: their memory was already outside the write watch when the results were written, so this is not a range leaving the watch (what #5657 and #5671 handle). On such memory, a fill (`FillClear`) or image copy (`CopyFrom`) into a range another image overlaps cleared that image's saved guest bytes for every unit. The flush before it only stores the units the fill or copy overlaps, so units elsewhere in that image still had results pending and no saved bytes, and their next store threw. `StorageTexture::forgetSavedOver` drops the saved bytes only of the units over the filled or copied range. The others are compared with them at their store as before. ### Tested Linux (CachyOS, GCC 16.2.1, RTX 4090), Release, `BUILD_TESTING=ON`, on `main`: - `agc_driver_store_over_untracked`: new case, an image copy into another block of a surface with results pending outside it. It fails on `main` with the message above and passes with the change. - `ctest -R agc_driver`: 386 of 386 pass (one existing skip). - `tools/check_conventions.py` passes. Not run on Windows or with the title. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 (independent of #5671; both merge cleanly together) - [x] Unblocks: PPSA15657 #361 (the path the #5657 trace points to) - [x] GPUs tested: NVIDIA RTX 4090, Linux - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-14 07:43:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T07:43:12Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#5708 core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp L208, L303, L310
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6163454856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5707#issuecomment-6163454856). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T07:43:12Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #5708 | `core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp` [L208](https://github.com/boykopovar/AnyPS5/blob/c654b199bda8df6415924f63d93649bec4ad27bd/core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp#L208), [L303](https://github.com/boykopovar/AnyPS5/blob/c654b199bda8df6415924f63d93649bec4ad27bd/core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp#L303), [L310](https://github.com/boykopovar/AnyPS5/blob/c654b199bda8df6415924f63d93649bec4ad27bd/core/libs/prx/libSceAgcDriver/tests/execution/StoreOverUntracked.cpp#L310) | | |
simonbronk commented 2026-10-14 08:59:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T08:59:22Z.


AMD and NVIDIA runs for this PR at head 3eb19d9f2. Windows 11 Pro 26200, WinLibs GCC 15.2.0 (MinGW-w64), Release, one machine with two GPUs, each picked with ANYPS5_GPU:

  • NVIDIA GeForce RTX 5070, driver 617.42 (32.0.16.1742)
  • AMD Radeon(TM) Graphics, Ryzen integrated, gfx1036 (1002:13c0, RDNA 2), driver 32.0.21036.18

ctest -R "agc|shader|video_out" -j 8 (518 tests, including the ones this PR adds or changes):

  • RTX 5070: all 518 pass.
  • AMD gfx1036: all pass except agc_driver_lds_mixed_width_atomics, agc_driver_pixel_interlock and agc_driver_layered_volume_vertex_no_gpl. These three fail the same way on current main (872f52320) on this GPU and pass there on the RTX 5070; they are the three of #5271, so not caused by this PR.

No title run. AI-assisted: yes (Claude Code ran the builds and tests).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6164724913 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5707#issuecomment-6164724913). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-14T08:59:22Z. --- AMD and NVIDIA runs for this PR at head `3eb19d9f2`. Windows 11 Pro 26200, WinLibs GCC 15.2.0 (MinGW-w64), Release, one machine with two GPUs, each picked with `ANYPS5_GPU`: - NVIDIA GeForce RTX 5070, driver 617.42 (32.0.16.1742) - AMD Radeon(TM) Graphics, Ryzen integrated, gfx1036 (`1002:13c0`, RDNA 2), driver 32.0.21036.18 `ctest -R "agc|shader|video_out" -j 8` (518 tests, including the ones this PR adds or changes): - RTX 5070: all 518 pass. - AMD gfx1036: all pass except `agc_driver_lds_mixed_width_atomics`, `agc_driver_pixel_interlock` and `agc_driver_layered_volume_vertex_no_gpl`. These three fail the same way on current `main` (`872f52320`) on this GPU and pass there on the RTX 5070; they are the three of #5271, so not caused by this PR. No title run. AI-assisted: yes (Claude Code ran the builds and tests).
moong15 commented 2026-10-14 09:37:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by moong15 on 2026-10-14T09:37:59Z.


Independent confirmation on Windows with Stellar Blade (PPSA13197 v01.141). We hit the same throw, traced it to the same cause, and wrote the same per-unit change before finding this PR.

Setup: Windows 11 Pro 26200, MinGW GCC 15.2, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.2008), on main plus #5631 and other local changes the title needs.

Temporary logging (not part of any PR) at the two layerOriginal.assign sites and at the store throw shows the pattern twice in one run:

[diag-alias] copy into 0x220cc50000+0x20000 (format 56) drops original of pending image 0x220cc50000+0x120000 (format 36)
[diag-store] image 0x220cc50000+0x120000 units=18 tile=7 format=36 blockUnits=1 watched=0
  units 2-17: original=0 generation=0 pending=1
[diag-alias] copy into 0x20ca600000+0x40000 (format 75) drops original of pending image 0x20ca600000+0x240000 (format 71)
[diag-store] image 0x20ca600000+0x240000 units=36 tile=7 format=71 blockUnits=1 watched=0
  units 4-35: original=0 generation=0 pending=1
[agc] driver failure, continuing: AGC graphics: storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented

The units that throw are exactly the ones the copy did not cover: a copy over units 0-1 leaves 2-17, and a copy over units 0-3 leaves 4-35. After that the title freezes.

With the per-unit change, the next run did not throw, and the title went on to a later, unrelated failure about 14k log lines further (sampling a stencil plane as UNORM).

We also have a fill-clear regression case: FillClear into a smaller image over the first unit of an image with pending results over unwatched memory. It throws on main and passes with the per-unit change. It can go into a follow-up if useful.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165397327 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5707#issuecomment-6165397327). Originally posted by [moong15](https://github.com/moong15) on 2026-10-14T09:37:59Z. --- Independent confirmation on Windows with Stellar Blade (PPSA13197 v01.141). We hit the same throw, traced it to the same cause, and wrote the same per-unit change before finding this PR. Setup: Windows 11 Pro 26200, MinGW GCC 15.2, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.2008), on `main` plus #5631 and other local changes the title needs. Temporary logging (not part of any PR) at the two `layerOriginal.assign` sites and at the store throw shows the pattern twice in one run: ``` [diag-alias] copy into 0x220cc50000+0x20000 (format 56) drops original of pending image 0x220cc50000+0x120000 (format 36) [diag-store] image 0x220cc50000+0x120000 units=18 tile=7 format=36 blockUnits=1 watched=0 units 2-17: original=0 generation=0 pending=1 [diag-alias] copy into 0x20ca600000+0x40000 (format 75) drops original of pending image 0x20ca600000+0x240000 (format 71) [diag-store] image 0x20ca600000+0x240000 units=36 tile=7 format=71 blockUnits=1 watched=0 units 4-35: original=0 generation=0 pending=1 [agc] driver failure, continuing: AGC graphics: storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented ``` The units that throw are exactly the ones the copy did not cover: a copy over units 0-1 leaves 2-17, and a copy over units 0-3 leaves 4-35. After that the title freezes. With the per-unit change, the next run did not throw, and the title went on to a later, unrelated failure about 14k log lines further (sampling a stencil plane as UNORM). We also have a fill-clear regression case: `FillClear` into a smaller image over the first unit of an image with pending results over unwatched memory. It throws on `main` and passes with the per-unit change. It can go into a follow-up if useful.
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!5707
No description provided.