Repository navigation
Conversation
Every placement of a texture on the title's pages of video memory (Pages::bind) looked at every page of both maps for the ones idle for 2 s. A retail game streaming its world places textures by the ten thousand over more than 100 000 pages: on an i7-7700K, by its 36 864th placement (213 s into the run, 113 460 + 17 088 pages) the sweeps had looked at 2 922 636 089 page entries and taken 14.5 s of the title's thread that creates its resources - with PAGES held, which the title's queues wait for before their work (before_execute). The pages whose last user went are queued with that moment, oldest first, and a sweep takes the ones idle for IDLE from the front (sweep_idle); an entry whose page was used again since is dropped. The same run with it: 3 ms in the sweeps by the 36 864th placement, 38 067 queue entries looked at. Which pages go back, and when, is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Test run of Tested
Review of the change: the only two places that make a page idle ( Not tested: no retail title or regression run (I have no unpacked game), so the stall in the description was not measured here; no Run and report by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
Every 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 Textures: copy linear mip levels a row at a time #334 and Rect lists: the CPU expansion finds the rect's corner, not always v1 #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 Retail GTA VI: null write at +0x2215c35 (#159) still hits on NVIDIA RTX 4070 Ti, with and without XCL_NETWORK=0 #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 Textures: a layout's high-coordinate tables hold one period, not 65536 entries #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