Skip to content

Memory: drop the CPU copy of idle sparse-window tiles once the GPU tile holds them (read back on touch) #2825

Backlog

Description

@jeremiahmvze

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:

  1. 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).
  2. 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.
  3. 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.
  4. Adaptive: count recommit faults per second. If they pass a threshold, raise N, or stop parking.
  5. Kernel calls into parked pages need the same ensure hooks as kernelx/lazy.rs pages.

Related, from a search (none does this):

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

  1. Krigsexe commented on Nov 26, 2026

    @Krigsexe
    Contributor

    @jeremiahmvze I was just explain that here : #1466 but no one care... ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions