D3D12.X: CreateReservedResource for each streamed title texture costs ~1 ms on AMD and stalls the title's render thread during world loading #1268

Open
opened 2026-11-26 04:48:59 +00:00 by github-bot · 12 comments
Owner

@⁠zorde23 on GitHub · 2026-11-24 14:03 UTC · original

Summary

On an AMD RX 6750 XT, a retail title's frame rate drops from ~30 fps to 0-3 fps about 80 s after start, when its world
starts loading, and stays there until the title's watchdog ends it. Timing the texture-creation path shows the title's
render thread spending most of every second inside CreateReservedResource, called once per streamed sampled texture
from vram::place_on_pages.

Setup

  • AMD Radeon RX 6750 XT 12 GB, driver 32.0.21045.29003; Windows 11 Pro 26200; 32 GB RAM.
  • main 9aec53d (+ #891, #905, #1007 merged locally; none of them changes this path), release build.
  • XCL_NETWORK=0, XCL_ACTIVITY=1, A pressed at the title screen through XCL_PRESS_A_AT; 240 s runs.

What was measured (a local diagnostic patch adds call counts and time around the calls below; numbers per 2 s window)

  • During the drop (≈86-172 s, many windows): 750-1,600 CreateReservedResource calls for title textures per 2 s,
    ~0.9-1.4 ms each, 1.0-1.5 s in total; UpdateTileMappings ~0.1-0.2 ms each; title_textures::register 0.1-0.5 s;
    waiting for the PAGES lock ≈ 0. Presents: 0-6 per 2 s (60 before the load). The GPU is mostly idle in these
    windows (3D engine 0-5 %, from Windows performance counters).
  • Causal check inside one run: in a 4 s window where the title paused texture creation, presents went back to 38-39
    per 2 s; when creation resumed they fell to 0-5 again.
  • Before the world load (~52-62 s) ~2,200-2,700 creations per 2 s at ~0.65 ms each did not affect the frame rate:
    they ran on another title thread. From the world load on they run on the render thread.
  • 97-100 % of the creations in the drop repeat a (description, initial state) already created earlier in the run; the
    title releases almost none of these textures meanwhile (0-40 per 2 s).
  • Committed resources are not cheaper (XCL_VRAM_ARENAS=1: the drop is the same and video memory overflows at ~110 s).
  • Ruled out by A/B runs on the same build: XCL_PSO_WAIT_MS=50 (#891), BCPack decoding (#905), XCL_PSO_PRELOAD=0,
    submitting DirectStorage entries without waiting for the title's Submit. None changes the drop.

Prototype (local, not a PR yet)

Since almost every creation repeats an earlier (description, state), I tried a local change: an XCL worker keeps empty
reserved resources ready per (device, description, initial state) and place_on_pages hands one out instead of calling
the driver; tiles are mapped exactly as today. It does not help, and the way it fails is informative:

  • The pool works: in the 2 s windows at ~52-60 s, 1,900-2,200 of ~2,500 creations were served from it, and
    CreateReservedResource time on the title's thread fell from ~1.7 s to 0.35-0.56 s per 2 s.
  • But the cost moves to the first UpdateTileMappings of each handed-out resource: ~0.5 ms per call instead of ~0.03 ms,
    1.26-1.43 s per 2 s. place_on_pages total stays at ~1.8-1.9 s per 2 s.
  • Title submits fell from ~480 to ~40 per 2 s in those windows and presents from 60 to 5-7 per 2 s, so this version is
    worse than main.

A second run tagged the pooled resources three ways and timed the title's map of each (sums over 50-180 s, A pressed,
240 s, XCL_PSO_PRELOAD=0):

  • made only: 0.618 ms per map; first mapped by the worker to all-NULL tiles: 0.621 ms; first mapped by the worker to one
    scratch tile (REUSE_SINGLE_TILE): 0.612 ms. The worker's own premap cost 0.64-0.74 ms. A freshly created resource maps in
    0.28 ms.
  • It is not only lock contention with the worker either: the title's CreateReservedResource calls that did not overlap any
    worker driver call cost 1.03 ms on average (1.13 ms overall).

So on this driver each reserved resource costs ~1 ms to create and another ~0.3-0.6 ms at its first mapping, whichever thread
does either, and moving that work off the title's thread does not shrink what the title waits for. Only fewer driver
resources per streamed texture would. The title keeps almost all of these textures alive (0-40 releases per 2 s), so a
pool of released ones does not help either. Is there a known way to avoid one PC resource per placement for these textures,
or a cheaper kind of resource for them on AMD? I can test proposals on this machine.

Related: #646 and #560 may be the same stall on other cards; #449 (CPU cost of xg::Texture::new in CreatePlacedResourceX) and #1048 are the CPU side of the same
call; #288 placed title textures as reserved resources on shared 64 KiB pages (one resource per placement); #640 and
#800 bound the video memory these pages use; #505 is the same title's end-of-run watchdog.

AI use: investigation, diagnostic patch and this text written with Claude (Anthropic) under my review; all numbers
come from runs on my machine.

**@⁠zorde23** on GitHub · 2026-11-24 14:03 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268) **Summary** On an AMD RX 6750 XT, a retail title's frame rate drops from ~30 fps to 0-3 fps about 80 s after start, when its world starts loading, and stays there until the title's watchdog ends it. Timing the texture-creation path shows the title's render thread spending most of every second inside `CreateReservedResource`, called once per streamed sampled texture from `vram::place_on_pages`. **Setup** - AMD Radeon RX 6750 XT 12 GB, driver 32.0.21045.29003; Windows 11 Pro 26200; 32 GB RAM. - `main` 9aec53d (+ #891, #905, #1007 merged locally; none of them changes this path), release build. - `XCL_NETWORK=0`, `XCL_ACTIVITY=1`, A pressed at the title screen through `XCL_PRESS_A_AT`; 240 s runs. **What was measured** (a local diagnostic patch adds call counts and time around the calls below; numbers per 2 s window) - During the drop (≈86-172 s, many windows): 750-1,600 `CreateReservedResource` calls for title textures per 2 s, ~0.9-1.4 ms each, 1.0-1.5 s in total; `UpdateTileMappings` ~0.1-0.2 ms each; `title_textures::register` 0.1-0.5 s; waiting for the `PAGES` lock ≈ 0. Presents: 0-6 per 2 s (60 before the load). The GPU is mostly idle in these windows (3D engine 0-5 %, from Windows performance counters). - Causal check inside one run: in a 4 s window where the title paused texture creation, presents went back to 38-39 per 2 s; when creation resumed they fell to 0-5 again. - Before the world load (~52-62 s) ~2,200-2,700 creations per 2 s at ~0.65 ms each did not affect the frame rate: they ran on another title thread. From the world load on they run on the render thread. - 97-100 % of the creations in the drop repeat a (description, initial state) already created earlier in the run; the title releases almost none of these textures meanwhile (0-40 per 2 s). - Committed resources are not cheaper (`XCL_VRAM_ARENAS=1`: the drop is the same and video memory overflows at ~110 s). - Ruled out by A/B runs on the same build: `XCL_PSO_WAIT_MS=50` (#891), BCPack decoding (#905), `XCL_PSO_PRELOAD=0`, submitting DirectStorage entries without waiting for the title's Submit. None changes the drop. **Prototype** (local, not a PR yet) Since almost every creation repeats an earlier (description, state), I tried a local change: an XCL worker keeps empty reserved resources ready per (device, description, initial state) and `place_on_pages` hands one out instead of calling the driver; tiles are mapped exactly as today. It does not help, and the way it fails is informative: - The pool works: in the 2 s windows at ~52-60 s, 1,900-2,200 of ~2,500 creations were served from it, and `CreateReservedResource` time on the title's thread fell from ~1.7 s to 0.35-0.56 s per 2 s. - But the cost moves to the first `UpdateTileMappings` of each handed-out resource: ~0.5 ms per call instead of ~0.03 ms, 1.26-1.43 s per 2 s. `place_on_pages` total stays at ~1.8-1.9 s per 2 s. - Title submits fell from ~480 to ~40 per 2 s in those windows and presents from 60 to 5-7 per 2 s, so this version is worse than `main`. A second run tagged the pooled resources three ways and timed the title's map of each (sums over 50-180 s, A pressed, 240 s, `XCL_PSO_PRELOAD=0`): - made only: 0.618 ms per map; first mapped by the worker to all-NULL tiles: 0.621 ms; first mapped by the worker to one scratch tile (`REUSE_SINGLE_TILE`): 0.612 ms. The worker's own premap cost 0.64-0.74 ms. A freshly created resource maps in 0.28 ms. - It is not only lock contention with the worker either: the title's `CreateReservedResource` calls that did not overlap any worker driver call cost 1.03 ms on average (1.13 ms overall). So on this driver each reserved resource costs ~1 ms to create and another ~0.3-0.6 ms at its first mapping, whichever thread does either, and moving that work off the title's thread does not shrink what the title waits for. Only fewer driver resources per streamed texture would. The title keeps almost all of these textures alive (0-40 releases per 2 s), so a pool of released ones does not help either. Is there a known way to avoid one PC resource per placement for these textures, or a cheaper kind of resource for them on AMD? I can test proposals on this machine. **Related:** #646 and #560 may be the same stall on other cards; #449 (CPU cost of `xg::Texture::new` in `CreatePlacedResourceX`) and #1048 are the CPU side of the same call; #288 placed title textures as reserved resources on shared 64 KiB pages (one resource per placement); #640 and #800 bound the video memory these pages use; #505 is the same title's end-of-run watchdog. **AI use:** investigation, diagnostic patch and this text written with Claude (Anthropic) under my review; all numbers come from runs on my machine.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:59 +00:00
Author
Owner

@⁠Rednaxeh on GitHub · 2026-11-24 14:20 UTC · original

A data point from RDNA3 (RX 7800 XT 16 GB, driver 32.0.32029.2010, Windows 11 26300, release, main 930e8b4, no local changes), from thread dumps rather than timing: in the same stage (world loading, presents at 0 from ~88 s until the watchdog at 114 s), the dumps at 90 s and 110 s show no title thread in vram::place_on_pages / CreateReservedResource. What they show is 4 title threads in pso_async::resolve_wait under set_pipeline_state, waiting for compute pipelines the AMD driver takes 14–23 s to build (details in #232), and 45 title threads in their own waits. So on this card, at least until the pipeline builds are out of the way, the creation cost you measured on the RX 6750 XT is not what holds the render thread; whether it comes after that I cannot see yet. I can time the creations here once a run gets past the builds, if that helps.

AI use: Claude Code (Claude Fable 5.1) read the dumps; the run was mine.

**@⁠Rednaxeh** on GitHub · 2026-11-24 14:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7134221530) A data point from RDNA3 (RX 7800 XT 16 GB, driver 32.0.32029.2010, Windows 11 26300, release, `main` `930e8b4`, no local changes), from thread dumps rather than timing: in the same stage (world loading, presents at 0 from ~88 s until the watchdog at 114 s), the dumps at 90 s and 110 s show **no title thread in `vram::place_on_pages` / `CreateReservedResource`**. What they show is 4 title threads in `pso_async::resolve_wait` under `set_pipeline_state`, waiting for compute pipelines the AMD driver takes 14–23 s to build (details in #232), and 45 title threads in their own waits. So on this card, at least until the pipeline builds are out of the way, the creation cost you measured on the RX 6750 XT is not what holds the render thread; whether it comes after that I cannot see yet. I can time the creations here once a run gets past the builds, if that helps. AI use: Claude Code (Claude Fable 5.1) read the dumps; the run was mine.
Author
Owner

@⁠zorde23 on GitHub · 2026-11-24 14:56 UTC · original

Thanks @⁠Rednaxeh, that matches what I see on the RX 6750 XT once I look at the end of the run instead of the start of the drop. Same title, main 930e8b4, release, RX 6750 XT (driver 32.0.21045.29003), 300 s runs with A pressed at 15–35 s; thread dumps with XCL_THREAD_DUMP_AT.

Two different things on this card:

  1. The stop before the watchdog is the compute pipeline wait. In three plain main runs the title stops submitting at 162–174 s (one short burst aside) and its watchdog fires at 190–201 s. Dumps at 176 and 183 s: 3, then 2 title threads in pso_async::resolve_wait (from set_pipeline_state and execute_indirect), other threads inside amdxc64 building. The compute pipelines built in the world stage take 13–37 s each in the driver here (up to 69 s for the first one).
  2. The fps drop at ~80–90 s is not. With the driver blob cache warm (134 compute pipelines from it, no build over 2 s between 90 and 150 s), the drop comes the same (presents per 10 s: ~300 → 83 → 3 → 2), and dumps at 90/100/110/120 s show no thread in resolve_wait: one title thread in dev_create_committed_resource under create_placed_resource_x, title_textures::refresh waiting on an upload fence or on 8 detile threads, and a thread inside a driver kernel call. Four dumps of one run are thin, but on this card they point back at texture creation and refresh on the title's threads, not at the builds; on a cold cache the builds come on top of it.

What gets further (one run each, so treat as indicative; XCL_PSO_PRELOAD=0 in both, since two runs with the preload hit ~53 GB of commit before the world):

  • XCL_PSO_WAIT_MS=50: no watchdog at ~200 s; it reaches 247 s. But it skips work from 159 s on (12.5k draws, 2k dispatches by 194 s), a Wait64BitValueX times out at 190 s, an upload fence stays pending 10 s, and the device is removed (0x887a0006) at 247 s.
  • #1273 + XCL_PSO_WAIT_MS=50: no 18 s submit stop at 160–180 s (it kept submitting), 275 s, then the same device removal (30k draws and 18k dispatches skipped by then).

So the budget trades the watchdog for a GPU hang a minute later, much like #1046 describes on NVIDIA. If timing the creations on your card helps once a run gets past the builds, I'd be glad to compare: here each creation was ~1 ms on the render thread in the earlier measurement.

AI use: Claude Code (Claude Opus 5.5) ran the runs on my PC through a launcher script, read the logs and dumps and wrote this comment; I checked it.

**@⁠zorde23** on GitHub · 2026-11-24 14:56 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7135204524) Thanks @⁠Rednaxeh, that matches what I see on the RX 6750 XT once I look at the end of the run instead of the start of the drop. Same title, `main` 930e8b4, release, RX 6750 XT (driver 32.0.21045.29003), 300 s runs with A pressed at 15–35 s; thread dumps with `XCL_THREAD_DUMP_AT`. **Two different things on this card:** 1. **The stop before the watchdog is the compute pipeline wait.** In three plain `main` runs the title stops submitting at 162–174 s (one short burst aside) and its watchdog fires at 190–201 s. Dumps at 176 and 183 s: 3, then 2 title threads in `pso_async::resolve_wait` (from `set_pipeline_state` and `execute_indirect`), other threads inside amdxc64 building. The compute pipelines built in the world stage take 13–37 s each in the driver here (up to 69 s for the first one). 2. **The fps drop at ~80–90 s is not.** With the driver blob cache warm (134 compute pipelines from it, no build over 2 s between 90 and 150 s), the drop comes the same (presents per 10 s: ~300 → 83 → 3 → 2), and dumps at 90/100/110/120 s show no thread in `resolve_wait`: one title thread in `dev_create_committed_resource` under `create_placed_resource_x`, `title_textures::refresh` waiting on an upload fence or on 8 detile threads, and a thread inside a driver kernel call. Four dumps of one run are thin, but on this card they point back at texture creation and refresh on the title's threads, not at the builds; on a cold cache the builds come on top of it. **What gets further** (one run each, so treat as indicative; `XCL_PSO_PRELOAD=0` in both, since two runs with the preload hit ~53 GB of commit before the world): - `XCL_PSO_WAIT_MS=50`: no watchdog at ~200 s; it reaches 247 s. But it skips work from 159 s on (12.5k draws, 2k dispatches by 194 s), a `Wait64BitValueX` times out at 190 s, an upload fence stays pending 10 s, and the device is removed (0x887a0006) at 247 s. - #1273 + `XCL_PSO_WAIT_MS=50`: no 18 s submit stop at 160–180 s (it kept submitting), 275 s, then the same device removal (30k draws and 18k dispatches skipped by then). So the budget trades the watchdog for a GPU hang a minute later, much like #1046 describes on NVIDIA. If timing the creations on your card helps once a run gets past the builds, I'd be glad to compare: here each creation was ~1 ms on the render thread in the earlier measurement. AI use: Claude Code (Claude Opus 5.5) ran the runs on my PC through a launcher script, read the logs and dumps and wrote this comment; I checked it.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 15:37 UTC · original

A data point from RDNA4, which the thread does not have yet (Rednaxeh is on RDNA3, zorde23 on an RX 6750 XT, RDNA2): AMD Radeon RX 9070 XT 16 GB (gfx1201, wave64 + mesh), driver 32.0.32029.2010, Ryzen 7 9700X, 31 GB, Windows 11 Pro 26300, release, main 930e8b4, no local changes, default XCL_PSO_PRELOAD. A pressed every 8 s from 20 s, XCL_ACTIVITY=1. Three runs, one of them on the head of #1300 (main plus one log line, so not a different build in any way that matters here).

Presents per 10 s, and DirectStorage next to them (activity (2 s) summed; only the windows that move are listed):

run steady fold recovery 0 presented from abort
1 (frame dump on) 300 to 100 s 252 (100–110) → 34 → 32 (110–130) 116 (130–140) → 27 (140–150) 150 s 177.4 s
2 300 to 50 s 87 (50–60) → 76 → 134 → 14 (80–90) none 90 s 111.7 s
3 (#1300 head) 300 to 50 s 139 (50–60) → 27 → 130 → 29 (80–90) none 90 s 114.6 s

DirectStorage appears only inside those windows: run 1 5 675 req / 493 MB at 100–110 s and 5 712 / 207 MB at 120–130 s (0 otherwise, before and after); runs 2 and 3 4 071 / 411 MB and 6 645 / 260 MB at 60–70 s, again 0 afterwards. Peak within a single 2 s window: 5 091 req / 571 MB, 13 239 / 707 MB, 7 688 / 830 MB. 0 failed in every window of all three runs.

What I take from it, on this card:

  1. The fold starts with the biggest streaming burst of the run, not at a fixed time — 50–70 s in two runs, 100–110 s in the third, same binary, same script. And it starts before the long compute builds rather than during them: the slow ones (6–22 s of build time per 2 s window — 14.9 s / 520 500 B DXIL in run 2 at 112 s, 17.2 s / 360 936 B in run 1 at 168 s, 13.5 s / 522 380 B in run 3 at 110 s) land in the 82–114 s windows of runs 2 and 3 and the 140–180 s windows of run 1, after presentation has already collapsed. So on RDNA4 the stop does not look like resolve_wait first: something on the streaming/creation side stops the submits, and the builds afterwards have nothing left to hold up.
  2. Nothing is waiting on a fence that gives up: frame-event waits do happen (up to 121 per window), but timed out is 0 in all 207 windows of all three runs. No 0x887a0006, no device removal, fallback_pipelines 0.
  3. The fault comes 29 s after the title's last present, whatever time the fold happened: run 1 last presented 146–148 s → abort 177.4 s (29.4 s); run 2 80–82 s → 111.7 s (29.7 s); run 3 84–86 s → 114.6 s (28.6 s). That regularity is the most reproducible thing I have, and it is the same 0xc0000005 write at 0x0 in game_scarlett_master.exe+0x23cf683 every time. If that ~29 s is a fixed wait inside the title (a fence, an upload or a streaming request that never completes, then a write through a null result), it would be worth instrumenting next — it is the only thing that has held across every run here, and it does not depend on when streaming starts.
  4. The recovery in run 1 (116 presents at 130–140 s, right as the second burst ends, then 27 at 140–150 s) is why I would not call the stop a cliff: on this card the title can still present after it.
  5. In the 0-present stretch the title is not asleep: submits trickle 0–8 per 2 s and dispatches 3–149 per 2 s right up to the abort (run 3: 1–9 dispatches per 2 s throughout, with a draw every other window), with whole 6 s stretches of nothing in run 1 (164–170 s) followed by a burst. That reads like a retry loop rather than one blocked wait, which is consistent with the 29 s in point 3 being a timeout inside the title.

What I cannot answer yet, and a question for Rednaxeh: whether the render thread sits in vram::place_on_pages / dev_create_committed_resource here. XCL_THREAD_DUMP_AT gives me module+offset frames (xcl.exe+0x4e8ec4, inside this 6.8 MB image, so plausible offsets), but nothing resolves them: llvm-symbolizer from ROCm 6.4, ROCm 6.2 and MSVC 2022 all answer ??:0:0 for addresses dumpbin confirms are in xcl.exe, and through dbghelp I get mainCRTStartup (a public symbol) but no Rust function, with symbol enumeration returning nothing else — the xcl.pdb beside the release exe looks publics-only to both. How did you symbolize yours — a debug build, or does the dump print names for you already?

If you can post the timing patch you used on the 6750 XT (#1268's ~1 ms per creation), I will run it on this card against run 3's shape: the fold here happens on a run with 0 failed DirectStorage and before the long builds, which is the window you said you could not see past.

AI use: Claude Code ran the three runs on my PC, extracted the timelines and wrote this; I checked the numbers against the logs. No game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7136331129) A data point from **RDNA4**, which the thread does not have yet (Rednaxeh is on RDNA3, zorde23 on an RX 6750 XT, RDNA2): AMD Radeon RX 9070 XT 16 GB (gfx1201, wave64 + mesh), driver 32.0.32029.2010, Ryzen 7 9700X, 31 GB, Windows 11 Pro 26300, release, `main` `930e8b4`, no local changes, default `XCL_PSO_PRELOAD`. A pressed every 8 s from 20 s, `XCL_ACTIVITY=1`. Three runs, one of them on the head of #1300 (main plus one log line, so not a different build in any way that matters here). **Presents per 10 s, and DirectStorage next to them** (`activity (2 s)` summed; only the windows that move are listed): | run | steady | fold | recovery | 0 presented from | abort | |---|---|---|---|---|---| | 1 (frame dump on) | 300 to 100 s | 252 (100–110) → 34 → 32 (110–130) | 116 (130–140) → 27 (140–150) | 150 s | 177.4 s | | 2 | 300 to 50 s | 87 (50–60) → 76 → 134 → 14 (80–90) | none | 90 s | 111.7 s | | 3 (#1300 head) | 300 to 50 s | 139 (50–60) → 27 → 130 → 29 (80–90) | none | 90 s | 114.6 s | DirectStorage appears **only inside those windows**: run 1 5 675 req / 493 MB at 100–110 s and 5 712 / 207 MB at 120–130 s (0 otherwise, before and after); runs 2 and 3 4 071 / 411 MB and 6 645 / 260 MB at 60–70 s, again 0 afterwards. Peak within a single 2 s window: 5 091 req / 571 MB, 13 239 / 707 MB, 7 688 / 830 MB. `0 failed` in every window of all three runs. What I take from it, on this card: 1. **The fold starts with the biggest streaming burst of the run, not at a fixed time** — 50–70 s in two runs, 100–110 s in the third, same binary, same script. And it starts *before* the long compute builds rather than during them: the slow ones (6–22 s of build time per 2 s window — 14.9 s / 520 500 B DXIL in run 2 at 112 s, 17.2 s / 360 936 B in run 1 at 168 s, 13.5 s / 522 380 B in run 3 at 110 s) land in the 82–114 s windows of runs 2 and 3 and the 140–180 s windows of run 1, after presentation has already collapsed. So on RDNA4 the stop does not look like `resolve_wait` first: something on the streaming/creation side stops the submits, and the builds afterwards have nothing left to hold up. 2. **Nothing is waiting on a fence that gives up**: frame-event waits do happen (up to 121 per window), but `timed out` is **0 in all 207 windows** of all three runs. No `0x887a0006`, no device removal, `fallback_pipelines` 0. 3. **The fault comes 29 s after the title's last present, whatever time the fold happened**: run 1 last presented 146–148 s → abort 177.4 s (29.4 s); run 2 80–82 s → 111.7 s (29.7 s); run 3 84–86 s → 114.6 s (28.6 s). That regularity is the most reproducible thing I have, and it is the same `0xc0000005` write at `0x0` in `game_scarlett_master.exe+0x23cf683` every time. If that ~29 s is a fixed wait inside the title (a fence, an upload or a streaming request that never completes, then a write through a null result), it would be worth instrumenting next — it is the only thing that has held across every run here, and it does not depend on when streaming starts. 4. The recovery in run 1 (116 presents at 130–140 s, right as the second burst ends, then 27 at 140–150 s) is why I would not call the stop a cliff: on this card the title can still present after it. 5. **In the 0-present stretch the title is not asleep**: submits trickle 0–8 per 2 s and dispatches 3–149 per 2 s right up to the abort (run 3: 1–9 dispatches per 2 s throughout, with a draw every other window), with whole 6 s stretches of nothing in run 1 (164–170 s) followed by a burst. That reads like a retry loop rather than one blocked wait, which is consistent with the 29 s in point 3 being a timeout inside the title. **What I cannot answer yet, and a question for Rednaxeh:** whether the render thread sits in `vram::place_on_pages` / `dev_create_committed_resource` here. `XCL_THREAD_DUMP_AT` gives me `module+offset` frames (`xcl.exe+0x4e8ec4`, inside this 6.8 MB image, so plausible offsets), but nothing resolves them: `llvm-symbolizer` from ROCm 6.4, ROCm 6.2 and MSVC 2022 all answer `??:0:0` for addresses `dumpbin` confirms are in `xcl.exe`, and through `dbghelp` I get `mainCRTStartup` (a public symbol) but no Rust function, with symbol enumeration returning nothing else — the `xcl.pdb` beside the release exe looks publics-only to both. How did you symbolize yours — a debug build, or does the dump print names for you already? If you can post the timing patch you used on the 6750 XT (#1268's ~1 ms per creation), I will run it on this card against run 3's shape: the fold here happens on a run with `0 failed` DirectStorage and before the long builds, which is the window you said you could not see past. AI use: Claude Code ran the three runs on my PC, extracted the timelines and wrote this; I checked the numbers against the logs. No game data is included.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 16:03 UTC · original

Symbolization works on a release build too, so here are dump results from a card with the same wall — 9070 XT (RDNA4), main 930e8b4.

Reading the dumps. xcl.exe+0x… is an RVA from the preferred base; SymFromAddr(base + 0x140000000, RVA) against the xcl.pdb of the same build resolves it in release too (xcl::hle::d3d12x::present::present_now+0x15df). The PDB must come from the run that made the dump — a rebuild shifts every offset and old dumps all come back ?. Read the dumps from xcl.log, not from a Start-Process -RedirectStandardError capture: that capture breaks long lines mid-token (xcl.exe+0x / x7ee4c), which reads like truncated frames.

Run F, defaults. Presents per 2 s window, with the DirectStorage rate of the same window:

  0-50 s   60 presents/2 s,  no DirectStorage
  52 s     43            3 764 req/ 156 MB   <- burst starts
  54 s     53           10 848 req/ 976 MB
  56-62 s  14, 3, 2, 0   4 995 / 1 620 / 4 861 req
  66-82 s  5 … 39 … 20   DirectStorage kept running
  84 s      1 present, 7 202 frame-event waits in 2 s (0 timed out)
  86-112 s  0 presents, 0 submits, 0 DirectStorage
 112.593 s  0xc0000005, write at 0x0, game_scarlett_master.exe+0x23cf683

The fold is the DirectStorage burst again, and the crash is 28.6 s after the last presented frame (84 s).

In the dumps (101 threads at 55.0 s and 70.1 s, 133 at 85.1/100.1/113.6 s; 601 thread records): no place_on_pages, create_placed_resource(_x), dev_create_committed_resource, resolve_wait, CreateReservedResource, evict or detile anywhere. Creation is not on a single stack here either.

What is there:

  • 70.1 s, mid-dip, the only XCL thread not waiting: present_now → dxgi flip Present → the queue's ExecuteCommandLists → title_textures::refresh → take_written → a kernel call (the GetWriteWatch). refresh runs at the top of every ExecuteCommandLists (real.rs:5209) under REFRESH, over the watched ranges, so every flip present pays for it.
  • 85.1–113.6 s, zero presents: 133 threads, 15 xcl-dxc-* + 15 xcl-pso-* (+3 xcl-pso-pre-*), 14 pso + 13 dxc of them in Mutex::lock_contended on the build queue's receiver (idle workers; std::mpsc has one consumer, so they contend instead of parking — not the stall), and 1–3 threads entirely in amdxc64.dll frames.
  • The expensive builds land after the last present: 88.8 s 4.3 s / 94.1 s 3.3 s / 97.5 s 10.0 s / 104.5 s 4.3 s / 110.3 s 3.9 s, 193–523 KB DXIL each, 271 builds in the run. The pool only grows 101 → 133 threads after the fold.

So the order is: burst → presents fall while the present path sits in the write-watch → the build storm fills the 28 s until the abort.

Run H, XCL_PSO_PRELOAD=0, nothing else changed: the same fold at 52 s (6 763 req/754 MB, then 8 540/438 MB), presents 57 → 5, last present 82 s, crash at ~111 s — 29 s later, same address. Turning preload off does not move it here, unlike on @⁠zorde23's card.

Run G, XCL_ASYNC_PSO=0: no fold and no crash in 322 s (7 721 presents, steady 30 fps) — but the title never leaves the loading screen: 0 dispatches, 0 DirectStorage after 64 s, and 26 synchronous builds on its own thread of 0.4–1.4 MB DXIL taking 20–100 s each (largest 1 380 404 B in 99.6 s). That dial "gets further" by not getting anywhere, so it does not separate the build path from the stall.

Two questions that would pin the rest down: does title_textures::refresh / take_written appear on your stacks if you dump at 56 and 60 s, i.e. inside the dip before any xcl-pso-* thread exists? And is the 29 s a wait of the title's own — it now holds at last-present + 28.6 s and +29.5 s on two runs with different fold times and different preload settings, which looks like a fixed timeout rather than a consequence of the builds finishing.

AI use: Claude Code No game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 16:03 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7137058496) Symbolization works on a release build too, so here are dump results from a card with the same wall — 9070 XT (RDNA4), main `930e8b4`. **Reading the dumps.** `xcl.exe+0x…` is an RVA from the preferred base; `SymFromAddr(base + 0x140000000, RVA)` against the `xcl.pdb` of the *same* build resolves it in release too (`xcl::hle::d3d12x::present::present_now+0x15df`). The PDB must come from the run that made the dump — a rebuild shifts every offset and old dumps all come back `?`. Read the dumps from `xcl.log`, not from a `Start-Process -RedirectStandardError` capture: that capture breaks long lines mid-token (`xcl.exe+0x` / `x7ee4c`), which reads like truncated frames. **Run F, defaults.** Presents per 2 s window, with the DirectStorage rate of the same window: ``` 0-50 s 60 presents/2 s, no DirectStorage 52 s 43 3 764 req/ 156 MB <- burst starts 54 s 53 10 848 req/ 976 MB 56-62 s 14, 3, 2, 0 4 995 / 1 620 / 4 861 req 66-82 s 5 … 39 … 20 DirectStorage kept running 84 s 1 present, 7 202 frame-event waits in 2 s (0 timed out) 86-112 s 0 presents, 0 submits, 0 DirectStorage 112.593 s 0xc0000005, write at 0x0, game_scarlett_master.exe+0x23cf683 ``` The fold is the DirectStorage burst again, and the crash is 28.6 s after the last presented frame (84 s). **In the dumps** (101 threads at 55.0 s and 70.1 s, 133 at 85.1/100.1/113.6 s; 601 thread records): no `place_on_pages`, `create_placed_resource(_x)`, `dev_create_committed_resource`, `resolve_wait`, `CreateReservedResource`, `evict` or `detile` anywhere. Creation is not on a single stack here either. What is there: - 70.1 s, mid-dip, the only XCL thread not waiting: `present_now` → dxgi flip `Present` → the queue's `ExecuteCommandLists` → `title_textures::refresh` → `take_written` → a kernel call (the `GetWriteWatch`). `refresh` runs at the top of every `ExecuteCommandLists` (`real.rs:5209`) under `REFRESH`, over the watched ranges, so every flip present pays for it. - 85.1–113.6 s, zero presents: 133 threads, 15 `xcl-dxc-*` + 15 `xcl-pso-*` (+3 `xcl-pso-pre-*`), 14 pso + 13 dxc of them in `Mutex::lock_contended` on the build queue's receiver (idle workers; `std::mpsc` has one consumer, so they contend instead of parking — not the stall), and 1–3 threads entirely in `amdxc64.dll` frames. - The expensive builds land *after* the last present: 88.8 s 4.3 s / 94.1 s 3.3 s / 97.5 s 10.0 s / 104.5 s 4.3 s / 110.3 s 3.9 s, 193–523 KB DXIL each, 271 builds in the run. The pool only grows 101 → 133 threads after the fold. So the order is: burst → presents fall while the present path sits in the write-watch → the build storm fills the 28 s until the abort. **Run H, `XCL_PSO_PRELOAD=0`, nothing else changed:** the same fold at 52 s (6 763 req/754 MB, then 8 540/438 MB), presents 57 → 5, last present 82 s, crash at ~111 s — 29 s later, same address. Turning preload off does not move it here, unlike on @⁠zorde23's card. **Run G, `XCL_ASYNC_PSO=0`:** no fold and no crash in 322 s (7 721 presents, steady 30 fps) — but the title never leaves the loading screen: 0 dispatches, 0 DirectStorage after 64 s, and 26 synchronous builds on its own thread of 0.4–1.4 MB DXIL taking 20–100 s each (largest 1 380 404 B in 99.6 s). That dial "gets further" by not getting anywhere, so it does not separate the build path from the stall. Two questions that would pin the rest down: does `title_textures::refresh` / `take_written` appear on your stacks if you dump at 56 and 60 s, i.e. inside the dip before any `xcl-pso-*` thread exists? And is the 29 s a wait of the title's own — it now holds at last-present + 28.6 s and +29.5 s on two runs with different fold times and different preload settings, which looks like a fixed timeout rather than a consequence of the builds finishing. AI use: Claude Code No game data is included.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 16:35 UTC · original

The process's commit charge is what runs out, and it is not in anything XCL accounts for (9070 XT, main 930e8b4, defaults)

Following the dumps above, here is what the process's memory did in a run on the same card. The numbers are the memory: line that XCL_ACTIVITY=1 writes every 2 s (host.rs:65, PROCESS_MEMORY_COUNTERS_EX::PrivateUsage, which is commit charge):

 t=2.00    6 003 MB      t=58.06   95 343 MB
 t=10.02  13 387 MB      t=62.08   99 916 MB   peak
 t=18.02  19 958 MB      t=66.08   99 506 MB   plateau
 t=26.03  37 410 MB      t=98.12   99 506 MB
 t=34.04  53 999 MB      t=218.26  99 471 MB
 t=42.05  70 336 MB      t=250.30  95 107 MB   slowly decaying
 t=50.05  82 660 MB      t=318.39  94 508 MB

Up to ~4 GB of new commit every 2 s at ~30 fps: about 65 MB per frame, 270 KB per draw.

It is not in any pool xcl reports. The same lines carry: target pages 3 604 MB (pools 3 648 MB), arenas 311 MB in use / 311 MB made, sparse pools 7 445 MB of which 837 MB mapped - 11 GB in total, and all of them flat from t18 s. Video memory is flat as well (6 403 MB local, 4 707 MB non-local) while the commit climbs. And it is not host memory being paged out: the pagefile in use is 2.6 GB (peak 8 440 MB since boot) and the working set stayed at 9 373 MB against 94 464 MB private.

So ~88 GB of that commit is memory no xcl pool reports. WDDM charges a video allocation against the system commit limit even when it lives in VRAM, which fits those three facts (commit up, VRAM counters and pagefile flat).

Why this is the thing to fix next. The commit limit on this machine is 103.1 GB (31.1 GB RAM and a 72 GB pagefile). At the plateau xcl holds 99.5 GB of it, which leaves ~3.6 GB for Windows and every other process:

  • two other processes on the machine failed an allocation and died while that run was live (my editor, twice), with no reboot in the System log (no Kernel-Power 41, no BugCheck 1001);
  • a run of the same build that carried a per-list timing patch ended at t=60.7 s with memory allocation of 25834 bytes failed from xcl's own allocator, while the commit was still climbing.

That is the same shape as game_scarlett_master.exe+0x23cf683 writing to 0x0 28.6 s after the last present: with the process a few percent under the commit limit, an allocation inside the title fails and the null dereference follows. It does not need the fold to happen; it needs the commit to run out. That may also be why the 29 s is fixed across two runs with different fold times - a watchdog on a failing allocation looks like a fixed timeout.

Where the 88 GB may come from, and how to confirm it. The subject of this issue is the path that would explain it: one PC resource per streamed texture placement, with "the title releases almost none of these textures (0-40 per 2 s)". If the resources stay, the commit they carry stays. I have not proved that, so the next probe is log-only and does not touch the submit path: a VirtualQuery walk over the address space every 2 s, grouping committed regions by size and protection, next to byte counters per owner (vram reserved resources, sparse tile mappings, title_textures CPU copies, console_list::pending_blocks). One run names the owner.

One warning for anyone reproducing it: this is a machine hazard, not only a title stall. Check Get-Process xcl | Select PrivateMemorySize64 during a run, and verify a kill with Get-Process - a Start-Process object's .Kill() did not take here once and the run continued for another 180 s at 94 GB.

It is not GPU execution time. A local per-list probe (each list of a submission submitted alone, waited on, lists that take time logged with their draws and dispatches) measured every command list at 0 ms in the 30 fps phase of this run, so the dips are not the GPU working through the lists.

Run shape, so this is not mistaken for a fold reproduction. With defaults but without XCL_PRESS_A_AT, this run never crashed: 60 presents per 2 s to ~60 s, dips of 7 and 9 presents/2 s at 84 and 100 s, then mostly 0-2 presents per 2 s from ~170 s to ~260 s (with bursts of 25-29 at 212 s and 264 s) and 15-30 per 2 s after that. There was no DirectStorage burst after 12 s, so the fold of Run F never came; 3 000 frames were presented and it was still holding 94.5 GB when I stopped it at 318 s. Same card and driver as the dumps above, so the crash needs that state and the commit growth does not.

Setup: RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9700X, 31.1 GB RAM, Windows 11 26200, release build, XCL_NETWORK=0, XCL_ACTIVITY=1, no other knob.

AI use: Claude (Anthropic) wrote this text and the diagnostics under my review; every number is from a run on my machine. No game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 16:35 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7137904417) **The process's commit charge is what runs out, and it is not in anything XCL accounts for** (9070 XT, main `930e8b4`, defaults) Following the dumps above, here is what the process's memory did in a run on the same card. The numbers are the `memory:` line that `XCL_ACTIVITY=1` writes every 2 s (`host.rs:65`, `PROCESS_MEMORY_COUNTERS_EX::PrivateUsage`, which is commit charge): ``` t=2.00 6 003 MB t=58.06 95 343 MB t=10.02 13 387 MB t=62.08 99 916 MB peak t=18.02 19 958 MB t=66.08 99 506 MB plateau t=26.03 37 410 MB t=98.12 99 506 MB t=34.04 53 999 MB t=218.26 99 471 MB t=42.05 70 336 MB t=250.30 95 107 MB slowly decaying t=50.05 82 660 MB t=318.39 94 508 MB ``` Up to ~4 GB of new commit every 2 s at ~30 fps: about 65 MB per frame, 270 KB per draw. **It is not in any pool xcl reports.** The same lines carry: target pages 3 604 MB (pools 3 648 MB), arenas 311 MB in use / 311 MB made, sparse pools 7 445 MB of which 837 MB mapped - ~11 GB in total, and all of them flat from t~18 s. Video memory is flat as well (6 403 MB local, 4 707 MB non-local) while the commit climbs. And it is not host memory being paged out: the pagefile in use is 2.6 GB (peak 8 440 MB since boot) and the working set stayed at 9 373 MB against 94 464 MB private. So ~88 GB of that commit is memory no xcl pool reports. WDDM charges a video allocation against the system commit limit even when it lives in VRAM, which fits those three facts (commit up, VRAM counters and pagefile flat). **Why this is the thing to fix next.** The commit limit on this machine is 103.1 GB (31.1 GB RAM and a 72 GB pagefile). At the plateau xcl holds 99.5 GB of it, which leaves ~3.6 GB for Windows and every other process: - two other processes on the machine failed an allocation and died while that run was live (my editor, twice), with no reboot in the System log (no Kernel-Power 41, no BugCheck 1001); - a run of the same build that carried a per-list timing patch ended at t=60.7 s with `memory allocation of 25834 bytes failed` from xcl's own allocator, while the commit was still climbing. That is the same shape as `game_scarlett_master.exe+0x23cf683` writing to 0x0 28.6 s after the last present: with the process a few percent under the commit limit, an allocation inside the title fails and the null dereference follows. It does not need the fold to happen; it needs the commit to run out. That may also be why the 29 s is fixed across two runs with different fold times - a watchdog on a failing allocation looks like a fixed timeout. **Where the 88 GB may come from, and how to confirm it.** The subject of this issue is the path that would explain it: one PC resource per streamed texture placement, with "the title releases almost none of these textures (0-40 per 2 s)". If the resources stay, the commit they carry stays. I have not proved that, so the next probe is log-only and does not touch the submit path: a `VirtualQuery` walk over the address space every 2 s, grouping committed regions by size and protection, next to byte counters per owner (`vram` reserved resources, `sparse` tile mappings, `title_textures` CPU copies, `console_list::pending_blocks`). One run names the owner. One warning for anyone reproducing it: this is a machine hazard, not only a title stall. Check `Get-Process xcl | Select PrivateMemorySize64` during a run, and verify a kill with `Get-Process` - a `Start-Process` object's `.Kill()` did not take here once and the run continued for another 180 s at 94 GB. **It is not GPU execution time.** A local per-list probe (each list of a submission submitted alone, waited on, lists that take time logged with their draws and dispatches) measured every command list at 0 ms in the 30 fps phase of this run, so the dips are not the GPU working through the lists. **Run shape, so this is not mistaken for a fold reproduction.** With defaults but without `XCL_PRESS_A_AT`, this run never crashed: 60 presents per 2 s to ~60 s, dips of 7 and 9 presents/2 s at 84 and 100 s, then mostly 0-2 presents per 2 s from ~170 s to ~260 s (with bursts of 25-29 at 212 s and 264 s) and 15-30 per 2 s after that. There was no DirectStorage burst after 12 s, so the fold of Run F never came; 3 000 frames were presented and it was still holding 94.5 GB when I stopped it at 318 s. Same card and driver as the dumps above, so the crash needs that state and the commit growth does not. Setup: RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9700X, 31.1 GB RAM, Windows 11 26200, release build, `XCL_NETWORK=0`, `XCL_ACTIVITY=1`, no other knob. AI use: Claude (Anthropic) wrote this text and the diagnostics under my review; every number is from a run on my machine. No game data is included.
Author
Owner

@⁠zorde23 on GitHub · 2026-11-24 17:41 UTC · original

@⁠tugasky here is the timing patch from the RX 6750 XT runs, rebased on current main (included below). It is diagnostic only, not meant for merge.

Base: b7aa9f3 (main, 24 Nov).

Apply from the repo root:

git checkout b7aa9f3
git apply medicao.patch   # the diff below, saved to a file
cargo build --release

Run with XCL_ACTIVITY=1; nothing changes without it. Every 2 s the log gets a timing (2 s) line next to the usual activity (2 s) line:

timing (2 s): place_pages <calls>/<ms>ms, committed ..., register ..., pages_lock ..., reserved ..., bind ..., tile_map ..., create_heap ..., exec_lock ..., exec_wait ..., place_gpu ...

Reading it: each entry is calls / total ms of that step in the last 2 s, summed over all threads; per-call cost is ms ÷ calls.

  • reserved: CreateReservedResource for each streamed texture (~1 ms per call on the 6750 XT).
  • tile_map: UpdateTileMappings of those textures; create_heap: new page heaps. Both are inside bind.
  • place_pages / place_gpu: the whole per-texture path; each includes pages_lock + reserved + bind. Don't add the columns up.
  • register: XCL's bookkeeping after a texture is created. committed: textures that fell back to committed resources.
  • pages_lock / exec_lock: time waiting for XCL's page lock while creating a texture / before a submit. A high exec_lock means submits were blocked behind texture creation.
  • exec_wait: only the CPU cost of queueing the fence wait before a submit, not the GPU wait.

The useful windows are the ones where presents in the activity line drop: compare reserved and tile_map there with the windows before the drop.

medicao.patch
diff --git a/crates/xcl/src/hle/d3d12x/device_x.rs b/crates/xcl/src/hle/d3d12x/device_x.rs
index 4b6d32a..997b8b7 100644
--- a/crates/xcl/src/hle/d3d12x/device_x.rs
+++ b/crates/xcl/src/hle/d3d12x/device_x.rs
@@ -907,7 +907,7 @@ pub(super) unsafe extern "system" fn create_placed_resource_x(this: *mut c_void,
         let pc = std::ptr::read_unaligned(d.as_ptr() as *const D3D12_RESOURCE_DESC);
         let console_bytes = crate::hle::xg::Texture::new(&x).ok().map(|t| t.size()).filter(|&s| s != u64::MAX && s != 0);
         if super::vram::gpu_owned(flags) {
-            if let Some(hr) = super::vram::place(this, va as usize, &pc, state, clear, console_bytes, riid, ppv) {
+            if let Some(hr) = super::vram::timing::t(10, || super::vram::place(this, va as usize, &pc, state, clear, console_bytes, riid, ppv)) {
                 if hr >= 0 && !(*ppv).is_null() {
                     if let Some(bytes) = console_bytes {
                         super::title_textures::retire_overlapping(va as usize, bytes as usize);
@@ -917,19 +917,19 @@ pub(super) unsafe extern "system" fn create_placed_resource_x(this: *mut c_void,
                 return hr;
             }
         } else {
-            placed_hr = super::vram::place_pages(this, va as usize, &pc, state, clear, console_bytes, riid, ppv);
+            placed_hr = super::vram::timing::t(0, || super::vram::place_pages(this, va as usize, &pc, state, clear, console_bytes, riid, ppv));
         }
     }
     let hr = match placed_hr {
         Some(hr) => hr,
         None => {
             let heap = D3D12_HEAP_PROPERTIES { Type: D3D12_HEAP_TYPE_DEFAULT, ..Default::default() };
-            real::dev_create_committed_resource(this, &heap as *const _ as usize, 0, d.as_ptr() as usize, state as usize, clear as usize, riid, ppv)
+            super::vram::timing::t(1, || real::dev_create_committed_resource(this, &heap as *const _ as usize, 0, d.as_ptr() as usize, state as usize, clear as usize, riid, ppv))
         }
     };
     if hr >= 0 && !buffer && !(*ppv).is_null() {
         static M: AtomicU64 = AtomicU64::new(0);
-        match super::title_textures::register(this, *ppv, va as usize, &x, D3D12_RESOURCE_STATES(state as i32)) {
+        match super::vram::timing::t(2, || super::title_textures::register(this, *ppv, va as usize, &x, D3D12_RESOURCE_STATES(state as i32))) {
             Ok(()) => {
                 real::note_title_address(*ppv as usize, va as usize);
                 return hr;
diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs
index 040d78a..dfb2e0f 100644
--- a/crates/xcl/src/hle/d3d12x/vram.rs
+++ b/crates/xcl/src/hle/d3d12x/vram.rs
@@ -296,7 +296,7 @@ impl Pages {
             Flags: D3D12_HEAP_FLAG_NONE,
         };
         let mut heap: Option<ID3D12Heap> = None;
-        if let Err(e) = super::title_textures::own_work(|| dev.CreateHeap(&desc, &mut heap)) {
+        if let Err(e) = timing::t(7, || super::title_textures::own_work(|| dev.CreateHeap(&desc, &mut heap))) {
             crate::xlog_warn!("D3D12.X: no video memory for more pages of title textures ({e})");
             return None;
         }
@@ -318,18 +318,7 @@ impl Pages {
             let counts: Vec<u32> = ranges.iter().map(|r| r.2).collect();
             let coord = D3D12_TILED_RESOURCE_COORDINATE::default();
             let region = D3D12_TILE_REGION_SIZE { NumTiles: tiles.len() as u32, UseBox: false.into(), ..Default::default() };
-            self.queue.UpdateTileMappings(
-                res,
-                1,
-                Some(&coord),
-                Some(&region),
-                &self.pools[h as usize],
-                ranges.len() as u32,
-                Some(flags.as_ptr()),
-                Some(offsets.as_ptr()),
-                Some(counts.as_ptr()),
-                D3D12_TILE_MAPPING_FLAG_NONE,
-            );
+            timing::t(6, || self.queue.UpdateTileMappings(res, 1, Some(&coord), Some(&region), &self.pools[h as usize], ranges.len() as u32, Some(flags.as_ptr()), Some(offsets.as_ptr()), Some(counts.as_ptr()), D3D12_TILE_MAPPING_FLAG_NONE));
         }
         self.value += 1;
         let _ = self.queue.Signal(&self.fence, self.value);
@@ -536,9 +525,9 @@ unsafe fn place_on_pages(
         log("no tiled support for its format or sample count");
         return None;
     }
-    let mut g = PAGES.lock().unwrap();
+    let mut g = timing::t(3, || PAGES.lock().unwrap());
     let pages = g.entry(dev.as_raw() as usize).or_insert_with(|| Pages::new(dev)).as_mut()?;
-    let hr = super::real::dev_create_reserved_resource(this, &tiled as *const _ as usize, state as usize, clear as usize, riid, ppv);
+    let hr = timing::t(4, || super::real::dev_create_reserved_resource(this, &tiled as *const _ as usize, state as usize, clear as usize, riid, ppv));
     if hr < 0 || (*ppv).is_null() {
         log(&format!("{hr:#x}"));
         return None;
@@ -547,7 +536,7 @@ unsafe fn place_on_pages(
     let res = ID3D12Resource::from_raw_borrowed(&raw)?;
     let mut total = 0u32;
     dev.GetResourceTiling(res, Some(&mut total), None, None, None, 0, std::ptr::null_mut());
-    let Some((used, used_extra)) = pages.bind(dev, res, va, console_bytes, total) else {
+    let Some((used, used_extra)) = timing::t(5, || pages.bind(dev, res, va, console_bytes, total)) else {
         drop(g);
         drop(windows::core::IUnknown::from_raw(raw));
         *ppv = std::ptr::null_mut();
@@ -627,15 +616,36 @@ pub(super) unsafe fn before_execute(queue: &ID3D12CommandQueue) {
         return;
     }
     let Some(dev) = dev else { return };
-    let mut g = PAGES.lock().unwrap();
+    let mut g = timing::t(8, || PAGES.lock().unwrap());
     let Some(Some(pages)) = g.get_mut(&(dev.as_raw() as usize)) else { return };
     let key = queue.as_raw() as usize;
     if pages.waited.get(&key).copied().unwrap_or(0) < pages.value {
-        let _ = queue.Wait(&pages.fence, pages.value);
+        let _ = timing::t(9, || queue.Wait(&pages.fence, pages.value));
         pages.waited.insert(key, pages.value);
     }
 }
 
+/// diagnostic only (not for merge): calls and time of the texture-creation path, printed every 2 s with `XCL_ACTIVITY=1`
+pub mod timing {
+    use std::sync::atomic::{AtomicU64, Ordering};
+    // nested: place_pages and place_gpu include pages_lock + reserved + bind; bind includes create_heap + tile_map;
+    // exec_wait is only the CPU cost of queueing the fence wait, not the GPU wait
+    pub const NAMES: [&str; 11] =
+        ["place_pages", "committed", "register", "pages_lock", "reserved", "bind", "tile_map", "create_heap", "exec_lock", "exec_wait", "place_gpu"];
+    static NS: [AtomicU64; 11] = [const { AtomicU64::new(0) }; 11];
+    static CALLS: [AtomicU64; 11] = [const { AtomicU64::new(0) }; 11];
+    pub fn t<R>(i: usize, f: impl FnOnce() -> R) -> R {
+        let s = std::time::Instant::now();
+        let r = f();
+        NS[i].fetch_add(s.elapsed().as_nanos() as u64, Ordering::Relaxed);
+        CALLS[i].fetch_add(1, Ordering::Relaxed);
+        r
+    }
+    pub fn snap() -> [(u64, u64); 11] {
+        std::array::from_fn(|i| (CALLS[i].load(Ordering::Relaxed), NS[i].load(Ordering::Relaxed)))
+    }
+}
+
 #[cfg(test)]
 pub(super) static VRAM_TEST_LOCK: Mutex<()> = Mutex::new(());
 
diff --git a/crates/xcl/src/host.rs b/crates/xcl/src/host.rs
index ba5dcb4..f592f73 100644
--- a/crates/xcl/src/host.rs
+++ b/crates/xcl/src/host.rs
@@ -40,9 +40,19 @@ pub fn host_main(boot_path: &Path) -> i32 {
                 [p, e, d, x, f[0], f[1], f[2], f[3], r, b >> 20, fail]
             };
             let mut last = snap();
+            let mut last_t = crate::hle::d3d12x::vram::timing::snap();
             loop {
                 std::thread::sleep(std::time::Duration::from_secs(2));
                 let now = snap();
+                // diagnostic only: calls/ms of the texture-creation path in the last 2 s
+                let now_t = crate::hle::d3d12x::vram::timing::snap();
+                let parts: Vec<String> = crate::hle::d3d12x::vram::timing::NAMES
+                    .iter()
+                    .enumerate()
+                    .map(|(i, n)| format!("{n} {}/{:.1}ms", now_t[i].0 - last_t[i].0, (now_t[i].1 - last_t[i].1) as f64 / 1e6))
+                    .collect();
+                crate::xlog_info!("timing (2 s): {}", parts.join(", "));
+                last_t = now_t;
                 let d: Vec<u64> = now.iter().zip(last).map(|(a, b)| a - b).collect();
                 crate::xlog_info!(
                     "activity (2 s): {} presents, {} submits, {} draws, {} dispatches, {} frame-event waits ({} timed out), {} frame statistics ({} not flipped); DirectStorage {} requests, {} MB, {} failed",

Written with Claude Code from runs on this machine.

**@⁠zorde23** on GitHub · 2026-11-24 17:41 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7139557078) @⁠tugasky here is the timing patch from the RX 6750 XT runs, rebased on current `main` (included below). It is diagnostic only, not meant for merge. **Base:** `b7aa9f3` (main, 24 Nov). **Apply** from the repo root: ``` git checkout b7aa9f3 git apply medicao.patch # the diff below, saved to a file cargo build --release ``` **Run** with `XCL_ACTIVITY=1`; nothing changes without it. Every 2 s the log gets a `timing (2 s)` line next to the usual `activity (2 s)` line: ``` timing (2 s): place_pages <calls>/<ms>ms, committed ..., register ..., pages_lock ..., reserved ..., bind ..., tile_map ..., create_heap ..., exec_lock ..., exec_wait ..., place_gpu ... ``` **Reading it:** each entry is calls / total ms of that step in the last 2 s, summed over all threads; per-call cost is ms ÷ calls. - `reserved`: `CreateReservedResource` for each streamed texture (~1 ms per call on the 6750 XT). - `tile_map`: `UpdateTileMappings` of those textures; `create_heap`: new page heaps. Both are inside `bind`. - `place_pages` / `place_gpu`: the whole per-texture path; each includes `pages_lock` + `reserved` + `bind`. Don't add the columns up. - `register`: XCL's bookkeeping after a texture is created. `committed`: textures that fell back to committed resources. - `pages_lock` / `exec_lock`: time waiting for XCL's page lock while creating a texture / before a submit. A high `exec_lock` means submits were blocked behind texture creation. - `exec_wait`: only the CPU cost of queueing the fence wait before a submit, not the GPU wait. The useful windows are the ones where presents in the `activity` line drop: compare `reserved` and `tile_map` there with the windows before the drop. <details><summary>medicao.patch</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/device_x.rs b/crates/xcl/src/hle/d3d12x/device_x.rs index 4b6d32a..997b8b7 100644 --- a/crates/xcl/src/hle/d3d12x/device_x.rs +++ b/crates/xcl/src/hle/d3d12x/device_x.rs @@ -907,7 +907,7 @@ pub(super) unsafe extern "system" fn create_placed_resource_x(this: *mut c_void, let pc = std::ptr::read_unaligned(d.as_ptr() as *const D3D12_RESOURCE_DESC); let console_bytes = crate::hle::xg::Texture::new(&x).ok().map(|t| t.size()).filter(|&s| s != u64::MAX && s != 0); if super::vram::gpu_owned(flags) { - if let Some(hr) = super::vram::place(this, va as usize, &pc, state, clear, console_bytes, riid, ppv) { + if let Some(hr) = super::vram::timing::t(10, || super::vram::place(this, va as usize, &pc, state, clear, console_bytes, riid, ppv)) { if hr >= 0 && !(*ppv).is_null() { if let Some(bytes) = console_bytes { super::title_textures::retire_overlapping(va as usize, bytes as usize); @@ -917,19 +917,19 @@ pub(super) unsafe extern "system" fn create_placed_resource_x(this: *mut c_void, return hr; } } else { - placed_hr = super::vram::place_pages(this, va as usize, &pc, state, clear, console_bytes, riid, ppv); + placed_hr = super::vram::timing::t(0, || super::vram::place_pages(this, va as usize, &pc, state, clear, console_bytes, riid, ppv)); } } let hr = match placed_hr { Some(hr) => hr, None => { let heap = D3D12_HEAP_PROPERTIES { Type: D3D12_HEAP_TYPE_DEFAULT, ..Default::default() }; - real::dev_create_committed_resource(this, &heap as *const _ as usize, 0, d.as_ptr() as usize, state as usize, clear as usize, riid, ppv) + super::vram::timing::t(1, || real::dev_create_committed_resource(this, &heap as *const _ as usize, 0, d.as_ptr() as usize, state as usize, clear as usize, riid, ppv)) } }; if hr >= 0 && !buffer && !(*ppv).is_null() { static M: AtomicU64 = AtomicU64::new(0); - match super::title_textures::register(this, *ppv, va as usize, &x, D3D12_RESOURCE_STATES(state as i32)) { + match super::vram::timing::t(2, || super::title_textures::register(this, *ppv, va as usize, &x, D3D12_RESOURCE_STATES(state as i32))) { Ok(()) => { real::note_title_address(*ppv as usize, va as usize); return hr; diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs index 040d78a..dfb2e0f 100644 --- a/crates/xcl/src/hle/d3d12x/vram.rs +++ b/crates/xcl/src/hle/d3d12x/vram.rs @@ -296,7 +296,7 @@ impl Pages { Flags: D3D12_HEAP_FLAG_NONE, }; let mut heap: Option<ID3D12Heap> = None; - if let Err(e) = super::title_textures::own_work(|| dev.CreateHeap(&desc, &mut heap)) { + if let Err(e) = timing::t(7, || super::title_textures::own_work(|| dev.CreateHeap(&desc, &mut heap))) { crate::xlog_warn!("D3D12.X: no video memory for more pages of title textures ({e})"); return None; } @@ -318,18 +318,7 @@ impl Pages { let counts: Vec<u32> = ranges.iter().map(|r| r.2).collect(); let coord = D3D12_TILED_RESOURCE_COORDINATE::default(); let region = D3D12_TILE_REGION_SIZE { NumTiles: tiles.len() as u32, UseBox: false.into(), ..Default::default() }; - self.queue.UpdateTileMappings( - res, - 1, - Some(&coord), - Some(&region), - &self.pools[h as usize], - ranges.len() as u32, - Some(flags.as_ptr()), - Some(offsets.as_ptr()), - Some(counts.as_ptr()), - D3D12_TILE_MAPPING_FLAG_NONE, - ); + timing::t(6, || self.queue.UpdateTileMappings(res, 1, Some(&coord), Some(&region), &self.pools[h as usize], ranges.len() as u32, Some(flags.as_ptr()), Some(offsets.as_ptr()), Some(counts.as_ptr()), D3D12_TILE_MAPPING_FLAG_NONE)); } self.value += 1; let _ = self.queue.Signal(&self.fence, self.value); @@ -536,9 +525,9 @@ unsafe fn place_on_pages( log("no tiled support for its format or sample count"); return None; } - let mut g = PAGES.lock().unwrap(); + let mut g = timing::t(3, || PAGES.lock().unwrap()); let pages = g.entry(dev.as_raw() as usize).or_insert_with(|| Pages::new(dev)).as_mut()?; - let hr = super::real::dev_create_reserved_resource(this, &tiled as *const _ as usize, state as usize, clear as usize, riid, ppv); + let hr = timing::t(4, || super::real::dev_create_reserved_resource(this, &tiled as *const _ as usize, state as usize, clear as usize, riid, ppv)); if hr < 0 || (*ppv).is_null() { log(&format!("{hr:#x}")); return None; @@ -547,7 +536,7 @@ unsafe fn place_on_pages( let res = ID3D12Resource::from_raw_borrowed(&raw)?; let mut total = 0u32; dev.GetResourceTiling(res, Some(&mut total), None, None, None, 0, std::ptr::null_mut()); - let Some((used, used_extra)) = pages.bind(dev, res, va, console_bytes, total) else { + let Some((used, used_extra)) = timing::t(5, || pages.bind(dev, res, va, console_bytes, total)) else { drop(g); drop(windows::core::IUnknown::from_raw(raw)); *ppv = std::ptr::null_mut(); @@ -627,15 +616,36 @@ pub(super) unsafe fn before_execute(queue: &ID3D12CommandQueue) { return; } let Some(dev) = dev else { return }; - let mut g = PAGES.lock().unwrap(); + let mut g = timing::t(8, || PAGES.lock().unwrap()); let Some(Some(pages)) = g.get_mut(&(dev.as_raw() as usize)) else { return }; let key = queue.as_raw() as usize; if pages.waited.get(&key).copied().unwrap_or(0) < pages.value { - let _ = queue.Wait(&pages.fence, pages.value); + let _ = timing::t(9, || queue.Wait(&pages.fence, pages.value)); pages.waited.insert(key, pages.value); } } +/// diagnostic only (not for merge): calls and time of the texture-creation path, printed every 2 s with `XCL_ACTIVITY=1` +pub mod timing { + use std::sync::atomic::{AtomicU64, Ordering}; + // nested: place_pages and place_gpu include pages_lock + reserved + bind; bind includes create_heap + tile_map; + // exec_wait is only the CPU cost of queueing the fence wait, not the GPU wait + pub const NAMES: [&str; 11] = + ["place_pages", "committed", "register", "pages_lock", "reserved", "bind", "tile_map", "create_heap", "exec_lock", "exec_wait", "place_gpu"]; + static NS: [AtomicU64; 11] = [const { AtomicU64::new(0) }; 11]; + static CALLS: [AtomicU64; 11] = [const { AtomicU64::new(0) }; 11]; + pub fn t<R>(i: usize, f: impl FnOnce() -> R) -> R { + let s = std::time::Instant::now(); + let r = f(); + NS[i].fetch_add(s.elapsed().as_nanos() as u64, Ordering::Relaxed); + CALLS[i].fetch_add(1, Ordering::Relaxed); + r + } + pub fn snap() -> [(u64, u64); 11] { + std::array::from_fn(|i| (CALLS[i].load(Ordering::Relaxed), NS[i].load(Ordering::Relaxed))) + } +} + #[cfg(test)] pub(super) static VRAM_TEST_LOCK: Mutex<()> = Mutex::new(()); diff --git a/crates/xcl/src/host.rs b/crates/xcl/src/host.rs index ba5dcb4..f592f73 100644 --- a/crates/xcl/src/host.rs +++ b/crates/xcl/src/host.rs @@ -40,9 +40,19 @@ pub fn host_main(boot_path: &Path) -> i32 { [p, e, d, x, f[0], f[1], f[2], f[3], r, b >> 20, fail] }; let mut last = snap(); + let mut last_t = crate::hle::d3d12x::vram::timing::snap(); loop { std::thread::sleep(std::time::Duration::from_secs(2)); let now = snap(); + // diagnostic only: calls/ms of the texture-creation path in the last 2 s + let now_t = crate::hle::d3d12x::vram::timing::snap(); + let parts: Vec<String> = crate::hle::d3d12x::vram::timing::NAMES + .iter() + .enumerate() + .map(|(i, n)| format!("{n} {}/{:.1}ms", now_t[i].0 - last_t[i].0, (now_t[i].1 - last_t[i].1) as f64 / 1e6)) + .collect(); + crate::xlog_info!("timing (2 s): {}", parts.join(", ")); + last_t = now_t; let d: Vec<u64> = now.iter().zip(last).map(|(a, b)| a - b).collect(); crate::xlog_info!( "activity (2 s): {} presents, {} submits, {} draws, {} dispatches, {} frame-event waits ({} timed out), {} frame statistics ({} not flipped); DirectStorage {} requests, {} MB, {} failed", ``` </details> Written with Claude Code from runs on this machine.
Author
Owner

@⁠zorde23 on GitHub · 2026-11-24 17:43 UTC · original

Follow-up on the slow compute pipelines Rednaxeh pointed at. RX 6750 XT, driver 32.0.21045.29003, main 930e8b4 + #1321.

Why they take so long on this driver (130 fresh compute builds of 100 KB+ DXIL, 10 runs):

  • Driver time grows faster than the program: about instructions^1.5 for a build on its own (16 ms per KB of DXIL on
    average, 0.7-5.5 s per 10k DXIL instructions). The best single predictor is the number of per-access memory-window
    switches: the slow ones have about one 4-case switch per 100 DXIL instructions (a 1 MB one: ~1,400 switches,
    ~9,000 blocks, 68 s).
  • When title threads wait for several at once, they all reach the driver together (a wanted build skips the
    one-at-a-time slot). With 7+ in flight each takes ~6x longer and the batch finishes no sooner: 10 programs of
    320-415 KB started within 11 s of each other and all finished 42-62 s after the first one started.

#680 (heap windows, XCL_HEAP_WINDOWS=1), preload at the menu, each build alone:

  • 15 programs matched: median driver time 0.47x (IQR 0.44-0.63x), 376 s -> 203 s in total; the slowest went
    68.5 -> 31.5 s, 65.7 -> 41.5 s, 44.0 -> 20.6 s. The main side of 12 of them comes from earlier main runs with
    byte-identical DXIL (in the A/B run the driver's own cache served those in 0 ms); the 3 measured in the same
    session gave 0.47-0.70x (median 0.56x).
  • DXIL 0.80x in bytes, no window switch left, about half the basic blocks.
  • 600 s at the menu (preload of 1,282 shader sets): no rejected pipeline, no device removed, no translation error.
    Not run in the world with #680.

Not measured: #1316 on these programs, DXC flags per program, #1398 (it only acts on refused pipelines).

On this AMD card #680 looks like the largest single cut to these waits.

Written with Claude Code from runs on this machine.

**@⁠zorde23** on GitHub · 2026-11-24 17:43 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7139608587) Follow-up on the slow compute pipelines Rednaxeh pointed at. RX 6750 XT, driver 32.0.21045.29003, main 930e8b4 + #1321. **Why they take so long on this driver** (130 fresh compute builds of 100 KB+ DXIL, 10 runs): - Driver time grows faster than the program: about instructions^1.5 for a build on its own (16 ms per KB of DXIL on average, 0.7-5.5 s per 10k DXIL instructions). The best single predictor is the number of per-access memory-window `switch`es: the slow ones have about one 4-case switch per 100 DXIL instructions (a 1 MB one: ~1,400 switches, ~9,000 blocks, 68 s). - When title threads wait for several at once, they all reach the driver together (a wanted build skips the one-at-a-time slot). With 7+ in flight each takes ~6x longer and the batch finishes no sooner: 10 programs of 320-415 KB started within 11 s of each other and all finished 42-62 s after the first one started. **#680 (heap windows, `XCL_HEAP_WINDOWS=1`)**, preload at the menu, each build alone: - 15 programs matched: median driver time 0.47x (IQR 0.44-0.63x), 376 s -> 203 s in total; the slowest went 68.5 -> 31.5 s, 65.7 -> 41.5 s, 44.0 -> 20.6 s. The main side of 12 of them comes from earlier main runs with byte-identical DXIL (in the A/B run the driver's own cache served those in 0 ms); the 3 measured in the same session gave 0.47-0.70x (median 0.56x). - DXIL 0.80x in bytes, no window switch left, about half the basic blocks. - 600 s at the menu (preload of 1,282 shader sets): no rejected pipeline, no device removed, no translation error. Not run in the world with #680. Not measured: #1316 on these programs, DXC flags per program, #1398 (it only acts on refused pipelines). On this AMD card #680 looks like the largest single cut to these waits. Written with Claude Code from runs on this machine.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 17:43 UTC · original

Where the 88 GB is, measured - and it is not the placed textures

I ran the probe from my earlier comment (log-only, VirtualQuery walk on the XCL_ACTIVITY tick plus byte counters per owner). One sample at 44 631 MB of commit, main 930e8b4, RX 9070 XT 16 GB driver 32.0.32029.2010, Ryzen 7 9700X, 31.1 GB, Windows 11 26200, release:

  • XCL's resources for the title's placements, counted at creation (vram::place, vram::place_pages and the committed fallback in CreatePlacedResourceX): 934 in a GPU arena (3 697 MB), 529 on the shared pages (461 MB), 418 as resources of their own (402 MB) - 4.5 GB in 1 881 resources.
  • The title's own CreateCommittedResourceX: 0 resources. title_textures: 748 live, 43 dormant.
  • XCL's own heap (a counting global allocator): 761 MB live, 1 104 MB peak.
  • Pools, flat as before: target pages 3 602 MB, arenas 311 MB, sparse 896 MB; video memory 6 403 MB local, 4 707 MB non-local.
  • The address space: 31 851 committed regions (1 519 at t=2 s), 99.5% private, growth in 1-16 MiB regions of ~5.4 MB; 848 MB of 44.8 GB inside the title's 7 graphics reservations.
  • The title's own VirtualAlloc: 19 calls in the whole run; XMemAlloc: 16 calls (95 MB). Physical pages: 7 131 MB allocated, 11 491 MB mapped, 0 freed.

So my guess above - one PC resource per streamed texture placement carrying the commit - is wrong: those resources are 4.5 GB against 44 GB, and the title creates no committed resources of its own. What is left is the title's own allocator: its CRT malloc/HeapAlloc, i.e. ntdll heap segments of ~5 MB, ~1.4 GB/s, never returned (ntdll makes those VirtualAlloc calls itself, which is why the title's own import shows 19 calls).

This does not change what this issue is about: the ~1 ms per CreateReservedResource and the render-thread stall are still the thing to fix here, and the dumps that show dev_create_committed_resource under create_placed_resource_x are consistent with that cost (the 418 committed fallbacks in the run are cheap in bytes, not necessarily in time). The commit growth is a second, independent bug: the title's budget is reported but never enforced - filed as #1566 with these numbers, the cap experiment and the proposal.

AI use: the probe, the run and this text were written by Claude (Anthropic) under my review on my machine; all numbers are from runs here and no game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 17:43 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7139624695) **Where the 88 GB is, measured - and it is not the placed textures** I ran the probe from my earlier comment (log-only, `VirtualQuery` walk on the `XCL_ACTIVITY` tick plus byte counters per owner). One sample at **44 631 MB** of commit, `main` `930e8b4`, RX 9070 XT 16 GB driver 32.0.32029.2010, Ryzen 7 9700X, 31.1 GB, Windows 11 26200, release: - XCL's resources for the title's placements, counted at creation (`vram::place`, `vram::place_pages` and the committed fallback in `CreatePlacedResourceX`): 934 in a GPU arena (3 697 MB), 529 on the shared pages (461 MB), 418 as resources of their own (402 MB) - **4.5 GB in 1 881 resources**. - The title's own `CreateCommittedResourceX`: **0 resources**. `title_textures`: 748 live, 43 dormant. - XCL's own heap (a counting global allocator): 761 MB live, 1 104 MB peak. - Pools, flat as before: target pages 3 602 MB, arenas 311 MB, sparse 896 MB; video memory 6 403 MB local, 4 707 MB non-local. - The address space: **31 851 committed regions** (1 519 at t=2 s), 99.5% `private`, growth in 1-16 MiB regions of ~5.4 MB; 848 MB of 44.8 GB inside the title's 7 graphics reservations. - The title's own `VirtualAlloc`: 19 calls in the whole run; `XMemAlloc`: 16 calls (95 MB). Physical pages: 7 131 MB allocated, 11 491 MB mapped, **0 freed**. So **my guess above - one PC resource per streamed texture placement carrying the commit - is wrong**: those resources are 4.5 GB against 44 GB, and the title creates no committed resources of its own. What is left is the title's own allocator: its CRT `malloc`/`HeapAlloc`, i.e. ntdll heap segments of ~5 MB, ~1.4 GB/s, never returned (ntdll makes those `VirtualAlloc` calls itself, which is why the title's own import shows 19 calls). This does not change what this issue is about: the ~1 ms per `CreateReservedResource` and the render-thread stall are still the thing to fix here, and the dumps that show `dev_create_committed_resource` under `create_placed_resource_x` are consistent with that cost (the 418 committed fallbacks in the run are cheap in bytes, not necessarily in time). The commit growth is a second, independent bug: the title's budget is reported but never enforced - filed as #1566 with these numbers, the cap experiment and the proposal. AI use: the probe, the run and this text were written by Claude (Anthropic) under my review on my machine; all numbers are from runs here and no game data is included.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 17:58 UTC · original

Follow-up on the stall, with the memory ceiling bounded.

In a run with the title's memory budget enforced at 20 480 MB (job object ProcessMemoryLimit on the host, opt-in, numbers in #1566) the phase where my 318 s run showed 0-2 presents per 2 s had 62-63 presents per 2 s, 0 timed out, the same placed-resource counters (934 + 529 + 418, 3 697 + 461 + 402 MB) and the commit settling from 20 280 MB back to 17 432 MB. 8 795 frames in 300 s.

So on this machine the late stall did not happen once the commit was bounded, while the resource set was the same. One run, and I cannot prove the title was in the same world state as the uncapped run - the first minute and the counters match, nothing more. But it means the ~1 ms per CreateReservedResource and the memory ceiling may not be independent here: if you can run the cap on a machine that does hit the stall, the question becomes whether the per-placement cost is visible above it at all.

AI use: written by Claude (Anthropic) under my review; no game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 17:58 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7139968685) Follow-up on the stall, with the memory ceiling bounded. In a run with the title's memory budget enforced at 20 480 MB (job object `ProcessMemoryLimit` on the host, opt-in, numbers in #1566) the phase where my 318 s run showed **0-2 presents per 2 s** had **62-63 presents per 2 s, `0 timed out`**, the same placed-resource counters (934 + 529 + 418, 3 697 + 461 + 402 MB) and the commit settling from 20 280 MB back to 17 432 MB. 8 795 frames in 300 s. So on this machine the late stall did not happen once the commit was bounded, while the resource set was the same. One run, and I cannot prove the title was in the same world state as the uncapped run - the first minute and the counters match, nothing more. But it means the ~1 ms per `CreateReservedResource` and the memory ceiling may not be independent here: if you can run the cap on a machine that does hit the stall, the question becomes whether the per-placement cost is visible above it at all. AI use: written by Claude (Anthropic) under my review; no game data is included.
Author
Owner

@⁠tugasky on GitHub · 2026-11-24 19:15 UTC · original

Twenty minutes, not five. With the commit cap on (XCL_TITLE_COMMIT_CAP_MB=20480), the title ran 1 200 s, 35 344 frames, 60-64 presents in every 2 s window from 61 s to 1 141 s, and the only empty windows were t=2, 4 and 6 during start-up - no stall, no timeout, no exception.

The commit curve is the interesting part: the load peak hits 20 478 MB at 294 s, gives back 4.5 GB at 297 s, and then sits at 15 908-15 910 MB for the remaining fifteen minutes while rendering at the same rate. So the late stall I reported here did not happen with the process's commit bounded, and once the title has given the memory back it does not creep again.

Caveats unchanged: one machine, headless, no input, so the title may not be in the same world state as your sessions; and a cap of 20 480 MB is the console's budget plus XCL's own footprint, not the budget itself (13 824 MB kills the title in start-up - see #1566).

Written by Claude (Anthropic) under my review on my machine; no game data is included.

**@⁠tugasky** on GitHub · 2026-11-24 19:15 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7141843459) Twenty minutes, not five. With the commit cap on (`XCL_TITLE_COMMIT_CAP_MB=20480`), the title ran 1 200 s, 35 344 frames, 60-64 presents in every 2 s window from 61 s to 1 141 s, and the only empty windows were t=2, 4 and 6 during start-up - no stall, no timeout, no exception. The commit curve is the interesting part: the load peak hits 20 478 MB at 294 s, gives back 4.5 GB at 297 s, and then sits at 15 908-15 910 MB for the remaining fifteen minutes while rendering at the same rate. So the late stall I reported here did not happen with the process's commit bounded, and once the title has given the memory back it does not creep again. Caveats unchanged: one machine, headless, no input, so the title may not be in the same world state as your sessions; and a cap of 20 480 MB is the console's budget plus XCL's own footprint, not the budget itself (13 824 MB kills the title in start-up - see #1566). Written by Claude (Anthropic) under my review on my machine; no game data is included.
Author
Owner

@⁠zorde23 on GitHub · 2026-11-24 23:40 UTC · original

Tested your job-object idea on a 12 GB card, in case it helps narrow #1566.

Setup: RX 6750 XT (12 GB), driver 32.0.21045.29003, 32 GB RAM, Windows 11 (system commit limit ~46.5 GB). Release
builds of main 20cf130 (has #1321 and #1747), XCL_PSO_WAIT_MS=50, XCL_PSO_PRELOAD=0, driver shader cache emptied
before the batch. 300 s runs, A pressed at 15–35 s.

Base (main): menu at 60 presents / 2 s, world at ~86 s. Almost no skipped work (25 dispatches, 0 draws at 87 s), yet
presents / 2 s fall to 32–41 at 88–96 s and to 0–4 from ~102 s. Over the same window process commit goes 16.8 GB (80 s)
→ 20.2 GB (100 s) → 24.4 GB (134 s), and local video memory reaches 12.25 GB against a budget of 10.67 GB
(QueryVideoMemoryInfo). No device removal before the run was stopped at 138 s (we stop it ourselves when system commit
gets low). Same with #1517 applied on top (stall from ~78 s, 21.0 GB at 100 s).

With a 20,992 MB process memory limit (job object, as in your run): two runs, both end at ~100 s. Presents drop the
same way from ~78 s; at ~98 s commit reaches the limit and XCL's title-texture page allocations fail with
E_OUTOFMEMORY ("no video memory for more pages of title textures"); the title then stops itself (0x80000003 with
E_OUTOFMEMORY in one run, 0xC0000409 in the other). So on a 12 GB card the limit also catches the video-memory side, and
the title treats the failure as fatal; we did not see the 62–63 presents / 2 s you got.

Earlier the same day (older main, more skipped work): every run that went past the PSO watchdog with
XCL_PSO_WAIT_MS ended in a Windows TDR (LiveKernelEvent 141) (5 of 5), three of them within seconds of a Windows
low-virtual-memory warning; with #1323's markers enabled, no dispatch was ever left started-and-not-finished at the stall. On this machine
the stall/TDR follows memory, not skipped work.

What we could not test: a card with 16 GB or more, and a limit between 21 and 35 GB.

Written with Claude Code from runs on this machine.

**@⁠zorde23** on GitHub · 2026-11-24 23:40 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7147661196) Tested your job-object idea on a 12 GB card, in case it helps narrow #1566. **Setup:** RX 6750 XT (12 GB), driver 32.0.21045.29003, 32 GB RAM, Windows 11 (system commit limit ~46.5 GB). Release builds of `main` 20cf130 (has #1321 and #1747), `XCL_PSO_WAIT_MS=50`, `XCL_PSO_PRELOAD=0`, driver shader cache emptied before the batch. 300 s runs, A pressed at 15–35 s. **Base (main):** menu at 60 presents / 2 s, world at ~86 s. Almost no skipped work (25 dispatches, 0 draws at 87 s), yet presents / 2 s fall to 32–41 at 88–96 s and to 0–4 from ~102 s. Over the same window process commit goes 16.8 GB (80 s) → 20.2 GB (100 s) → 24.4 GB (134 s), and local video memory reaches 12.25 GB against a budget of 10.67 GB (`QueryVideoMemoryInfo`). No device removal before the run was stopped at 138 s (we stop it ourselves when system commit gets low). Same with #1517 applied on top (stall from ~78 s, 21.0 GB at 100 s). **With a 20,992 MB process memory limit (job object, as in your run):** two runs, both end at ~100 s. Presents drop the same way from ~78 s; at ~98 s commit reaches the limit and XCL's title-texture page allocations fail with `E_OUTOFMEMORY` ("no video memory for more pages of title textures"); the title then stops itself (0x80000003 with `E_OUTOFMEMORY` in one run, 0xC0000409 in the other). So on a 12 GB card the limit also catches the video-memory side, and the title treats the failure as fatal; we did not see the 62–63 presents / 2 s you got. **Earlier the same day (older main, more skipped work):** every run that went past the PSO watchdog with `XCL_PSO_WAIT_MS` ended in a Windows TDR (LiveKernelEvent 141) (5 of 5), three of them within seconds of a Windows low-virtual-memory warning; with #1323's markers enabled, no dispatch was ever left started-and-not-finished at the stall. On this machine the stall/TDR follows memory, not skipped work. What we could not test: a card with 16 GB or more, and a limit between 21 and 35 GB. Written with Claude Code from runs on this machine.
Author
Owner

@⁠zorde23 on GitHub · 2026-11-25 14:15 UTC · original

Follow-up with numbers after #1747, #1985 and #1986, on main f087b99 (RX 6750 XT, Windows 11, release build).

In a retail title, the frame drop when the open world streams in is two things:

  1. The first ~4 s: unmap_superseded runs a few thousand times in 2 s (2 687 calls, 841 ms), each holding the
    PAGES lock around UpdateTileMappings. The submitting thread's before_execute waits 536 ms on that lock in
    that window (longest 152 ms), which, together with the texture upload in refresh, gives one ~1 s frame.
  2. After that the lock is free (0 ms waits), and frames stay down because the title waits for its own texture
    streaming: one streaming thread spends 1.0-1.6 s of every 2 s in place_on_pages, about 90 % of it inside
    CreateReservedResource, at about 1 ms per texture, while using only 0.15-0.3 s of CPU.

Moving the upload off the CPU wait (#455, tested on top of the same main) removes the long frames (longest present
54 ms instead of ~1 s) but not the drop: presents in the 16 s after the stream starts are the same (150 vs 156).

CreateReservedResource alone, outside the title (an ignored local test, 2 000 creations per case):

case 256x256 BC1 1024x1024 BC7, 11 mips CPU / wall
fresh device, nothing pending 0.62 ms 1.70 ms ≤ 0.04
400 UpdateTileMappings pending behind a queue Wait - 1.70 ms 0.00
5 000 / 15 000 / 30 000 reserved resources alive - 1.69 ms ≤ 0.02
two threads at once - 2.73 ms each (1.25x the throughput of one) -

So on this driver the cost is per creation and fixed: it does not depend on pending tile mappings or on how many
reserved resources exist, it is mostly waiting rather than CPU, and a second thread barely helps. Making fewer
reserved resources (reusing them by description, for example) looks like the lever, not the locking.

One more thing seen in the same test: UpdateTileMappings on a queue that is blocked on a Wait blocks the calling
CPU thread after about 100 calls, until the wait is satisfied. If the pages queue ever waits while
unmap_superseded or bind map tiles under PAGES, the lock would be held for that whole time. I have not seen
this happen in the title.

Not tested: other AMD generations, NVIDIA, Intel; whether reuse of reserved resources is safe for the title's
aliasing.

Written with Claude Code from runs on this machine.

**@⁠zorde23** on GitHub · 2026-11-25 14:15 UTC · [original](https://github.com/xcl-dev/xcl/issues/1268#issuecomment-7165007568) Follow-up with numbers after #1747, #1985 and #1986, on main f087b99 (RX 6750 XT, Windows 11, release build). **In a retail title, the frame drop when the open world streams in is two things:** 1. **The first ~4 s:** `unmap_superseded` runs a few thousand times in 2 s (2 687 calls, 841 ms), each holding the `PAGES` lock around `UpdateTileMappings`. The submitting thread's `before_execute` waits 536 ms on that lock in that window (longest 152 ms), which, together with the texture upload in `refresh`, gives one ~1 s frame. 2. **After that the lock is free (0 ms waits), and frames stay down** because the title waits for its own texture streaming: one streaming thread spends 1.0-1.6 s of every 2 s in `place_on_pages`, about 90 % of it inside `CreateReservedResource`, at about 1 ms per texture, while using only 0.15-0.3 s of CPU. Moving the upload off the CPU wait (#455, tested on top of the same main) removes the long frames (longest present 54 ms instead of ~1 s) but not the drop: presents in the 16 s after the stream starts are the same (150 vs 156). **`CreateReservedResource` alone, outside the title** (an ignored local test, 2 000 creations per case): | case | 256x256 BC1 | 1024x1024 BC7, 11 mips | CPU / wall | |---|---|---|---| | fresh device, nothing pending | 0.62 ms | 1.70 ms | ≤ 0.04 | | 400 `UpdateTileMappings` pending behind a queue `Wait` | - | 1.70 ms | 0.00 | | 5 000 / 15 000 / 30 000 reserved resources alive | - | 1.69 ms | ≤ 0.02 | | two threads at once | - | 2.73 ms each (1.25x the throughput of one) | - | So on this driver the cost is per creation and fixed: it does not depend on pending tile mappings or on how many reserved resources exist, it is mostly waiting rather than CPU, and a second thread barely helps. Making fewer reserved resources (reusing them by description, for example) looks like the lever, not the locking. One more thing seen in the same test: `UpdateTileMappings` on a queue that is blocked on a `Wait` blocks the calling CPU thread after about 100 calls, until the wait is satisfied. If the pages queue ever waits while `unmap_superseded` or `bind` map tiles under `PAGES`, the lock would be held for that whole time. I have not seen this happen in the title. Not tested: other AMD generations, NVIDIA, Intel; whether reuse of reserved resources is safe for the title's aliasing. Written with Claude Code from runs on this machine.
This discussion has been locked. Commenting is limited to contributors.
No description provided.