Repository navigation
Description
Proposal: once a coherent/sparse-window page's bytes are safely in its GPU tile, drop the CPU copy, and copy the tile back from video memory only if the CPU touches the page again.
Why: on a 32 GB RAM machine the title's memory is charged twice. On our PC (RTX 4090 24 GB, 32 GB RAM, system-managed page file, a commit limit of about 69.5 GB at start, about 26 GB used before XCL starts), XCL peaks at 42–48 GB of commit on title 7952987A. Runs regularly lose the device at the commit edge (0x887a0005/0006) when Windows doesn't grow the page file in time. At about 300 s the commit splits roughly into: video heaps 20–24 GB (charged to commit), the CPU side of the sparse windows about 7.1 GB, the UMA window 0.5 GB, and other 13.5 GB. The sparse windows' video tiles hold about 7.2 GB of the same data.
What we measured (an ad-hoc probe, not upstream code): 256 committed pages were sampled across mapped sparse tiles at about 60 s and made PAGE_NOACCESS, logging the first touch.
- Run A, 300 s: 240 could be watched. 42 were touched by 102 s (23 of them writes; game code, one system DLL, one unresolved region), and none from 102 to 300 s. 198 (77%) were untouched for at least 3 minutes.
- Run B, 300 s: 216 of 256 (84%) untouched, and all touches came early.
- So the CPU touches come in a burst at load. Extrapolated, about 5–6 GB of commit could be given back.
- Caveat: our test is scripted menu presses, then a mostly static scene. Real play streams more, so treat 77–84% as an upper bound.
Sketch:
- Candidates are committed 4 KiB pages of mapped sparse tiles that are clean in write-watch since their last upload's fence and idle for N s (N starting at 30).
- Decommit a whole 64 KiB tile's committed pages and mark the tile parked. The GPU tile and the holes mask stay as they are.
- A fault on a parked tile recommits its pages, then copies the GPU tile back: a dedicated COPY queue into a small readback ring, a fence wait, then a memcpy. Then reset write-watch for those pages, and let the access (write included) carry on.
- Adaptive: count recommit faults per second. If they pass a threshold, raise N, or stop parking.
- Kernel calls into parked pages need the same
ensurehooks askernelx/lazy.rspages.
Related, from a search (none does this):
kernelx/lazy.rs: commit on first touch, but never decommits.- amd-dev: RX 6800 reaches the world, then 0xc0000005 at game+0x501eb50 in sparse memory #2582 (
e4b66e57/2af01554onamd-dev): GPU-only buffers with no CPU commit, read back onMap(). - Memory: sparse tiles the CPU leaves alone leave the write-watch look (#582, off by default) #1034: idle-tile detection with a write-fault handler.
- D3D12.X: textures the GPU writes never reach title memory; a title reading them on the CPU gets stale data #2663 / D3D12.X: XCL_GPU_TEXTURE_TOUCH logs CPU accesses to textures the GPU owns #2695: a GPU-to-CPU copy-back for GPU-written textures.
- D3D12.X: read the title's sparse windows directly instead of copying them #2090: the opposite trade (the GPU reads CPU memory directly).
- D3D12.X: video memory use is high, title memory and textures are mirrored into VRAM #1773: mirroring discussion.
We haven't written this. We're posting it in case it fits someone's plans, or there's a reason it can't work that we're missing.
Activity
Krigsexe commentedon Nov 26, 2026
@jeremiahmvze I was just explain that here : #1466 but no one care... ^^