D3D12.X: a placement on title pages sweeps the idle ones, not every page #490
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!490
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/490/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?
@imnicho on GitHub · 2026-11-24 00:59 UTC · original
imnicho:vram-idle-sweep→main· +93 −11 · 1 files · 1 commits · merged 2026-11-24 03:39 UTCEvery placement of a texture on the title's pages of video memory (
vram::Pages::bind– since #288 also the textures kept in step with title memory) looks at every page of both maps for the ones idle for 2 s. While a retail title streams its world that is tens of thousands of placements over more than 100 000 pages, on the title's thread that creates its resources and withPAGESheld, which the title's queues wait for before their work (before_execute). This keeps a queue of the pages that went idle and sweeps from its front.It is one part of what stalls frames while the world loads – the runs in which the title's null write comes (#232) – not all of it: see the last point under Tested.
What is in it
crates/xcl/src/hle/d3d12x/vram.rs:Pages::idle, the pages of both maps whose last user went, oldest first, each with that moment (release_tilesqueues them), andsweep_idle, which takes the ones idle forIDLEfrom the front. An entry whose page was used again since – in use now, or idle again from a later moment, which has an entry of its own – is dropped.sweep_map, the look at every page, goes. Which pages go back to the pools, and when, is unchanged.idle_pages_are_swept_from_their_queue(no GPU): pages idle for less and for more thanIDLE, one used again, one idle again later, an extra page; and 20 000 sweeps beside 200 000 pages in use within 2 s (looking at every page: 4 000 000 000 looks).Tested
hardware: Intel Core i7-7700K (4 cores / 8 threads), 16 GB RAM, NVIDIA GeForce RTX 5080 16 GB (driver 610.47), Windows 10 22H2 (19045), rustc 1.100.0
stable-x86_64-pc-windows-msvc; debug for the tests, release for the title.cargo build --workspace && cargo test --workspace -- --test-threads=4on7695539: 677 passed, 0 failed, 41 ignored (SKIPPED GPU tests:gpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_mask– no wave64).game checked: the newer retail title of the README into its world streaming (first-run pages done before, a pad script through
XCL_PRESS_AT), 300 s runs. A counter around the sweep inbindwas added to both builds for this (it is not in the PR); both on the same local base,maina6f5f7awith #334 and #266 merged:main: time in the sweeps, page entries looked atThe
mainrun ended at 225 s with the title's null write (+0x2215c35on its stack, as in #232), 23 s after its last frame and with 13 frames in the 75 s before it; the run with the change reached its 300 s. That is one run each on a PC that pages heavily at that point, so I do not claim the difference in how they ended for this change.What the rest of that stall is, from 12 thread dumps 7 s apart in the run with the change (150 s – 227 s, no frame presented for most of it): in 10 of them a title thread was building a texture layout's tables (
gpu::tiling::Layout::from_bits– what #435 shrinks), in 4 one was in the upload of kept-in-step textures (title_textures::refresh).Regression run
Both for 150 s with
XCL_PRESS_AT=45:A,85:A,92:A,99:A,106:A,113:Ain the environment (the script of the runs above).main:
PR:
On plain
mainthe title's intro video plays at about 2 frames a second on this CPU (what #334 is about), so in 150 s neither of these runs gets to the world's streaming: they are the regression check, with the placements of the first screens and of the video. The streaming numbers are the ones under Tested, onmainwith #334 and #266.Not tested
Pages.AI use
Duplicate check before opening (2026-11-24 00:59 UTC,
main2997c9a): no PR or issue about the sweep; #447 changes tests in the same file and #470 its tile mapping (each merges together with this cleanly), #292 other parts of it.🤖 Generated with Claude Code
@MesshM on GitHub · 2026-11-24 01:13 UTC · original
Test run of
76955398ea14836ff70aded18a18e9dbaac95b1bon AMD (RDNA4); the PR was tested on NVIDIA only. The branch is based on2997c9a, so I merged it onto currentmain7ebf1b8locally (clean merge, onlyvram.rs) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debug.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4) on the merge: 678 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 638 passed, 0 failed, 21 ignoredSKIPPED;idle_pages_are_swept_from_their_queuepasses, and so do the GPU tests on the same pages,placed_title_textures_share_vram_and_preserve_pixelsandstreamed_targets_stay_boundedReview of the change: the only two places that make a page idle (
idle_since = Some(now), both inrelease_tiles) now also queue it, and theimmediate_coolpath still takes the page out at once, so no idle page is left out of the queue. Everynowthat reachesrelease_tiles(unmap_superseded,forget_pages,bind) is taken afterPAGESis locked, so the queue stays in time order within aPagesandsweep_idlecan stop at the first entry that is not old enough. An entry for a page used again is dropped when it reaches the front, so the queue holds at most the releases of the lastIDLE. TheArenassweep is a separate structure and is unchanged. I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), so the stall in the description was not measured here; no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain, andmain7ebf1b8itself was not run on this machine.Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@thehollowedone on GitHub · 2026-11-24 02:20 UTC · original
Tested
I applied the diff from 7695539 to the pinned baseline 9ce2070, which includes #451. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, debug.
With
XCL_ADAPTER=3080 TiandXCL_REQUIRE_GPU=1, I rancargo test --offline --locked -p xcl --lib <filter> -- --test-threads=1 --nocapture. The VRAM group passed 7/7, including the idle-page queue test. The title-texture group passed 9/9, including the GPU checks for mirroring CPU writes and preserving pixels in shared VRAM. Both had zero reported skips or ignored tests.Main moved to cb868b2 while testing. Compared with the pinned baseline, its tree adds the timer changes in
kernelx.rsandhost.rs. These results apply to9ce2070plus the PR diff. Full workspace, retail loading, and frame-time impact were outside this run.AI use
Codex with GPT-6.2 Sol ran the tests and drafted this report.
@grahamster2 on GitHub · 2026-11-24 03:08 UTC · original · edited 2026-11-24 03:27 UTC
Benchmark of
7695539merged ontomain63cdc25(#451, #435, #602 in; clean merge). Edited: rerun on the newer main. The first version of this comment was against3db536eand is summarised at the end.Setup: RTX 3080 10 GB (driver 32.0.16.1088), Ryzen 5 7600X, 32 GB, Windows 11 26200, release builds. Retail title,
XCL_NETWORK=0, A at 14/17/21/25/31 s, 180 s runs. Both caches were warmed with one run per build first (not counted); then 2 measured runs per build.+0x23cf683)PAGESheld. It does not remove the stop, which also comes from pipeline builds and a cross-queueWait64BitValueX(#539).3db536e) streaming was 5.8 vs 5.5–6.0. One of those PR runs crashed at 59.8 s intitle_textures::refresh: the unchanged-content hash read a page that had just been decommitted (the race #454 / #484 address, in code this PR doesn't touch). It did not recur in this round.Regression run (no presses, 60 s; the title folder is a neutrally named junction)
main:
PR merged onto main:
Test report written with Claude Code (Claude Opus 5.5) from my own runs.