Loader: report pages remapped under GPU buffers that keep their old frames #5
No reviewers
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!5
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/5/head"
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:42 UTC · original
marquezinii:loader/stale-gpu-pages→main· +267 −5 · 7 files · 1 commits · merged 2026-11-24 17:45 UTCThe check from #4. A slot-133 buffer keeps the frames that were mapped when it was made. When the game later remaps or unmaps a page under it, the CPU sees the new frame and the GPU keeps the old one. Once that frame is mapped somewhere else, GPU writes through the buffer change the memory there, and
--trace-pool-storeslogs them at the buffer's address, not at the address they actually change.What changed:
XMemPhysicalMemory.MapOnereports every frame change (address, previous frame, new frame) to an observer.A CPU reservation now knows its GPU-only alias (
XMemReservation.GpuAlias).StaleGpuPages(always on) looks the page up in the address table, under its CPU address and under its alias. For each buffer page it keeps the frame the buffer was placed over, and it ignores buffers that were never over pages (committed fallbacks). It logs[gpu pages]for:The first 16 of each are logged in full, then totals at every power of two. It reads the address table only; nothing changes for the GPU.
This should tell in one boot whether the fixed-size pool object with INT_MAX-like values sits in a frame that a live buffer still holds.
Checked on Windows with an RTX 5070 (driver 621.40):
dotnet buildwith no warnings anddotnet testwith 617 passed and 0 failed (the skips need a dump or a full-wave GPU). The new test,D3D12XStaleGpuPageTests, places a buffer at a GPU-only alias, remaps the CPU page twice and maps the first frame into another range. It then checks both log lines and that a CopyBufferRegion into the buffer lands in the other range. No game files were involved.Part of #4; the fix itself stays open there.
@ThatRecompDev on GitHub · 2026-11-24 17:46 UTC · original
Merged, thanks! Clean change, and the test pins the behaviour nicely.
For context on #4: the INT_MAX-like heap faults turned out to come from a translator bug rather than stale frames. On wave64, an integer read of a register that is also the high half of a lane mask written on another code path was read as the mask, which sent CS_Prop_BatchCull's instance-count atomics to the start of the transient pool. With that fixed, the story load ran past 200 s without corruption. Your check stays useful though: it tells us in one boot whether the game remaps pages under live buffers, and #4 stays open for the actual fix.