GPU writes through a slot-133 buffer land in its old frames after a remap (measured on RTX 5070) #4
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ThatRecompDev--five-star-recomp#4
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?
@marquezinii on GitHub · 2026-11-24 17:33 UTC · original
The current blocker is a GPU pass writing INT_MAX-like values into a game heap object. One writer the store trace cannot see: GPU writes through a slot-133 buffer whose pages the game has remapped since the buffer was made.
physical-memory.md already notes the limit: a buffer placed over the frames mapped at creation keeps them after
XMemMapPhysicalPages, the scatter variant orCopyPageMappingsBatchXremaps the address. I checked what that does to writes on an RTX 5070 (driver 621.40), through the shim the way the game uses it:The marker shows up in the other range. The buffer's own address (now frame B) still reads 0. The translated programs' address map goes through views of the same buffer, so their stores behave the same way.
So once a frame moves away from under a buffer and gets reused, every GPU write through that buffer lands in whatever now owns the frame.
--trace-pool-storeslogs such a store at the buffer's console address, not at the address it actually changes, so the trace would point away from the victim.This only matters if the corrupted object sits in xmem frames: the 0x380 streaming pool or the 0x280 GPU pool. Memory from plain VirtualAlloc (the 2.2 GiB heap) is never remapped. I don't have a dump, so I can't tell whether the story load remaps pages under live buffers. A boot can tell, though. I have a branch with an always-on check (
StaleGpuPages). It hooks every frame change inXMemPhysicalMemory.MapOneand logs two kinds of[gpu pages]line:It also prints totals at powers of two. It reads the address table only: no new flags, and nothing changes in what the GPU does. Branch: https://github.com/marquezinii/five-star-recomp/tree/loader/stale-gpu-pages (one commit, a WARP-safe test in the loader tests, docs line in physical-memory.md). I can open it as a PR if you want it.
If the counts are non-zero during the story load, here is a direction for the fix, which I haven't implemented:
base + offsetrather than by the base's page. Today the offset is added linearly inside the base's view, which is right only while the pages stay where they were when the buffer was made.Desktop views and copies on the game's resource objects would still use the creation-time frames. That part needs a different answer (re-placing the run buffers on remap, for example).
Checked:
dotnet buildanddotnet teston the branch (Windows, RTX 5070). 617 passed, 0 failed; the skipped tests need a dump or a full-wave GPU.@ThatRecompDev on GitHub · 2026-11-24 17:38 UTC · original
PR is welcome
@marquezinii on GitHub · 2026-11-24 17:49 UTC · original
I'm working on the fix described above: address-map entries that follow remaps (views over the section of the new frame) and V# accesses looked up by base + offset. It may also bear on the loops that run to the guard: a program reading a remapped page gets the old frame's data. I'll open a PR with WARP tests when it's ready.