First run of a title: the coherent window is 512 MB until uma_coherent.txt has been learned (menus at ~12 fps, then 30) #284
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#284
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@grahamster2 on GitHub · 2026-11-23 22:22 UTC · original
On a title's first run (empty
cache/),uma::coherent_hintmakes the coherent window 512 MB, because the title's need is only learned from the previous run (note_coherent_need→uma_coherent.txt). Its GPU heaps then go to the sparse windows for the whole run. From the second run on, the window is the learned size and the title runs at full speed.Measured on main
9ab7d76, RTX 3080 10 GB (driver 610.88), 32 GB RAM, the retail title,XCL_NETWORK=0:smoke.ps1smoke.ps1)Besides the first-run experience, this makes
smoke.ps1pairs depend on order: on a fresh machine, whichever of main / PR runs first shows far fewer frames.Which way would you take?
config::title_memory_budget_mb). That budget covers all title memory, not the GPU heaps that go to the coherent window, so it would only be an upper bound, clamped byMAX_SIZEand by the same 17 GB free-commit check that applies to a learned size.smoke.ps1warn whenuma_coherent.txtis missing (or do one warm-up run) so smoke pairs are comparable.#203 moves the title's large-page GPU blocks into sparse windows. It does not touch
gpu/uma.rs, but it may change what the title asks of the coherent window. I'd write the change once you pick a direction, as one small PR with a unit test of the sizing.@Kalmarv on GitHub · 2026-11-23 22:46 UTC · original
Read on
main9ab7d76, plus one measurement of what a full window costs a title that does not use it.How
mainsizes the window (code, with lines)uma::get()makes the window on first use (gpu/uma.rs:734), which is before the D3D device exists.coherent_hint()(uma.rs:678) givesXCL_COHERENT_MBif set, else the learned bytes fromcache/uma_coherent.txt+ 512 MB, at most 4095 MB (uma.rs:695). A learned value with less than 17 GB of commit free gives 512 MB (uma.rs:687,:699). No file: 512 MB. The window is committed in full (uma.rs:170,:182) and imported as one heap atreal.rs:301.HANDOFF.mdline 142 records thatOpenExistingHeapFromAddressrejects a partly committed region, so the window cannot grow during a run.kernelx::VirtualAllocadds up everyPAGE_GRAPHICS_*commit (hle/kernelx.rs:247-250; a running total, frees do not reduce it) andnote_coherent_need(uma.rs:713) writes the largest total. Only the next run uses it. A title that makes no such commit never writes the file.kernelx.rs:256) falls through to a plainVirtualAlloc(kernelx.rs:263). I do not see it reach the sparse windows there; if your first-run log shows that it does, which line? For plain memory the comment atkernelx.rs:244says the title's "shaders read zeros", and index and vertex buffers bound from it go through mirrors that each draw copies into (hle/d3d12x/list_x.rs:1724-1811), up to 2 GiB, then a copy made at the bind "which later writes do not reach" (list_x.rs:1798). So a first run may also draw differently, not only slower.maingates on the first already.title_memory_budget_mbis 13,824 MB, or 8,192 MB (config.rs:117-120), always above the 4095 MB cap, so every title would get the full window. The per-title figuremainhas isuma_mb, 4095 for a title whose config asks for advanced memory and 2048 otherwise (config.rs:111), andfor_runtime_withholds it to the 512 MB hint today (uma.rs:170).Measured: a 4095 MB window for a title that does not need it
The repository's own test title (
xcl run <game> -- --hello, astests/e2e.rsruns it) withXCL_COHERENT_MB=512and=4095, three pairs, alternating, a new empty data folder for each run; every run ended withfailures: 0.main9ab7d76, debug build. RTX 5070 Ti (driver 610.74), Ryzen 9 9950X, 32 GB RAM, Windows 11 26200. Process figures are the host process's peaks fromGetProcessMemoryInfo; times are XCL's log timestamps.memory:line)So the window is not only commit: importing it makes all of it resident. A full window costs a title that uses none of it 3.6 GB of RAM for the whole run, and about a second.
Plan (for whoever writes it; @grahamster2 offered, and I am not starting a PR)
uma_coherent.txtexists and the 17 GB of commit are free; 512 MB otherwise, as today.XCL_COHERENT_MBset.Not tested
kernelx.rs:244and your 4.8 GB are known to me.🤖 Claude Code (Claude Fable 5.2)
@grahamster2 on GitHub · 2026-11-23 22:47 UTC · original
Taking this, following Kalmarv's plan: full window on a title's first run only (no
uma_coherent.txtand 17 GB of commit free), and the learned total written on every run, 0 included. PR soon.@xstraok on GitHub · 2026-11-23 23:59 UTC · original
A data point against a full window on the first run, from Linux. On this setup the 4095 MB window is what makes the title slow and black, and 512 MB is what works. This is the opposite of the RTX 3080 numbers above.
Setup:
maindb1ddb2+ #257 (Linux kit, head26fdda6; its only runtime change is a preflight check under Wine), release build,x86_64-pc-windows-gnu. RX 9060 XT (RADV, Mesa 26.2.6), Ryzen 5 7600, 32 GB RAM, Arch Linux, kernel 7.2.15. Proton Experimental 11.0 (20261112) Wine, vkd3d-proton v3.1 + #257's patch, Proton's DXVK. Retail GTA VI 1.0.2.1,XCL_NETWORK=0. Same prefix and data folder for every run; account prompt answered by hand.coherentused (lastconsole code so far)cache/), 120 sXCL_COHERENT_MB=512, 120 sThe 1st and 3rd runs differ in when the prompt was answered. Both drop to 6–8 fps once the title loads past the menus. That is a separate problem and I have not looked into it yet.
In the 4095 MB run the title puts about 4 GB of GPU heaps in the window. The sparse uploads' time is almost all
upload(sparse windows timing: … upload 7057 ms), which includesupload_dirtywaiting on its fence, so I read it as the GPU being slow, not the CPU copy. My guess is that the GPU reads a host-memory import over PCIe on every access, but I have not measured that.So for the plan above: on this setup, "full window on the first run" would make the first run unusable too, where today it works. The second run already is unusable, because of the learned size. Whatever the first-run rule ends up being, it seems to need a way out: either cap the learned size under Wine, or measure the window rather than trust the title's request.
Not tested: Windows, NVIDIA under Wine, other window sizes between 512 and 4095 MB, GPU time per frame.
Measured and written with Claude Code (Claude Opus 5.5); runs on my machine, logs kept.
idxenreads from a CBV ignore the index – measured on Linux, Windows measurement wanted #307@MonkeyPython on GitHub · 2026-11-24 00:06 UTC · original
Reproduced and confirmed on NVIDIA (RTX 3080 Ti, wave32-only), Windows 11 Pro 26300,
Ryzen 7 7800X3D, 32 GB, driver 621.24,
mainat4017f8ff8faaae6007fd83910d230a027dd85a33, release,XCL_NETWORK=0, 60 s runs at3840×2160.
cache/uma_coherent.txtafter run 1: 4804771840. The penalty and the recovery match theissue exactly (~12–13 fps first run, ~30 after). No crash in any of these four runs.
Side observation: a separate run with
XCL_FRAME_DUMP=1(learned window) crashed at~250 presents,
0xc0000005innvwgf2umx.dll+0x8d713f(read at0x3c); runs withoutthe frame dump were clean (3/3). Suggestive of the dump readback path on NVIDIA, not
proof — happy to file separately if useful.
Not tested: other GPUs, resolution other than 4K.
AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the title and wrote this
report from the logs; a human reviewed it before posting. No code changes.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@grahamster2 on GitHub · 2026-11-24 04:52 UTC · original
A note for the 512 MB path that #632 keeps for first runs under Wine. On Windows, with the window forced to 512 MB (
XCL_COHERENT_MB=512), the retail title crashed during world loading in both runs that got that far. With the full 4095 MB window, neither of 3 runs reached this crash.Setup: RTX 3080 10 GB (driver 610.88), Windows 11 26200, release build of
mainf4ce27cplus #539's Wait64 commits and a list split (grahamster2/xclsplit-waits-main).XCL_NETWORK=0, A pressed at 14, 17, 21, 25 and 31 s, warm caches.What happens with 512 MB: the title creates acceleration-structure views whose addresses are not in unified memory. XCL writes empty BVH descriptors for them, and a few seconds later the console BVH builder throws:
The second run did the same: three empty-BVH warnings at 90.74 s and the same exception at 91.34 s. The three runs with the 4095 MB window have no empty-BVH warning and no
xboxbvhbuilderexception. They ended in other ways: the write at+0x23cf683seen onmain, or a read at -1.What this means for #632: under Wine the first run keeps 512 MB, because the 4095 MB window left the title black there. If this title's BVH memory needs the larger window, a first run under Wine may crash at world start like this rather than render. I have no Wine setup, so that part is not tested. The same would apply to a first run on
mainbefore #632, which also uses 512 MB; I did not run that.Not tested: Wine/Proton, AMD, a first run on plain
main(onlyXCL_COHERENT_MB=512was forced), and what size the BVH memory actually needs.Test report written with Claude Code (Claude Opus 5.5) from my own runs.
@milas6669 on GitHub · 2026-11-24 06:56 UTC · original
A data point where the 512 MB window is not from a first run. It comes from low free commit at launch, and the speed difference is the one in the table above.
Setup: RTX 3070 8 GB (32-lane waves), i9-10900KF, 31.9 GB RAM, 46.9 GB commit limit (system-managed 15 GB page file), Windows 11 Pro 10.0.26200, release build of unmodified
mainbeaa245, the retail title,XCL_NETWORK=0.cache/uma_coherent.txtwas already there (4804771840) in all runs below.xcl.exefor 1 and 3, byte for byte)mainUMA: 17134 MB of commit free, under 17408 MB: the title's GPU heaps stay outside unified memoryand512 MB coherent windowmain+ #5514095 MB coherent windowmainagain4095 MB coherent windowsmoke.ps1pair depend on how much commit happened to be free for each run, not only on the order (as the issue says). It cost me a wrong conclusion on #551 (corrected there).Not tested: a larger page file (I did not change any setting), AMD, Wine.
AI use: Claude Code, Claude Sonnet 5.5, ran the commands and wrote this comment.
@EgoraWyn on GitHub · 2026-11-24 07:52 UTC · original
The same comparison as the comment above (512 MB against the learned window on
beaa245, Intel CPU), on a 6 GB card, with two things added: what it does to video memory, and where the time goes with 512 MB.Setup: unmodified
mainbeaa245, release (cargo build --release --workspace); RTX 3060 Laptop 6 GB (5994 MiB), driver 596.21 (32.0.15.9621), wave32; i5-12450H (no CLZERO / MONITORX / MWAITX: emulated), 32 GB RAM; Windows 11 Pro 26200; Rust 1.100.0, DXC 1.9.2602.17. The same retail title, Series X profile, 180 s with no input (it reaches its first prompt and stays there),XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=180 XCL_DXC_THREADS=4, the process limited to 4 logical CPUs. Runs alternated, warm pipeline caches,uma_coherent.txtlearned earlier (4804771840).XCL_COHERENT_MB=512)XCL_THREAD_DUMP_AT, 10 samples each, 512 MB window, XCL frames named from the PDB): the thread that runs the emulated instructions hadNtQueryVirtualMemoryas its innermost frame in all 10 samples of both runs. On2b4bb43:eh::is_writable(emulated CLZERO loop) 4,gpu::shader::readablefromlist_x::sync_title_buffers3 and fromlist_x::gpu_va2, caller not resolved 1. Ona6f5f7a(#332):is_writable5,readablefromgpu_va5 (the two buffers the log names as outside unified memory are 393 216 and 1 179 648 bytes, more than #332's 16 pages). Read from the code, not measured: each of these callers returns before the query for an address inside the committed window.9ab7d76, before #306, and matches what #306 describes.Not tested: a first run with no
uma_coherent.txt(so not #632 itself); world loading; Wine; AMD.AI use: Claude Code (Claude Fable 5.2) ran the builds and the runs, tallied the thread dumps and wrote this comment; the numbers are from the runs above on this machine.
@einfachama on GitHub · 2026-11-24 11:45 UTC · original · edited 2026-11-24 11:48 UTC
A data point for the order dependence of
smoke.ps1pairs: it also happens with a learned window, through the 17 GB free-commit check, on a 32 GB machine with the default page file.Setup: RTX 4060 8 GB (Ada, 32-lane waves), driver 621.24; Ryzen 7 5800X; 32 GB RAM, system-managed page file (commit limit 42.4 GB); Windows 11 Pro 26300; release builds of
main64b3f35and two branches on it; my retail title;scripts/smoke.ps1 -Seconds 60, unattended.uma_coherent.txtwas learned hours before. These runs were on64b3f35, before main changed the UMA window bounds; not rechecked on current main.What happened: for about 20 minutes, between rounds of
cargo build/cargo test --workspace, free system commit was ~15.2–15.7 GB. Every title run I kept the report of from that period loggedUMA: … MB of commit free, under 17408 MBand got the 512 MB window. Then free commit was back above 20 GB, and every run had the learned window again. Same binaries in both groups:mainand branches)mainand branches)Five earlier runs (reports not kept) show the same signature: 676–1 154 frames, peak commit 15 316–15 331 MB.
So a PR's smoke run made in the first state, compared with a
mainrun made in the second, fails the 80 % frames rule by itself. Thexcl-smokeblock doesn't show which state a run was in; the WARN line inxcl.logandd3d12.uma_mbinreport.jsondo.Not tested: what held the ~5 GB of commit then. I didn't look at processes at the time. Afterwards, a release build on its own did not lower free commit (21.1 GB before, right after and for 3 minutes after), and some runs straight after builds had the learned window, so it wasn't simply the builds. Also not tested: other machines' commit limits, AMD.
AI use: Claude Code with Claude Opus 5.5 ran the runs in an unattended session, read the logs and wrote this comment; I checked it before posting.
@Swagi-REDACTED on GitHub · 2026-11-25 02:57 UTC · original
Additional measurement on a 16 GB native Windows machine, current
maincbc296ab65a2661a61e3e2da109134bcd5319f60.Tested
XCL_FRAME_DUMP=300.XCL_COHERENT_MB=4095override opened 4095 MB coherent memory, exited 0 with 4874 presentations, and peaked at 14455 MB process commit. At the initial UI before confirmation, the log recorded repeated 30.0 fps over 300 frames; final activity samples were 60/59/60 per two seconds. No reported device removal or crash. This is an observational comparison with different run durations and input, not a main/PR regression pair.I opened #2072 to expose
d3d12.uma_mbascoherent memoryin the generated smoke block, so this difference is visible when comparing reports. It is scripts-only; it does not change the automatic sizing policy.Not tested
AI use
@crastinator on GitHub · 2026-11-25 10:31 UTC · original
Another Linux/RADV data point for the learned window, which #632 leaves as it is on
mainunder Wine. Same result as @xstraok's, on an older AMD card and a different Wine.Setup:
main568e7db, release. RX 6700 XT 12 GB (RDNA2, RADV, Mesa 26.3.1), 16 GB RAM + 16 GB swap, CachyOS. CachyOS Proton 11.0 Wine (cachyos-11.0-20261015-slr), vkd3d-proton v3.1 with #257's patch (dxil-spirv53aac418), Proton's DXVK. Retail title 1.0.2.1,XCL_NETWORK=0 XCL_ACTIVITY=1.cache/)XCL_COHERENT_MB=512Two things that are new here:
not in unified memory – writing empty BVH descriptor) once at 330 s and three times at 406 s. Noxboxbvhbuilderexception followed in the next 27 s. I stopped the run at 433 s because the card's VRAM was full (14.7 GB "local" on a 12 GB card, the #646 problem).So under Wine, capping the learned size too (as xstraok suggested) looks needed, not only the first run.
Not tested: this card with Proton Experimental's Wine, NVIDIA, window sizes between 512 and 4095 MB.
Measured and written with Claude Code (Claude Opus 5.5); runs on my machine, logs kept.