agc: a second write-back of a storage image over unwatched memory throws ("without the guest bytes saved before them") #5711

Closed
opened 2026-10-14 07:41:26 +00:00 by ps54all · 3 comments
ps54all commented 2026-10-14 07:41:26 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-14T07:41:26Z.


What happens

Super Meat Boy 3D (PPSA31162, Unreal Engine 5) stops after about 300-330 s with:

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

The throw is in StorageTexture's write-back (Graphics/src/Texture.cpp, the Require(!unsavedOutsideWatch, ...) before and after the host-import branch). It happened in four runs out of four, in the same game state (a title/loading phase at about 2 FPS).

Setup: Windows 11, RTX 3080 (610.74), WinLibs GCC 15.2.0 r7, Release, main f74ec639c plus #4873 at its rebased head (that PR fixes the earlier depth plane copy geometry does not match its layers stop in this title; this one comes after it). Linux not tested.

What I found

A temporary diagnostic printed the image and why it has no saved bytes. Two runs named three small images, all 0x30000 bytes with 3 tracked layers of 64 KiB (0x307c060000, 0x307ddd0000, 0x307f900000), with all 3 selected layers without layerOriginal.

I then set a member at each of the 11 places that clear layerOriginal. For 0x307f900000 the last clear was the forgetStored lambda at the start of the same write-back function (Texture.cpp:4376 on that tree). So the image had already been written back once, and:

  1. The first write-back ends in forgetStored(), which clears layerOriginal for the stored layers.
  2. Only the CPU-path branch at the end of the function restores it (layerOriginal[layer] = !skippedLayer[layer], after copying the stored texels into original).
  3. The two host-import branches (the block-unit path and the in-place copy) end with forgetStored(); ... settle(); return;. They cannot re-save original, because the stored texels come from recorded GPU work and are not readable on the CPU at that point.
  4. The next write-back of the same image over memory outside the write tracker has tracked == false (GuestMemory::ChangedBlocks), no layerOriginal, and so nothing to compare the guest bytes against, and throws.

On Windows every host import without an alias is Unwatched, so imported ranges are untracked there. I have not checked which of the two branches did the first write-back for these images, or whether the same sequence needs a particular title: the repro here is this one game.

Things I tried that were not the cause: clearByKeysFill clearing layerOriginal unconditionally (it is guarded by GuestMemory::Watched in the sibling FillClear); guarding it the same way did not change the outcome (a different image hit the same throw).

Options

I do not know which the maintainers prefer, so I did not write a PR:

  1. After the recorded copy of a GPU-direct write-back completes, read the stored bytes into original and set layerOriginal. Correct, but needs a wait or a completion callback and costs a sync.
  2. Save the guest bytes (saveBeforeUnwatch-style, ReadCommittedUnsynced) when results first become pending over untracked memory, as the message suggests. Cheap, but the guest bytes at that time are the previous write-back's recorded store, which may not have landed yet.
  3. For a range with no saved bytes, store the whole image and accept that a CPU write to the range since the previous store is lost. Simplest, but it gives up the guarantee commit e5449936f added.

Questions: which of these fits the intended design, and is the GPU-direct write-back meant to leave original unset on purpose?

AI-assisted (Claude Code); I ran the above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5843920609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5711). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-14T07:41:26Z. --- ### What happens Super Meat Boy 3D (PPSA31162, Unreal Engine 5) stops after about 300-330 s with: ``` [videoout] presentation failed: AGC graphics: storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented ``` The throw is in `StorageTexture`'s write-back (`Graphics/src/Texture.cpp`, the `Require(!unsavedOutsideWatch, ...)` before and after the host-import branch). It happened in four runs out of four, in the same game state (a title/loading phase at about 2 FPS). Setup: Windows 11, RTX 3080 (610.74), WinLibs GCC 15.2.0 r7, Release, `main` f74ec639c plus #4873 at its rebased head (that PR fixes the earlier `depth plane copy geometry does not match its layers` stop in this title; this one comes after it). Linux not tested. ### What I found A temporary diagnostic printed the image and why it has no saved bytes. Two runs named three small images, all 0x30000 bytes with 3 tracked layers of 64 KiB (`0x307c060000`, `0x307ddd0000`, `0x307f900000`), with all 3 selected layers without `layerOriginal`. I then set a member at each of the 11 places that clear `layerOriginal`. For `0x307f900000` the last clear was the `forgetStored` lambda at the start of the same write-back function (`Texture.cpp:4376` on that tree). So the image had already been written back once, and: 1. The first write-back ends in `forgetStored()`, which clears `layerOriginal` for the stored layers. 2. Only the CPU-path branch at the end of the function restores it (`layerOriginal[layer] = !skippedLayer[layer]`, after copying the stored texels into `original`). 3. The two host-import branches (the block-unit path and the in-place copy) end with `forgetStored(); ... settle(); return;`. They cannot re-save `original`, because the stored texels come from recorded GPU work and are not readable on the CPU at that point. 4. The next write-back of the same image over memory outside the write tracker has `tracked == false` (`GuestMemory::ChangedBlocks`), no `layerOriginal`, and so nothing to compare the guest bytes against, and throws. On Windows every host import without an alias is `Unwatch`ed, so imported ranges are untracked there. I have not checked which of the two branches did the first write-back for these images, or whether the same sequence needs a particular title: the repro here is this one game. Things I tried that were not the cause: `clearByKeysFill` clearing `layerOriginal` unconditionally (it is guarded by `GuestMemory::Watched` in the sibling `FillClear`); guarding it the same way did not change the outcome (a different image hit the same throw). ### Options I do not know which the maintainers prefer, so I did not write a PR: 1. After the recorded copy of a GPU-direct write-back completes, read the stored bytes into `original` and set `layerOriginal`. Correct, but needs a wait or a completion callback and costs a sync. 2. Save the guest bytes (`saveBeforeUnwatch`-style, `ReadCommittedUnsynced`) when results first become pending over untracked memory, as the message suggests. Cheap, but the guest bytes at that time are the previous write-back's recorded store, which may not have landed yet. 3. For a range with no saved bytes, store the whole image and accept that a CPU write to the range since the previous store is lost. Simplest, but it gives up the guarantee commit e5449936f added. Questions: which of these fits the intended design, and is the GPU-direct write-back meant to leave `original` unset on purpose? AI-assisted (Claude Code); I ran the above on my machine.
oneandonlydean commented 2026-10-14 10:05:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T10:05:26Z.


Thanks, the trace is right. After a write-back done on the GPU (host import), layerOriginal stays false, and outside the write watch the generation is 0 too (CollectWrites returns 0 there), so the next store has nothing to compare with.

#5679 stops the throw by saving the guest bytes when the next results land. #5760 keeps the exact behaviour, close to your option 1: the GPU-side write-back also copies the stored ranges into a host-visible buffer, and those bytes become the saved bytes when the batch completes. A store or refresh that needs them earlier waits for that batch first. So a CPU write between the two stores still keeps its block, as it does under the write watch. It also stops the full re-upload after each such write-back.

Could you run Super Meat Boy 3D on a build of #5761? It is main with #5671, #5679, #5707 and #5760 applied (branch oneandonlydean:test/storage-writeback-1014, full build green).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6165881481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5711#issuecomment-6165881481). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T10:05:26Z. --- Thanks, the trace is right. After a write-back done on the GPU (host import), `layerOriginal` stays false, and outside the write watch the generation is 0 too (`CollectWrites` returns 0 there), so the next store has nothing to compare with. #5679 stops the throw by saving the guest bytes when the next results land. #5760 keeps the exact behaviour, close to your option 1: the GPU-side write-back also copies the stored ranges into a host-visible buffer, and those bytes become the saved bytes when the batch completes. A store or refresh that needs them earlier waits for that batch first. So a CPU write between the two stores still keeps its block, as it does under the write watch. It also stops the full re-upload after each such write-back. Could you run Super Meat Boy 3D on a build of #5761? It is `main` with #5671, #5679, #5707 and #5760 applied (branch `oneandonlydean:test/storage-writeback-1014`, full build green).
ps54all commented 2026-10-14 13:36:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by ps54all on 2026-10-14T13:36:06Z.


Ran Super Meat Boy 3D (PPSA31162) on #5761 (25cc5e6d2) plus #4873 (without #4873 the title stops earlier on depth plane copy geometry does not match its layers). Windows 11, RTX 3080 (NVIDIA 610.74), WinLibs GCC 15.2.0, Release, unattended (no input).

  • One run of 480 s and one of 470 s with screenshots: no without the guest bytes saved before them refusal (on main + #4873 it came at about 300-330 s in every run that got that far). The title reaches its main menu (Continue / Start Game / Theater / Settings / Credits) by 470 s, about 1 FPS there (817 frames at 470 s); the menu background now has its colours, where my earlier integration build showed it washed out.
  • A third run died at about 30 s with a null read on FAsyncLoadingThread (app.exe+0x332d69) before any window. That is the Unreal start-up timing class I see on this title and Split Fiction independent of the storage path, so I do not count it against #5761.

Gameplay not tried (needs someone at the machine).

AI-assisted (Claude Code); I ran it on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169631990 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5711#issuecomment-6169631990). Originally posted by [ps54all](https://github.com/ps54all) on 2026-10-14T13:36:06Z. --- Ran Super Meat Boy 3D (PPSA31162) on #5761 (`25cc5e6d2`) plus #4873 (without #4873 the title stops earlier on `depth plane copy geometry does not match its layers`). Windows 11, RTX 3080 (NVIDIA 610.74), WinLibs GCC 15.2.0, Release, unattended (no input). - One run of 480 s and one of 470 s with screenshots: no `without the guest bytes saved before them` refusal (on main + #4873 it came at about 300-330 s in every run that got that far). The title reaches its main menu (Continue / Start Game / Theater / Settings / Credits) by 470 s, about 1 FPS there (817 frames at 470 s); the menu background now has its colours, where my earlier integration build showed it washed out. - A third run died at about 30 s with a null read on `FAsyncLoadingThread` (app.exe+0x332d69) before any window. That is the Unreal start-up timing class I see on this title and Split Fiction independent of the storage path, so I do not count it against #5761. Gameplay not tried (needs someone at the machine). AI-assisted (Claude Code); I ran it on my machine.
oneandonlydean commented 2026-10-14 19:14:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T19:14:18Z.


Fixed by #5760 (merged). Thanks @ps54all for the Super Meat Boy 3D runs: no refusal through the main menu.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176299032 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/5711#issuecomment-6176299032). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T19:14:18Z. --- Fixed by #5760 (merged). Thanks @ps54all for the Super Meat Boy 3D runs: no refusal through the main menu.
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#5711
No description provided.