Skip to content

Memory: new sparse tiles are mapped together before the next submit - #1517

Draft
oishigeso wants to merge 1 commit into
xcl-dev:mainfrom
oishigeso:sparse-batch
Draft

oishigeso wants to merge 1 commit into
xcl-dev:mainfrom
oishigeso:sparse-batch

Conversation

@oishigeso

Copy link
Copy Markdown

Follows 7f94c6f (#532), which parks decommitted tiles; this does the same for new ones. A title starting on a Series S profile maps 4.3 GB of physical pages in small pieces (MapTitlePhysicalPages → sparse::committed), and each new tile cost one UpdateTileMappings plus a signal (~0.4 ms on this PC). Its loading thread was held ~25 s with nothing presented, and its stall watchdog ended it. Related: #1268 (the first UpdateTileMappings calls holding the render thread).

New tiles now get their pool tile in mapped at once, and their mapping call is queued (pending). flush_pending sends them, one call per window, before the title's next submit, before XCL's own copies and readbacks on the windows, or past 4,096 tiles. A tile decommitted before the flush is skipped. One decommitted and parked before its mapping was sent stays pending, because taking it back from parked sends no mapping.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: pending, flush_pending, called from before_execute, the upload and readback paths, and commit_range past PENDING_MAX; the existing parking test extended to commit, decommit, flush and commit again

Tested

  • AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release
  • cargo test -p xcl --lib sparse -- --test-threads=1: 16 passed, 0 failed, 1 ignored
  • Written and run before Memory: decommitted sparse tiles stay mapped until the next submit #532 merged in about 10 runs of a retail title on the Series S profile; the ~25 s hold at start was gone. Rebased onto 7f94c6f since; the combination was reviewed against the parking, which found the parked-before-flush case above (now in the test).
  • The regression runs below are on the Series S profile: 1,319 frames in 60 s against 373 on main, presenting every 2 s window at the end.

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 373 (PresentX 374)
presents per 2 s (last 3): 0 28 60
device removals: 0
crashes: 0
peak commit: 19259 MB

PR (this PR's head commit; the title is run through a folder named RetailTitle):

xcl-smoke v1
commit: b52f7cb67236473c8a4d9a07eabaf01694d72de0
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 1319 (PresentX 1320)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19347 MB

Not tested

  • NVIDIA, Intel; Linux / Wine

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, its test and this description, and ran the tests and runs above on my PC at my direction.

🤖 Generated with Claude Code

A title starting on a Series S profile maps 4.3 GB of physical pages in
small pieces (MapTitlePhysicalPages -> sparse::committed), and each new
tile cost one UpdateTileMappings + signal (~0.4 ms). Its loading thread
was held ~25 s with nothing presented and its stall watchdog ended it.

New tiles now get their pool tile in `mapped` at once and their mapping
call is queued (`pending`); `flush_pending` sends them, one call per
window, before the title's next submit, before XCL's own copies and
readbacks on the windows, or past 4,096 tiles. A tile decommitted
before the flush is skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants