Memory: new sparse tiles are mapped together before the next submit #1507
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1517"
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?
Imported from ivall/xcl. Originally posted by oishigeso on 2026-11-24T17:10:12Z.
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 oneUpdateTileMappingsplus 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 firstUpdateTileMappingscalls holding the render thread).New tiles now get their pool tile in
mappedat once, and their mapping call is queued (pending).flush_pendingsends 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 fromparkedsends no mapping.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:pending,flush_pending, called frombefore_execute, the upload and readback paths, andcommit_rangepastPENDING_MAX; the existing parking test extended to commit, decommit, flush and commit againTested
cargo test -p xcl --lib sparse -- --test-threads=1: 16 passed, 0 failed, 1 ignored7f94c6fsince; the combination was reviewed against the parking, which found the parked-before-flush case above (now in the test).main, presenting every 2 s window at the end.Regression run
main:
PR (this PR's head commit; the title is run through a folder named RetailTitle):
Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:56Z.
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 unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by fladit123 on 2026-11-25T22:43:49Z.
Review: CHANGES_REQUESTED
Independent validation on RTX 4060 confirms the substantial potential of batching, but I found a threshold-related performance regression that should be addressed before merging.
Results
Tested against base
930e8b4and PR HEADb52f7cb67236473c8a4d9a07eabaf01694d72de0.Finding
commit_rangetriggersflush_pending()whenpending.len() >= PENDING_MAX.However,
flush_pending()retains parked addresses whose mappings have not yet been submitted. These entries continue contributing to the threshold even though they are not ready to be mapped.With 4,095 such parked addresses, the next 32 commits triggered 32 early flushes, examining 135,167 entries including the final flush.
This effectively defeats batching in that workload and increased median elapsed time by approximately 22.8%.
I recommend tracking only unique, currently eligible mappings toward the flush threshold while preserving the necessary pending state for parked addresses that are subsequently recommitted.
A regression test covering this parked-address workload would be valuable.
Rebase considerations
Current main also has fence-based tile quarantine and per-title-queue synchronization. Please preserve these guarantees when resolving the conflicts in
sparse.rs.Correctness validation
The measurements cover synthetic mapping through fence completion, not game FPS or frame times. Integration with current main has not been validated.
The batching approach looks promising. My
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:58:54Z.
Triage (#1607) – head
b52f7cbThis PR's commit is on main:
6831cafe(Memory: new sparse tiles are mapped together before the next submit) is a cherry-pick ofb52f7cb, and main's sparse.rs has State::pending, flush_pending and PENDING_MAX with the same call sites (before_execute, submit_slot, readback_ranges).Recommendation: close (superseded by main commit
6831cafe).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:46:38Z.
Closing as superseded: this change is already on
main(6831cafe). main6831cafeis the same change as headb52f7cb(75 changed lines, only comment wording and the pending field's initial position differ; main also has the self.kept.contains_key check)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed