Skip to content

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

Backlog

Description

@grahamster2

On a title's first run (empty cache/), uma::coherent_hint makes 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:

run coherent window frames in the first 60 s menu fps
1st (empty data folder), smoke.ps1 512 MB 650 ~12
2nd and later 4095 MB (learned 4.8 GB, capped) 1480 (smoke.ps1) 30.0

Besides the first-run experience, this makes smoke.ps1 pairs depend on order: on a fresh machine, whichever of main / PR runs first shows far fewer frames.

Which way would you take?

  1. Seed the first run from the title: e.g. from MicrosoftGame.config / the TitleMemoryStatus budget (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 by MAX_SIZE and by the same 17 GB free-commit check that applies to a learned size.
  2. A bigger fixed first-run default (e.g. the full 4 GiB window when 17 GB of commit is free, 512 MB otherwise). This is simple, but every title commits the larger window up front, including small ones like the test title.
  3. Leave it as is and have smoke.ps1 warn when uma_coherent.txt is 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.

Activity

  1. Kalmarv commented on Nov 23, 2026

    @Kalmarv
    Contributor

    Read on main 9ab7d76, plus one measurement of what a full window costs a title that does not use it.

    How main sizes the window (code, with lines)

    1. uma::get() makes the window on first use (gpu/uma.rs:734), which is before the D3D device exists. coherent_hint() (uma.rs:678) gives XCL_COHERENT_MB if set, else the learned bytes from cache/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 at real.rs:301. HANDOFF.md line 142 records that OpenExistingHeapFromAddress rejects a partly committed region, so the window cannot grow during a run.
    2. Learning: kernelx::VirtualAlloc adds up every PAGE_GRAPHICS_* commit (hle/kernelx.rs:247-250; a running total, frees do not reduce it) and note_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.
    3. First run, read from the code, not seen in a title: a heap that does not fit (kernelx.rs:256) falls through to a plain VirtualAlloc (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 at kernelx.rs:244 says 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.
    4. The window is committed system memory imported as a cross-adapter heap. It is not dedicated video memory, so the adapter's VRAM is not what to size it from; free commit and free RAM are (see the table), and main gates on the first already.
    5. Option 1 comes out the same as option 2: title_memory_budget_mb is 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 figure main has is uma_mb, 4095 for a title whose config asks for advanced memory and 2048 otherwise (config.rs:111), and for_runtime_with holds 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, as tests/e2e.rs runs it) with XCL_COHERENT_MB=512 and =4095, three pairs, alternating, a new empty data folder for each run; every run ended with failures: 0. main 9ab7d76, 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 from GetProcessMemoryInfo; times are XCL's log timestamps.

    512 MB 4095 MB difference
    peak commit 2550 to 2551 MB 6145 to 6146 MB +3595 MB
    peak working set 865 MB 4458 MB +3593 MB
    non-local video memory (XCL's memory: line) 676 to 677 MB 4304 to 4335 MB +3.6 GB
    window made to "UMA opened" 0.12 s 0.73 to 0.85 s +0.6 to 0.7 s
    start to end of log 5.00 to 5.15 s 6.06 to 6.26 s +1.0 to 1.1 s

    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)

    • Not option 2 as "every run": that is 3.6 GB of RAM in every run of every small title. Instead the full window on a title's first run only, when no uma_coherent.txt exists and the 17 GB of commit are free; 512 MB otherwise, as today.
    • Write the learned total in every run, 0 included, so a title that asks for nothing is back at 512 MB from its second run. Today such a title never writes the file (point 2) and would stay on the full window.
    • The sizing as a pure function of (learned or none, free commit) with a unit test of the three cases. The e2e tests start from an empty data folder each time, so they would take the 3.6 GB on a machine with 17 GB of commit free; they may want XCL_COHERENT_MB set.

    Not tested

    • The fps, and any retail title: we have none on this machine. Points 1 to 5 are read from the code; only the table above was run.
    • Whether the first run's slowness is the plain-memory path of point 3. That is my reading of the code.
    • One machine, a debug build, one title that draws for about five seconds. Release builds, other GPUs and drivers, and a machine short of RAM (where a resident 4 GB window may cost more than it gives) were not run.
    • What other titles ask of the window: only the 4.4 GB in kernelx.rs:244 and your 4.8 GB are known to me.

    🤖 Claude Code (Claude Fable 5.2)

  2. grahamster2 commented on Nov 23, 2026

    @grahamster2
    CollaboratorAuthor

    Taking this, following Kalmarv's plan: full window on a title's first run only (no uma_coherent.txt and 17 GB of commit free), and the learned total written on every run, 0 included. PR soon.

  3. xstraok commented on Nov 23, 2026

    @xstraok

    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: main db1ddb2 + #257 (Linux kit, head 26fdda6; 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.

    run coherent window frames shown 64 draws reached at first 16 sparse submits: upload coherent used (last console code so far) picture
    1st (empty cache/), 120 s 512 MB 1511 (30.0 fps at 44–54 s) 17 s 12 ms 116 / 512 MB splash and menus
    2nd (learned 4.8 GB, capped), 180 s 4095 MB 25 149 s 7057 ms 3998 / 4095 MB black, then grey
    3rd, XCL_COHERENT_MB=512, 120 s 512 MB 937 17 s 9 ms — splash, menus, reached the settings menu

    The 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 includes upload_dirty waiting 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.

  4. MonkeyPython commented on Nov 24, 2026

    @MonkeyPython

    Reproduced and confirmed on NVIDIA (RTX 3080 Ti, wave32-only), Windows 11 Pro 26300,
    Ryzen 7 7800X3D, 32 GB, driver 621.24, main at
    4017f8ff8faaae6007fd83910d230a027dd85a33, release, XCL_NETWORK=0, 60 s runs at
    3840×2160.

    run coherent window frames in 60 s fps (last 300) exit
    1 (first on this machine) 512 MB 641 13.4 0x0
    3 (after learning) 4095 MB 1503 29.8–30.0 0x0
    4 (after learning) 4095 MB 1499 29.9 0x0
    5 (after learning) 4095 MB 1511 29.9 0x0

    cache/uma_coherent.txt after run 1: 4804771840. The penalty and the recovery match the
    issue 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, 0xc0000005 in nvwgf2umx.dll+0x8d713f (read at 0x3c); runs without
    the 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.

  5. changed the title [-]First run of a title: the coherent window is 512 MB until uma_coherent.txt has been learned (GTA VI menus at ~12 fps, then 30)[/-] [+]First run of a title: the coherent window is 512 MB until uma_coherent.txt has been learned (menus at ~12 fps, then 30)[/+] on Nov 24, 2026
  6. grahamster2 commented on Nov 24, 2026

    @grahamster2
    CollaboratorAuthor

    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 main f4ce27c plus #539's Wait64 commits and a list split (grahamster2/xcl split-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:

    [  140.598] D3D12.X: CreateShaderResourceView(RAYTRACING_ACCELERATION_STRUCTURE) at 0x202429b1600 is not in unified memory – writing empty BVH descriptor
    [  140.601] D3D12.X: CreateShaderResourceView(RAYTRACING_ACCELERATION_STRUCTURE) at 0x2024394b200 is not in unified memory – writing empty BVH descriptor
    [  140.608] D3D12.X: CreateShaderResourceView(RAYTRACING_ACCELERATION_STRUCTURE) at 0x202441d3a00 is not in unified memory – writing empty BVH descriptor
    [  143.785] C++ exception .J "" thrown; on the stack: xcl.exe+0x660148, xboxbvhbuilder.dll+0xd2538, xboxbvhbuilder.dll+0xd2538, vcruntime140.dll+0x6480, xcl.exe+0x4960, xboxbvhbuilder.dll+0x20000
    [  143.788] unhandled exception 0xe06d7363 in KERNELBASE.dll+0xc569a
    

    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 xboxbvhbuilder exception. They ended in other ways: the write at +0x23cf683 seen on main, 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 main before #632, which also uses 512 MB; I did not run that.

    Not tested: Wine/Proton, AMD, a first run on plain main (only XCL_COHERENT_MB=512 was forced), and what size the BVH memory actually needs.

    Test report written with Claude Code (Claude Opus 5.5) from my own runs.

  7. milas6669 commented on Nov 24, 2026

    @milas6669
    Contributor

    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 main beaa245, the retail title, XCL_NETWORK=0. cache/uma_coherent.txt was already there (4804771840) in all runs below.

    run (same xcl.exe for 1 and 3, byte for byte) log line at start fps over the last 300 frames
    1 main UMA: 17134 MB of commit free, under 17408 MB: the title's GPU heaps stay outside unified memory and 512 MB coherent window 5.8, 6.3, 6.6, 7.8, then 4.2 (3000 frames at 486 s)
    2 main + #551 4095 MB coherent window 26.0, 30.0, 29.7, 27.2, 27.2 (3000 frames at 110 s)
    3 main again 4095 MB coherent window 26.1, 30.0, 27.3, 30.0, 30.0 (1800 frames at 68 s)
    • So here the window shrank to 512 MB although the learned size was on disk, because the free commit at that moment was 17134 MB, 274 MB under the 17408 MB check. Commit free was about 30 GB when I looked later (16.6 GB committed of 46.9 GB), so a few GB of other programs at launch decided it. The title then ran at 4–8 fps instead of 30.
    • The log line already says what to do (a larger page file). It may be worth a one-line note in the README's limits, because the symptom (a title stuck at a few fps with no error) does not point to commit at all. I only ran this on one machine.
    • Side effect on the regression runs: this makes a smoke.ps1 pair 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 Title textures: the write watch scans in a few calls, not thousands #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.

  8. EgoraWyn commented on Nov 24, 2026

    @EgoraWyn

    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 main beaa245, 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.txt learned earlier (4804771840).

    run coherent window frames in 180 s presents per 2 s at the prompt local video memory non-local process commit
    1 512 MB (XCL_COHERENT_MB=512) 1147 13–14 6586 MB 1359 MB 15.4 GB
    2 4095 MB (learned) 4960 60 6211 MB 4945 MB 14.7 GB
    3 512 MB 890 10–11 6589 MB 1358 MB 15.4 GB
    4 4095 MB (learned) 4986 60 6211 MB 4943 MB 14.7 GB
    • With the whole window the title holds its 30 fps from about 25 s to the end, on a 6 GB card, and uses 375 MB less local video memory than with 512 MB. All four runs: exit 0, no crash, no device removal.
    • A 360 s run with the whole window and scripted presses went through the first-run setup screens at 60 presents per 2 s from 24 s to the end (10 258 frames, local video memory 6342 MB, commit 15.1 GB).
    • Where the time goes with 512 MB on this CPU, from thread dumps on two earlier commits (XCL_THREAD_DUMP_AT, 10 samples each, 512 MB window, XCL frames named from the PDB): the thread that runs the emulated instructions had NtQueryVirtualMemory as its innermost frame in all 10 samples of both runs. On 2b4bb43: eh::is_writable (emulated CLZERO loop) 4, gpu::shader::readable from list_x::sync_title_buffers 3 and from list_x::gpu_va 2, caller not resolved 1. On a6f5f7a (Memory: readable answers a short range from the working set #332): is_writable 5, readable from gpu_va 5 (the two buffers the log names as outside unified memory are 393 216 and 1 179 648 bytes, more than Memory: readable answers a short range from the working set #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.
    • An older measurement of mine had the whole window about 7 times slower on this machine. That was 9ab7d76, before Console CPU instructions: no VirtualQuery at every emulated instruction #306, and matches what Console CPU instructions: no VirtualQuery at every emulated instruction #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.

  9. einfachama commented on Nov 24, 2026

    @einfachama
    Contributor

    A data point for the order dependence of smoke.ps1 pairs: 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 main 64b3f35 and two branches on it; my retail title; scripts/smoke.ps1 -Seconds 60, unattended. uma_coherent.txt was learned hours before. These runs were on 64b3f35, 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 logged UMA: … MB of commit free, under 17408 MB and 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:

    window at start runs frames shown in 60 s peak commit presents per 2 s
    512 MB (15 220–15 713 MB free) 7 (main and branches) 724 – 1 129 15 309 – 15 321 MB a 16 s gap with 0–1 presents from ~10 s to ~26 s, then 32–60
    the learned window 7 (main and branches) 1 608 – 1 616 14 574 – 14 581 MB no long gap, 60 from ~16 s on

    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 main run made in the second, fails the 80 % frames rule by itself. The xcl-smoke block doesn't show which state a run was in; the WARN line in xcl.log and d3d12.uma_mb in report.json do.

    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.

  10. Swagi-REDACTED commented on Nov 25, 2026

    @Swagi-REDACTED

    Additional measurement on a 16 GB native Windows machine, current main cbc296ab65a2661a61e3e2da109134bcd5319f60.

    Tested

    • Ryzen 7 9800X3D, RTX 3060 12 GB, driver 621.14; Windows 11 Home 26200; Rust 1.95.0 MSVC; release; DXC/DXIL 1.9.2602.17. A newer retail game is stored on an external HDD. NVIDIA adapter explicitly selected; offline runs, XCL_FRAME_DUMP=300.
    • The learned coherent-need file already contained 4,804,771,840 bytes. The default run logged 16919 MB free commit, under 17408 MB, then opened 512 MB coherent memory. This is the free-commit fallback with an existing learned file, rather than an empty first-run cache.
    • Default 120-second run: exit 0, 1677 presentations, peak process commit 15204 MB. At the initial UI near the end, activity samples were 26/28/27/26/24/27 presentations per two seconds. Early samples were black; initial UI prompts became visible later.
    • A subsequent 180-second run with the existing XCL_COHERENT_MB=4095 override 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.
    • A later run of the same binary with only its small writable data/cache on the SSD, game assets still on the HDD, visibly reached a first-run settings screen after scripted confirmation and maintained approximately 30 fps. The README's approximately four-second startup claim and gameplay remain unverified.

    I opened #2072 to expose d3d12.uma_mb as coherent memory in 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

    • Codex, GPT-6 (exact serving variant not exposed): executed the local runs, inspected logs and UI, and wrote this report. No game files, raw logs, or screenshots are attached.
  11. crastinator commented on Nov 25, 2026

    @crastinator

    Another Linux/RADV data point for the learned window, which #632 leaves as it is on main under Wine. Same result as @xstraok's, on an older AMD card and a different Wine.

    Setup: main 568e7db, 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-spirv 53aac418), Proton's DXVK. Retail title 1.0.2.1, XCL_NETWORK=0 XCL_ACTIVITY=1.

    run window presents per 2 s at ~45 s sparse upload time result
    1st (empty cache/) 512 MB 60 0.3 s menus at 30 fps
    2nd (learned 4.8 GB) 4095 MB 0–1 34.3 s ~1 fps, black
    3rd, XCL_COHERENT_MB=512 512 MB 60 0.3 s menus at 30 fps, world loading started

    Two things that are new here:

    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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions