agc: a second write-back of a storage image over unwatched memory throws ("without the guest bytes saved before them") #5711
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
The throw is in
StorageTexture's write-back (Graphics/src/Texture.cpp, theRequire(!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,
mainf74ec639cplus #4873 at its rebased head (that PR fixes the earlierdepth plane copy geometry does not match its layersstop 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 withoutlayerOriginal.I then set a member at each of the 11 places that clear
layerOriginal. For0x307f900000the last clear was theforgetStoredlambda at the start of the same write-back function (Texture.cpp:4376on that tree). So the image had already been written back once, and:forgetStored(), which clearslayerOriginalfor the stored layers.layerOriginal[layer] = !skippedLayer[layer], after copying the stored texels intooriginal).forgetStored(); ... settle(); return;. They cannot re-saveoriginal, because the stored texels come from recorded GPU work and are not readable on the CPU at that point.tracked == false(GuestMemory::ChangedBlocks), nolayerOriginal, 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:
clearByKeysFillclearinglayerOriginalunconditionally (it is guarded byGuestMemory::Watchedin the siblingFillClear); 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:
originaland setlayerOriginal. Correct, but needs a wait or a completion callback and costs a sync.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.e5449936fadded.Questions: which of these fits the intended design, and is the GPU-direct write-back meant to leave
originalunset on purpose?AI-assisted (Claude Code); I ran the above on my machine.
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),
layerOriginalstays false, and outside the write watch the generation is 0 too (CollectWritesreturns 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
mainwith #5671, #5679, #5707 and #5760 applied (branchoneandonlydean:test/storage-writeback-1014, full build green).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 ondepth plane copy geometry does not match its layers). Windows 11, RTX 3080 (NVIDIA 610.74), WinLibs GCC 15.2.0, Release, unattended (no input).without the guest bytes saved before themrefusal (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.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.
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.