Skip to content

D3D12.X: integration branch that reaches the in-world HUD on NVIDIA (reference, not for merge) - #2057

Draft
theaustinayers wants to merge 87 commits into
xcl-dev:mainfrom
theaustinayers:integration/nvidia-world
Draft

theaustinayers wants to merge 87 commits into
xcl-dev:mainfrom
theaustinayers:integration/nvidia-world

Conversation

@theaustinayers

@theaustinayers theaustinayers commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Draft, for reference only: the tree my runs of the newer retail title of #505 use on an RTX 5090, so that others can build and run the same thing. It is not meant to be merged as it is. Most of it is other people's open PRs; my own commits on top will be split into small PRs (list below). Merged with main at 568e7db.

The game runs listed under Tested were made with the same commits on an older base (7f7e768, no rebuild of the shader caches needed there). This merged tree has unit and GPU tests but has not run in the game yet: its compute pipelines are being built now.

What is in it

Other people's work:

New commits, each to become its own PR or a note on the PR it changes:

  • Hang and freeze: 16826cb, 3877446, c28d531 the counts of an ExecuteIndirect are read by a program of XCL's before the GPU runs them; f98a1d6 D3D12.X: a wait an earlier signal covers does not make a signal a cycle #2052's rule for title fences; 0d25b89 the console's cache flushes (list #131, Add synthetic Cargo benchmark suite #132, FlushPipelineX) are UAV barriers; dc651ea a tile a placed buffer uses stays mapped
  • Loading: 70a160e, 0764a57 on Memory: new sparse tiles are mapped together before the next submit #1517 (a mapping put off goes before a CPU or queue signal, before lists that follow a CPU wait, and after 2 ms at the latest); 6112bd8 on kernelx: commit a mapping call's sparse pages once per run, not per page #1792 (a page with data is told to the sparse windows before its bytes come: a look in between dropped them); f659f75 the mapped runs and the pieces to clear are kept in order; 77be198 a thread that maps memory lets waiting submits have the sparse lock first (171 ms median wait → 0.14 ms in a test); 04c2fe7 a texture whose memory is not all there is read region by region
  • Uploads: 80dc4dc small CPU writes go up in one dispatch; 73fc616, 0b66349, b659291, f064c82 the parts of a texture that changed go up, through lists and buffers that are kept, in order across queues; a261e72 what a file read puts into graphics memory is a known write; 55e58c3 readable asks the working set
  • Recording: 6e7040b, 2987c19 what each recorded call looks up is kept in parts with a lock each; 680a719, 0ba3b8c last releases
  • Looks: 7c18bc4 and after it (blocks written lately, a thread walks the rest; off with XCL_WATCH_HOT=0). Not strict: a write to a block that was idle reaches video memory up to about 20 ms late. a004fe7 XCL_LOOK_AHEAD=ms (off; known gaps, see its commit)
  • 414adb2 one device is opened at a time (two test threads made two and opened the memory windows for each)
  • 9baaa6f a compute pipeline's driver blob reaches the disk cache although the memory store is full; 5ea55e2 XCL_PRECOMPILE_SLICE=i/n
  • 1225bb9, 5e3c657, b5e8baf on top of D3D12.X: a copy back after a submission does not wait for the title #1993
  • Diagnostics (XCL_ACTIVITY call times, XCL_LOOK_STATS)

Tested

Regression run

  • none: a reference branch, not for merge.

Not tested

  • This merged tree in the game; AMD; other titles; a cold shader cache.

AI use

  • Claude Code, Claude Fable 5.2 and Claude Opus 5.5: wrote the new commits and their tests, made the runs on the hardware above and wrote this description. The upload and loading commits were reviewed by separate agents (Claude Opus 5.5).

🤖 Generated with Claude Code

vakaobr and others added 24 commits November 24, 2026 17:48
Helpers for the copy path that changes no behaviour yet:

- sparse.rs: extract new_state from the inline closure in init, so
  shadow_window (next commit) can call it when no sparse windows exist
- uma.rs: Uma::shadowed flag and is_gpu_copy(p): a sparse window or a
  committed one the GPU has a copy of. Never set to true in this commit.
- list_x.rs: note_copy_into tracks PC copies into console buffers whose
  memory the GPU has a copy of; note_write uses is_gpu_copy
- real.rs: uma_shadowed helper, res_map and dev_create_placed_resource_x
  use is_gpu_copy (= is_sparse while shadowed is false)

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip.

Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com>
Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
D3DMetal 3.0 applies SetPredication for draws, dispatches and
ExecuteIndirect but not for copies: a predicated CopyBufferRegion runs
unconditionally. The UMA shadow path (next commit) makes UMA available
on this host, so the predication test would run and fail.

A one-copy probe detects whether a predicated copy is skipped (Windows,
any real D3D12) or run (D3DMetal). When run, the test skips with
"host ignores SetPredication for copies" instead of failing.

Based on us3r40456's bisect and measurement in xcl-dev#258.

Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com>
Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed it)
D3DMetal answers E_NOTIMPL for OpenExistingHeapFromAddress. A committed
UMA window is then a buffers-only heap of video memory (Uma::shadowed),
kept in step like a sparse window's tiles (sparse::shadow_window): CPU
writes go up before each ExecuteCommandLists (the window's write watch),
GPU writes come back on Map and after the lists' memory writes, and PC
copies into console buffers there are read back after the submit
(list_x::note_copy_into). XCL_UMA_SHADOW=1 forces the path on a GPU
that has such heaps, =0 never.

On main 930e8b4: the start-up check that the GPU sees CPU writes
(check_uma_import) is not run for a shadowed window (it is a copy by
design); sparse::new_state carries the new parked list. The runner's
run_in_region falls back to upload/readback copies per window on
E_NOTIMPL. The sparse test's shadowed readback and constant-rewrite
stress validate the data path.

Part of xcl-dev#258.

Based on Ahmet-Dedeler's c70bf8a on mac-on-main-wip.

Co-authored-by: Ahmet Dedeler <105894172+Ahmet-Dedeler@users.noreply.github.com>
Assisted-by: Claude Code (Claude Opus 4.6 ported it; Claude Opus 5.5 reviewed and fixed the import-check assertion)
…ough the memory store is full

The disk cache of compute driver blobs (xcl-dev#634) wrote a blob only when the
in-memory store had taken it first: keep_compute_blob stored it there within
COMPUTE_BLOBS_MAX (512 MB) and the caller then looked it up for the file. Once
the store was full the lookup found nothing and no later build was written.
Those are the builds that matter most: a retail title's world needs compute
pipelines of 20 to 150 s each in the NVIDIA driver, made after hundreds of
smaller ones, and it built them again in every run.

keep_compute_blob now returns the blob it fetched; it is kept in memory only
while there is room (remember_compute_blob), and goes to the disk either way.

Assisted-by: Claude Code (Claude Fable 5.2)
D3D12.X: eliminate multi-heap UpdateTileMappings and per-texture Signal stalls in vram::Pages
D3D12.X: an ExecuteIndirect reads the arguments written before it
D3D12.X: promote R9G9B9E5_SHAREDEXP render/UAV targets to R11G11B10_FLOAT
`readback_after_execute` made the sparse queue GPU-wait for the title's
queue and then waited on the CPU for the copy, on the thread that was
submitting. The title's queues can wait for work that same thread submits
next (four compute queues waiting for a Write64 on q1 whose list is
recorded but not submitted yet). So the copy waited its 5 s on every such
submission, and the uploads queued behind it on the sparse queue waited
too (`before_execute` waiting for ring room). In thread dumps of a retail
title on an RTX 5090, the submitting thread is in `readback_ranges` ->
`wait_for` while another title thread waits for the sparse state's lock in
`commit_range`. lucsoft found the same cycle on RDNA3 / Linux (xcl-dev#505).

The copies now run on a queue of their own, which GPU-waits for the
title's queue, and the submitting thread returns. Readback buffers are
sized to the copy (64 KiB and up) and reused. Without a readback queue (it
could not be made), the old path runs.

The data lands in the title's memory once the copy is done, before the
title can see the work it follows is done:
- on the next submit, and from a thread that looks every 0.5 ms;
- before Map's readback and in the CPU memory waits of Wait64BitValueX
  (`settle_readbacks`), which wait for the copy once the title's lists it
  follows are done;
- in the title's fence observations: `GetCompletedValue` settles the copies
  first. `SetEventOnCompletion` hands the fence an event of XCL's own, and a
  thread-pool wait on it settles them, then sets the title's event.

The new test `a_copy_back_does_not_wait_for_the_title_queue` waits 5.0 s
on the old path and under 1 s with this change. Without the fence hooks,
the e2e test title read 0 for its Write32BitValueBottomOfPipeX after its
fence wait. With them, both e2e tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail title's intro cutscene ran at 0.3-0.5 fps with the GPU at
98-100 %, and nothing in XCL measured GPU time per draw or dispatch: the
logs could not say which console programs the GPU time went to.

With XCL_GPU_PROFILE=1 each translated draw, dispatch and ExecuteIndirect
(and an ExecuteIndirect with a PC pipeline) gets a timestamp query on its
PC list before and after it, resolved right behind it into a readback
ring of 2^17 pairs. Nothing on the CPU waits: a reporter thread takes
the written pairs every 100 ms, and every 2 s logs the 15 console
programs with the most GPU time (every 20 s also since the start):
hash, kind, calls, total and longest ms, group counts of the longest
call, and for compute the thread group size, wave64 / split form, code
and DXIL size. Ticks are converted with a title queue's
GetTimestampFrequency. Off by default; with it off each op pays one
LazyLock read.

Overlapping queues are each charged in full, so the sum can exceed wall
time; bundles get no stamps; a recording run again without a Reset is
counted once. The resolve waits on the GPU for the op to finish, so with
the profile on a queue runs its ops one after the other. The unit tests
cover the pair states and the ranking.

Assisted-by: omp (Claude Opus 5.5)
When a bridged Wait64BitValueX times out, the watchdog logs the producer
queue's state, but not the queue.Waits XCL adds on its own: texture page
mappings (vram::before_execute), sparse uploads and tile mappings, and
sparse readbacks. They are not in SYNC_GRAPH, so a producer queue that
stands behind one of them looked like a queue with "no tracked wait".

On an RTX 3080 10 GB (driver 621.01) with the retail title, every timeout
came with the producer queue (and another title queue) waiting for the
texture page-mapping fence, about 25 mappings behind after 7.7 s; skipping
that one wait in a local experiment took the CPU releases from 4 to 0-1
per run.

note_internal_wait records each such wait per queue, and each watchdog
round logs the unmet ones next to the pending title fences. The watchdog
timeout (5000 ms) can now be changed with XCL_GPU_WAIT_TIMEOUT_MS, like
XCL_WAIT_TIMEOUT_MS for the CPU waits. No behaviour change otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015JSG96tVb4ZSAZ5WH4v95v
The newer factory's CreateQueue (slot 10) takes a 0x20-byte desc whose
u64 @0x18 is the queue's DSTORAGE_QUEUE_OPTIONS; a new retail game sets
bit 0, AutoSubmitDisabled. XCL ignored it, and a half-full queue still
submitted by itself. The title writes a request's destination page list
after EnqueueRequest and before its own Submit, so a request that the
half-full submit sent to the worker could run before its list was
written, with the pages of the slot's previous request.

Such a queue now runs its requests only at Submit, and an enqueue into
it at capacity waits until Submit, a cancel or Close takes entries, as
the console's queue stalls one. Queues made without the option, or
through the first CreateQueue, submit when half full as before. Other
option bits are logged once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir fence; looks counted against list closes (local test)
theaustinayers and others added 4 commits November 24, 2026 21:31
`would_signal_close_cycle` took every armed wait on the target cell with
`val <= sig_val` as waiting on the new signal. A wait that an earlier
signal of the cell already satisfies (submitted on the GPU or released on
the CPU) does not depend on it. With pipelined frames – queue A waits on
cell X >= N, queue B then signals X = N + 1 after waiting on something A
signals later – every such frame was reported as a cycle, signalled on
the CPU and its waiters released before the GPU work they wait for ran.

A retail title on an RTX 4070 Laptop broke 14-32 such "cycles" in each
run's world load (traced: queue 1 waiting on 0x...fde0 >= 0x6db, covered
by queue 2's earlier 0x6db signal, counted against queue 2's 0x6dc
signal). With the fix: no cycle break in two runs of the same load.

The waiters taken now are those no earlier signal covers
(`val > max(submitted_max, cpu_signaled_max)`); a test reproduces the
traced case and keeps the true cycle detected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail title keeps its destination page lists in slots of its own
table and writes a slot's pages after EnqueueRequest. At enqueue such a
slot can still name the pages of the slot's previous request, and the
snapshot taken then is what execute() wrote to (xcl-dev#289 rereads only the
entries that are 0). Over 16 000 requests a run were written into pages
the title had since reused: its objects got garbage pointers and it
crashed about 20 s into world loading; when the old pages were freed,
the request failed with E_ACCESS_VIOLATION.

The console reads the list when it runs the request. execute() now
reads it again (through read_own, as the snapshot) and takes it when it
differs and every page in it is allocated (kernelx::physical_pages_live);
otherwise the snapshot stays, so arrays on the stack that were
overwritten since still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…al a cycle"

Local test only (the upstream PR is a draft, xcl-dev#2052). On this title the change left a real
multi-queue wait cycle: at 111 s of the world load all five queues waited on each other for
values one past their completed ones, the watchdog released 102 GPU waits and the title froze.
The cycle breaks logged before the change had been the false positives it meant to avoid; the
true ones it no longer breaks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theaustinayers and others added 3 commits November 25, 2026 02:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first

The lock goes to the first to ask once it is free: a thread that takes it
again and again (a title mapping its memory a page at a time) is back
before a waiting one has woken. Measured with 0.4 ms holds and no gap:
171 ms median and 1.8 s at worst for the waiting thread; with the rule
0.14 and 0.4 ms. Also: XCL_TEST_WARP for the test device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… come

A look for CPU writes between a page's copy and its `sparse::committed`
took the written pages of a tile that has no video memory yet: they were
reset and dropped, and nothing reported them again, so the GPU read zeros
there until the CPU wrote the page once more. With a mapping call's pages
told in runs that gap was the rest of the call. Pages with data are told
first, the run stays for fresh ones; a page moved between addresses the
same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tiagonleal

Copy link
Copy Markdown
Contributor

RTX 5070 Ti 16 GB / 32 GB RAM: this tree reaches the world of the Newer Retail Game in 67–94 s. Free physical memory then runs out 15–30 s later in every run where the world keeps rendering.

Setup

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 32.0.16.1742), AMD Ryzen 7 9800X3D, 32 GB RAM (31.4 GB visible; about 21.6 GB free with no game running), Windows 11 Pro 10.0.26300, Rust 1.100.0, release.
  • Tree: this PR at f7e08e6 plus two local commits that are not published anywhere. Both are off unless their variable is set:
    • XCL_EXP_WAIT_SUBMITTED=1: the GPU-wait watchdog does not release on the CPU a wait whose Signal is already submitted. It was on in every game run below, but it never acted: 0 holds were logged, and nothing was released on the CPU.
    • XCL_EXP_APU_MAP1=1: ApuMapVirtualAddress is taken in its one-argument form. It was on in every game run; it handled 13–14 calls per run in runs 2–4 and none in run 1.
  • No other change: the translator and everything else are as in f7e08e6. The translator sources and TRANSLATOR_VERSION (10) are identical to 41303e4.
  • Tests on this tree: cargo test --release -p xcl --lib -- d3d12x::list_x d3d12x::fence_x d3d12x::sparse hle::acphal gpu::fence.
    • With --test-threads=1: 68 passed, 0 failed, 1 ignored.
    • Run in parallel, the test process hangs. Six sync/GPU tests report "running for over 60 seconds" with about 1 s of CPU, and I killed it at 120 s. Pure f7e08e6 hangs the same way:
      • list_x::tests::cross_queue_cycle_and_same_queue_fifo_do_not_deadlock
      • cross_queue_wait64_before_signal_does_not_deadlock_submit_thread
      • mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares
      • write_buffer_immediate_on_open_existing_heap_visible_to_cpu
      • sparse::tests::a_copy_back_does_not_wait_for_the_title_queue
      • small_runs_go_up_in_dispatches_and_leave_what_lies_between
    • At 41303e4 the same filter passed in parallel (67 passed, 0 failed, 1 ignored).

Caches

  • Compute pipelines were precompiled with this PR's tool: xcl shaders <pack> --precompile --only cs --pipelines, first with --used-only (the used list came from earlier runs), with XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1.

    • One process, no XCL_PRECOMPILE_SLICE, XCL_DXC_THREADS=4, XCL_PIPELINE_THREADS 1 and then 2.
    • 64 min in total, 1,321 driver blobs. These cover all 912 compute programs of the used set, plus about 409 of the other 1,777.
    • 0 refused, 0 DXC errors. Peak working set 5.9 GB (private 1.8 GB), minimum free RAM 14.8 GB, peak system commit 19.2 GB.
    • With one pipeline thread the pass was bound by the driver compile (one core busy).
    • The slowest driver compiles took 95, 82 and 73 s, for 3.3, 1.7 and 1.5 MB of DXIL.
  • In the game the compute cache applies: 912–922 compute pipelines came from the driver's blob of an earlier run, and 27–37 were compiled.

  • Graphics pipelines are not covered. --precompile only runs DXC on VS/PS, and --pipelines builds compute pipelines only, so the graphics cache warms up only in-game. The window title showed compiling shaders: 4 running … 36255 pipelines queued. Graphics PSOs compiled in-game, at 2–3.7 s each, gated:

    run graphics PSOs compiled in-game driver-cache files after the run
    (before the runs) – 1,399
    run 3 111 1,583
    run 4 130 1,614

Runs

  • xcl.exe run <title>, XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1, A pressed at 30 s, plus the two local switches above. No XCL_DRED, no XCL_PSO_WAIT_MS.
  • A memory guard ran next to the game. It kills xcl.exe when free physical memory drops below 1.0 GB; that is what ended runs 1, 2 and 4.
  • "World" below is the first ID3D12GraphicsCommandList10::#101 call.
run settings world presents / 10 s after it end memory at the end
1 XCL_UMA_SHADOW=1 66.8 s 195 (60–70 s), 34, 29 guard at 82 s, free RAM 0.45 GB process 31.0 GB committed, working set 17.3 GB; video memory 16.9 GB local + 0.5 GB non-local
2 no XCL_UMA_SHADOW 93.8 s 92 (90–100 s) guard at 101 s, free RAM 0.88 GB 29.9 GB committed, working set 18.5 GB; 14.3 GB local + 4.6 GB non-local
3 no shadow, XCL_GPU_PROFILE=1 XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 74.2 s 92, 104, then 0 from 86 s to 300 s ran to 300 s (exit 0) 31.7 GB committed, working set 17.8 GB flat, free RAM 2.7–3.2 GB flat
4 as run 3 80.6 s 46, 7, 1 guard at about 108 s, free RAM 0.97 GB 32.3 GB private, working set 19.4 GB; 15.5 GB dedicated video memory
  • Menus ran at 30 fps (300 presents per 10 s from 20 to 60 s) in every run. The first present came at 4–6 s.
  • No run had a device removal, a crash, a Wait64BitValueX time-out, a watchdog release, or an nvlddmkm / Display event.
  • DirectStorage: 0 failed requests in all runs (72,268 / 87,811 / 88,004 / 95,717 requests in runs 1–4).
  • From the world on, free RAM falls by about 1.5–3 GB every 8 s.
  • In run 3, from 86 s the title makes no more submits, and the GPU engine of the process goes idle while graphics compiles continue. The memory plateau in run 3 comes from that stop. Run 4, with a warmer graphics cache, went on rendering, with 21,407 dispatches in 90–100 s, until memory ran out.
  • CPU cost per submit (log, average of 1,024 ExecuteCommandLists): 10.4 ms (run 1, textures 7.3 ms), 13.2 ms (run 2, textures 11.8 ms) and 10.4 ms (run 4).

Log lines from run 1 (UMA shadow) just before the guard stopped it:

[   82.047] activity (2 s): 26 presents, 104 submits, 284 draws, 67 dispatches, 52 frame-event waits (0 timed out), 26 frame statistics (0 not flipped); DirectStorage 6501 requests, 235 MB, 0 failed
[   82.048] memory: 30972 MB committed by the process; video memory 16935 MB local, 482 MB non-local; target pages 8656 MB (pools 9088 MB); arenas 304 MB in use, 304 MB made; sparse pools 1792 MB (1784 MB mapped)

and from run 2 (no shadow):

[   94.045] memory: 29874 MB committed by the process; video memory 14293 MB local, 4578 MB non-local; target pages 9647 MB (pools 10304 MB); arenas 304 MB in use, 304 MB made; sparse pools 1984 MB (1960 MB mapped)

What fits and what does not on 32 GB / 16 GB

  • The compute precompile fits easily: under 6 GB working set with 1–2 pipeline threads.
  • The world does not fit with the default coherent window, with or without XCL_UMA_SHADOW. With XCL_UMA_SHADOW=1 local video memory reaches the card's 16 GB.
  • XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 did not change the outcome once the world kept rendering (run 4).
  • The process working set at the point of failure is 17–19.5 GB. The system uses about 10 GB with no game.

Not tested

  • This tree without the two local switches. The watchdog switch never acted in these runs, but the runs are not "the PR as it is".
  • Letting Windows page instead of stopping at 1.0 GB free: runs 1, 2 and 4 are guard cut-offs, not crashes, so I do not know how far the world would go while paging (system commit was about 50 GB of a 95 GB limit in run 4).
  • More than 4 runs, runs longer than 300 s in the world, AMD, other titles, a cold compute cache.
  • A warm graphics cache from many earlier runs, as the description's runs had.

AI use

  • Claude Code: built the tree and the two local switches, ran the precompile and the runs under a memory guard, and wrote this report from the logs.

Run and written with Claude Code (Claude Fable 5.2 and Claude Opus 5.5).

…gion

`copy_readable` fell back to splitting the range at every failed
ReadProcessMemory: for memory that is only reserved that is two calls a
page. A retail title makes its textures before it maps their memory, and
13.6 GB of them went up at 0.5 GB/s while its world loaded (27 s of its
submitting thread). The regions are asked for once each, as
`read_committed` did; both share the code now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Filip722

Copy link
Copy Markdown

I tested the published world-render revision 14d7a3c56cb816a5b2babf3e42b7fbdc8e4d5f44 on an RTX 5060 Laptop GPU (8 GB) under Proton. Shrinking the coherent window changed which heaps the title could use before it produced a visible frame.

Both offline Series X runs used the same release executable, separate copies of the same partial shader caches, one compiler worker, background pipeline preload disabled, and the three reference settings XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1. The runtime confirmed that the coherent window had a copy in video memory in each run.

Coherent window Coherent usage at 64 through 1,024 draws Native present-source samples Stop
1,536 MiB 1,255 MiB Frames 20, 116, 212 and 308 all black External guard at 3,538 MiB free VRAM
1,344 MiB 1,236 MiB The same four frames plus frame 404 all black Same guard at 3,554 MiB free VRAM

The smaller window additionally refused a 19 MiB graphics heap while reporting 107 MiB free. The allocator keeps 96 MiB for XCL, leaving about 11 MiB available to that request. The 1,536 MiB run reported only the three larger refusals. This reserve matters when sizing the window from observed usage. The allocation check is here.

Each native sample read 0 of 518,400 pixels above black. All 8 and 13 respective window captures were black. Both runs stopped on the rapid-allocation threshold, with zero process-group swap. These samples establish early allocation and presentation behavior. World entry remains unverified here.

Bazzite 44.20261011.0, Intel Core 7 240H, 16 GB system RAM, NVIDIA 615.78.08, Proton Experimental 11.0-20261112, vkd3d-proton 3.1.0 (4522cc1a8b1347f+). OpenAI Codex (GPT-6.2-Sol, high) built the reference, ran the comparison and prepared this report.

theaustinayers and others added 2 commits November 25, 2026 02:43
What independent reviewers confirmed in the commits since 0ba3b8c:
- the flag that says mappings wait went before they were sent: a CPU
  signal of another thread saw nothing to do and let waiting work run
  ahead of them. It goes after the flush, and a signal asks each time;
- a queue's Signal (and SignalX) sends what waits, as a fence's does;
- lists that go out after a wait on the CPU inside a submit see what the
  title committed meanwhile mapped and cleared;
- a heap made with the state locked: what waits is sent first;
- the walk gets the watched ranges at every submit, and a submit goes
  without a look of its own only when the walk has found no written
  block since the last look began.
Tests: two GPU tests skip where the device cannot run them (the software
device is removed by copies into a reserved buffer of 3 GiB, and a device
without sparse windows puts nothing off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@imnicho

imnicho commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

RTX 5080 16 GB on this branch at 41303e4: the intro cinematic's overlay is drawn, no stalled wait, and on a 16 GB card it is video memory that ends the runs

A 16 GB NVIDIA card on Windows, which the reports here do not have yet.

Setup. RTX 5080 16 GB (driver 610.47, 32-lane waves), i7-7700K (4 cores / 8 threads), 16 GB RAM, Windows 10 22H2, release. The retail title of #505 (my own copy), XCL_NETWORK=0, scripted pad, binds waiting (no XCL_PSO_WAIT_MS). XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_HUGE_PSO_CONCURRENCY=2. TdrDelay is 8 s on this PC.

Tree (local, not pushed): this branch at 41303e4 + #2067 at 9b35718 + #684 + #266 + #1515 + #495 + #1405 at bb27ed6 + #751. #684 and #266 are there because the title does not get past its world set-up on this PC without them. Conflicts, for whoever merges the same: #2067 has eight blocks in kernel.rs, emit.rs, lower_dxil.rs and recomp/mod.rs, each #1850's line against #2067's replacement of it (I took #2067's side; its four coherence tests pass on that tree here); #1405 has one block in dstorage.rs, this branch's earlier form of that change against the PR's !dest_on_stack form (I took the PR's).

1. Caches without running the title. xcl shaders <pack> --precompile --only cs --pipelines --used-only in two processes (XCL_PRECOMPILE_SLICE=0/2 and 1/2), with a used-pipelines.txt from earlier runs: 926 compute pipelines in 69 minutes, 0 refused, 3 to 4 GB of RAM a process. In the run after it 936 of 962 compute pipelines came from kept blobs. What it does not cover are the graphics shaders: the first run compiled about 690 of them through DXC (median 66 KB of DXIL, the largest 730 KB, 8 to 10 a minute on this CPU with the title's 39 GB committed on 16 GB of RAM) and the title showed no frame from 147 s to 863 s. Thread dumps in that stretch: the title's thread in pso_async::resolve_wait under bind::execute_indirect, two xcl-dxc threads in dxcompiler.dll.

2. Series X profile

run world's set-up frames after it dispatches after it (skipped) waits released by the watchdog end
first (graphics shaders cold), 1,500 s 148.5 s 249 462,587 (0) 0 running at the limit; 21.4 GB local video memory against a budget of 15.1 GB, 39.5 GB committed
second (caches warm), 900 s 132.6 s 167 507,480 (0) 0 0x887a0005 at 415.9 s, as local video memory went from 19.8 to 20.7 GB in a burst of 512x512 3D placed resources; no System event 4101

3. Series S profile (device_type = "lockhart"), one run of 900 s. It needs #495: without it the title stops at its own int3 at 51 s and 73 s (two runs on f862f5f). With it: set-up at 200.8 s, three compute pipelines that the list did not have built in 86, 86 and 281 s, 18.1 GB local video memory against a budget of 15.0 GB, and 0x887a0006 at 726 s (System event 4101) after sparse: the queue has not reached fence value … after 5 s twice.

4. Without XCL_UMA_SHADOW on this card (on f862f5f): about 2.6 s of console GPU time a world frame and a device removal within minutes; the per-program numbers are in #1850 (comment) . With the shadow it is about 0.12 s a frame.

So on a 16 GB card the shadow takes away the GPU-time problem, and its 4 GB put the title 5 to 6 GB over the video memory budget in the Series X profile and 3 GB over in the Series S profile.

Not tested

  • This branch as it is: the tree above has seven other PRs in it.
  • AMD, Intel. Each row is one run.

AI use: Claude Code with Claude Fable 5.2 built the tree, ran the title and wrote this.

@upipibi

upipibi commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

@tiagonleal Reproduced on an RTX 3070 (Ampere, driver 616.56, Windows 11) with your filter: cargo test --release -p xcl --lib -- d3d12x::list_x d3d12x::fence_x d3d12x::sparse hle::acphal gpu::fence, default threads, each run capped at 180 s. The trees were run in turn, every run holding the GPU alone:

tree runs hung (cap hit) tests still running after 60 s
main 568e7db 3 0 (58 passed, 0 failed each) –
f7e08e6 (the head of your report) 3 3 sparse::a_copy_back_does_not_wait_for_the_title_queue (3/3), sparse::small_runs_go_up_in_dispatches_and_leave_what_lies_between (3/3), list_x::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares (2/3), cross_queue_cycle_and_same_queue_fifo_do_not_deadlock, rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang, write_buffer_immediate_on_open_existing_heap_visible_to_cpu (1/3 each)
41303e4 3 3 sparse::a_copy_back_does_not_wait_for_the_title_queue (3/3), list_x::cross_queue_wait64_before_signal_does_not_deadlock_submit_thread (3/3), cross_queue_cycle_and_same_queue_fifo_do_not_deadlock, mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares, rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang (2/3 each), write_buffer_immediate_on_open_existing_heap_visible_to_cpu (1/3)
4df1e6e (current head) 3 3 sparse::a_copy_back_does_not_wait_for_the_title_queue, sparse::a_mapping_put_off_is_sent_without_a_submit, sparse::small_runs_go_up_in_dispatches_and_leave_what_lies_between, list_x::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares (3/3 each), cross_queue_cycle_and_same_queue_fifo_do_not_deadlock, write_buffer_immediate_on_open_existing_heap_visible_to_cpu (2/3), cross_queue_wait64_before_signal_does_not_deadlock_submit_thread, rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang (1/3)

Run 1 on 4df1e6e overlapped a build on this machine; runs 2 and 3 had the machine to themselves and hung the same way.

One difference from your report: 41303e4 hangs here too. This machine has 32 logical CPUs, so the default harness ran 32 test threads against 16 on yours. That isn't the explanation: with --test-threads=16, 41303e4 hung in 1 of 2 runs, and the other run finished with 1 failure (hle::acphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure). main wasn't checked at 16 threads.

Cause: #1993's change, as carried here in cbba2d9d, with its new test running in parallel. A first-parent bisect of the first-parent commits after the branch's main merge-base f5c5bdf up to 41303e4 (f5c5bdf checked clean first, 2 of 2) named cbba2d9d. Checked against its parent, 3 runs each: 4de1452d 0 of 3 hung; cbba2d9d 2 of 3 hung; cbba2d9d with a_copy_back_does_not_wait_for_the_title_queue skipped, 0 of 3; that test alone, 0 of 3. So it takes the new test running in parallel with the other queue tests in one process. Details and a possible cause are on #1993: #1993 (comment)

AI-assisted (Claude Code). Synthetic tests only.

@Eterst

Eterst commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

RTX 4070 SUPER 12 GB / 32 GB RAM on this branch: the intro's opening credits are reached. Measured: XCL_WATCH_HOT causes the black-frame flicker, XCL_UMA_SHADOW is what avoids the early device removal here, #751 is needed on this tree, and NVIDIA's own shader cache file was 7.6 GB of the RAM.

Setup

1. The flicker is XCL_WATCH_HOT. With XCL_FRAME_DUMP=2, frames 700–1500 (the loading screen), counting dumps with none of the 518,400 sampled texels lit:

XCL_WATCH_HOT fully black dumps
default (on) 66 of 299 (irregular, every 2–8 frames)
0 2 of 279

All presents came from one queue, alternating two back buffers. The cost of XCL_WATCH_HOT=0 is speed: one write-watch sweep took 101 s (26.2 M dirty pages) and the world ran at about half the present rate.

2. XCL_UMA_SHADOW=1 is what keeps the device here. Without it (and with the default 4095 MB window) the coherent window is opened in place (UMA import check: ok) and the device was removed at 109.8 s (5 prod=qNone waits at 98.3 s, no watchdog release, 4 of 306 lists in flight). With it, no run was removed before 249 s.

3. #751 is needed on this tree. A 313 s run ended with an access violation in gpu::tiling::Chain::detile_level ← title_textures::subresources on a subresources_on worker, reading a page the title had unmapped 3 ms earlier (XCL's page log). With #751 applied (one conflict with this branch's submit_cost timing, resolved by keeping both), it did not come back in the 7 runs after it.

4. RAM: NVIDIA's DX shader cache file was mapped fully resident. A watcher that catches new mapped regions found the 8 GB mapped block in the process to be the driver's cache file for xcl.exe (%LOCALAPPDATA%\NVIDIA\DXCache\33cba93bc29925ed.nvph, mapped by NvMemMapStoragex.dll while the device is created). Measured with QueryWorkingSetEx, 7.62 of its 8 GB were in the working set from the first seconds to the end of the run. The two cache files for xcl.exe had grown to 12 GB with the pipeline precompiles above. With the two files moved away (the driver starts a new one), at the same point of the run:

resident (working set) RAM free the run
cache files 8 + 4 GB 22.4 GB at 140 s 0.4 GB → stopped by my RAM guard at 189 s –
moved away 15.1 GB at 200 s 9.2 GB went on to 313 s

The new cache file was 0.75 GB after that run. Capping NVIDIA's "Shader Cache Size" for xcl.exe keeps it there; XCL's own driver blobs still supply the pipelines. A smaller coherent window helped too: XCL_COHERENT_MB=2048 instead of 4095 took 4.5 GB of commit and 2.5 GB of video memory off at ~100 s, at the cost of a slower start (the title's 2.2 GB GPU heap then lives outside the window).

5. What still ends the runs: a device removal at 250–265 s (in the intro's opening credits), in 4 of the 5 runs that got that far: 259.4 s, 255.1 s (XCL_WATCH_HOT=0), 265.0 s (XCL_COHERENT_MB=1024, video memory 11.2 GB), 249.9 s. The fifth (before #751, with the new NVIDIA cache file) ran to 313 s and ended on the crash in point 3. No GPU-wait watchdog release in any of them. The culprit markers showed 4–5 lists stuck at the same CopyResource into a 2560x1440 format-28 title texture on title pages; with that copy skipped (a local diagnostic), the removal still came at 249.9 s, with no list in flight. DXGI local video memory ended at 11.2–12.7 GB; the sparse pools grow steadily (0.3 → 3.8 GB) through the run. RAM had 8–13 GB free.

Not tested: this PR's newer heads (f7e08e6, 4df1e6e); AMD; the tree without the PRs added above; more than one run per row in the tables.

AI use: Claude Code (Claude Opus 5.5) made the runs on this machine, wrote the diagnostics and wrote this report, posted with my OK.

@Rednaxeh

Copy link
Copy Markdown
Contributor

AMD RDNA3 (RX 7800 XT 16 GB) on head f7e08e6: the branch runs on AMD without XCL_UMA_SHADOW, which kills the device at once; the world stays a black window because the AMD driver compiles the title's own compute pipelines at 12–40 s each, on the title's thread.

Setup

1. XCL_UMA_SHADOW=1 removes the device on AMD before the title's device exists
With the switch open_uma does not try OpenExistingHeapFromAddress (which works on this card: main logs "UMA opened") and creates the coherent window as a 4095 MB heap of video memory instead; the driver removes the device inside that CreateHeap:

[0.367] D3D12.X: UMA not available to the GPU: CreateHeap (window 3, 4095 MB of video memory): ... (0x887A0005)
[1.293] D3D12 device removed: 0x887a0020 (internal driver error)
[1.297] unhandled exception 0x80000003 in game_scarlett_master.exe+0x2474606

Smoke (60 s): exit 0x80000003, 1 device removal, 2 crashes. So on AMD the switch has to stay off; the description could say it is for GPUs without OpenExistingHeapFromAddress.

2. Without it: smoke 60 s like main

xcl-smoke v1
commit: f7e08e6c1eb801215dd045cf46dd35631dca0d2c
gpu: AMD  Radeon RX 7800 XT
title: 0da1204f
seconds: 60
exit: 0x0
frames shown: 1261 (PresentX 1261)
presents per 2 s (last 3): 0 0 6
device removals: 0
crashes: 0
peak commit: 24598 MB

(main 568e7db this morning, HLSL path, defaults: 1220 frames, 26716 MB.)

3. Two 300 s runs (XCL_PSO_TRACE=1 XCL_RUN_SECONDS=300, A at the start screen): menus and loading, then a black window to the end

  • Run 1 (driver cache cold for the direct DXIL form): 1486 frames; run 2: 1451 frames. No device removal, no crash, 0 draws and 0 dispatches skipped. Draws stop growing at 12 768 (run 1, 93 s) / 12 243 (run 2, 78 s), dispatches at 8 192: from there on the title waits for CreateComputePipelineState on its own thread.
  • No program is refused in these runs: with the compact direct DXIL form (main e591a8c) the 22.8 MB (HLSL) / 3.9 MB (direct, yesterday) ActivateProbes record 56c0cd3b82a00c6e is 417 468 B; the biggest DXIL of the two runs is 1 254 828 B. The other giant, ActivateRays 95cc13288a27a96e, was not asked for within the 300 s here; on main it was (see 4): 3 345 980 B, not in the compact form, and its compile never returned.
  • The AMD driver takes 12–40 s per such program, 15–67 ms per KB of DXIL, serially on the title's thread: run 2 has 23 compiles over 10 s (290–330 KB programs at 12–14 s each, one after the other from 93 s to the end; 1.25 MB in 39.9 s; 1.10 MB in 16.6 s; 770 KB in 25.5 s; 56c0cd3b82a00c6e in 27.8 s). Driver compile time per 30 s bucket in run 2: 33, 26, 56, 97, 54, 26, 27, 26, 40, 25 s.
  • The slow programs of run 2 are almost all records run 1 never created (21 of 23): the title asks for different pipelines each run, so a warm run does not get past them; 1035 of 1242 compiles in run 2 still had no driver blob (207 had one, from the 128+ kept in run 1).
  • 40 mesh pipelines refused ("MS in the AS slot without a translation"), as on NVIDIA.

So on RDNA3 this tree reaches where main reaches: the hang and freeze fixes cannot be judged here, because the world never starts rendering within 300 s. The obstacle is the AMD driver's compile time for 300 KB–1.3 MB direct-DXIL compute programs created synchronously by the title, not a gate of XCL's (these compiles are the title's own, synchronous ones; the background gate of #1774 / #1924 is not involved).

4. Control: main 568e7db, same switches, same 300 s run
1532 frames, no device removal, no crash; draws stop at 13 889 (81 s), dispatches at 8 192; the same chain of 270–330 KB compute programs at 12–14 s each on the title's thread from 174 s to the end; 40 mesh pipelines refused. ActivateRays 95cc13288a27a96e (3 345 980 B direct DXIL, not compact) started in the driver at 113.8 s and had not returned at 300 s. On RDNA3 this branch and main behave the same within 300 s.

Not tested

  • The commits from 16826cb on in the world (not reached); NVIDIA; cold HLSL path on this branch; a run longer than 300 s.

AI use: Claude Code (Claude Fable 5.1) read the logs and wrote this report; the runs were mine.

@frenziedcoder

Copy link
Copy Markdown

RTX 5080 16 GB / 64 GB RAM, Windows, this branch unchanged: 4df1e6e with XCL_UMA_SHADOW=1 plays the intro's overlay for ~100 s at 4–6 fps over a grey scene, then the device is removed (DRED: page fault at GPU VA 0x0). f7e08e6 and 41303e4 without the shadow lose the device as the loading artwork fades.

@imnicho's 5080 report above is of 41303e4 plus seven other PRs, so these are the branch heads as they are, on a machine where RAM is not the limit.

Setup

  • NVIDIA GeForce RTX 5080 16 GB (driver 617.14, 32-lane waves), AMD Ryzen 7 9800X3D, 64 GB RAM, Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0, release. No local changes.
  • The newer retail title of Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505, XCL_NETWORK=0 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, A pressed every 4 s from 20 to 120 s, XCL_FRAME_DUMP=30. A guard kills the run above 15,900 MiB of GPU memory (nvidia-smi) or below 2–8 GB of free RAM. It never fired.
  • Caches: xcl shaders <pack> --precompile --only cs --pipelines with XCL_PRECOMPILE_SLICE=i/4, XCL_DXC_THREADS=3: all 2,689 compute pipelines, 0 errors, 0 refused, in 35.6 min (CPU-bound, 8 cores / 16 threads), min free RAM 32 GB. In the game, compute pipelines came from the driver cache; graphics pipelines were built in the game (134 in the first, cold run).

Runs

run head shadow first ListX #101 presents after it end
W1, graphics cold f7e08e6 off 70.1 s 23 (GPU idle ~74–386 s while 124 graphics PSOs build) 0x887a0005 at 405.8 s
W2, warm, XCL_DRED=1 f7e08e6 off 58.9 s 221, ~1 per 2 s from 72 s, GPU 100 % 0x887a0005 at 115.7 s, DRED page fault at VA 0x0
W3, warm, DRED 41303e4 off 69.6 s 38, ~1 per 2 s 0x887a0005 at 84.8 s, DRED page fault at VA 0x0
W4, warm, DRED, 600 s 4df1e6e on 49.2 s 739: 8–13 per 2 s from 266 to 366 s presents stop at 366 s (256 submits / 12,875 dispatches until the end); 0x887a0005 at 578.0 s, DRED page fault at VA 0x0
  • Every removal is followed by the title's int3 at +0x2474606 (Crash 0x80000003 at game_scarlett_master.exe+0x2474606 #1508). DRED lists no allocation at VA 0x0 and none recently freed. No System event 4101, no WHEA. 0 GPU waits released on the CPU, 0 skipped draws or dispatches in all four runs.
  • Without the shadow (W1–W3), the frame before the removal is the loading artwork, the next one blank: the removal comes as it fades, as in @joeypercia's 4070 Ti runs of f7e08e6.
  • With the shadow (W4) the frames from 266 to 366 s are the intro's 2D overlay over a uniform grey scene, as @imnicho describes. Local video memory per XCL's log went from 20.0 GB at 250 s to 21.4 GB at 378 s; nvidia-smi stayed at 15.8 of 16 GB the whole time. Peak process commit 41.3 GB, min free RAM 16 GB, so 64 GB of RAM leaves room (@tiagonleal's 32 GB ran out). Video memory is the limit on 16 GB.

Not tested: more than one run per row; 4df1e6e without the shadow; NVIDIA drivers ≥ 620 (617.14 here: no blue screen in these four runs); AMD.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine, read the logs and wrote this report; I checked it.

@dhillonjagdeep650-boop

Copy link
Copy Markdown

Two tests of 4df1e6e stop in their helper in a debug build, before they test anything: pieces_hold_the_texels_of_their_levels and gpu_parts_of_a_texture_go_up_and_the_rest_stays panic with attempt to multiply with overflow in some_ranges (texture_upload.rs, n = n * 1103515245 + 12345).

With n = n.wrapping_mul(1103515245).wrapping_add(12345) both pass, so the uploads they check are fine here.

Tested

  • RTX 3080 Ti 12 GB (driver 617.42), Ryzen 7 5800X, Windows 11 Pro 26300.9974, rustc 1.98.1 msvc, DXC 1.8.2502.11, debug
  • 4df1e6e merged into a local tree that also has 741cb5a, D3D12.X: read DRED PageFault1 ObjectNameW and name internal resources #2131 and two local diagnostic commits (748753d); the helper is the same line in 4df1e6e
  • cargo test -p xcl --locked --lib -- --test-threads=2: 1149 passed, 2 failed (the two above), 26 ignored
  • ... --lib -- hle::d3d12x::texture_upload --test-threads=1 with the wrapping helper: 7 passed, 0 failed, 3 of 3 runs

Not tested

  • 4df1e6e on its own; the integration tests; release

AI use: Claude Code with Claude Opus 5.5 ran the tests, made the one-line experiment and wrote this.

@CharlyRien

Copy link
Copy Markdown

A data point for the grey scene behind the HUD: on another tree, the two causes this description names (#541 / #2092 and #697), taken together, are enough to get the retail title's world geometry into the depth target and the G-buffer. Numbers and limits: #697 (comment)

Setup in short (the full block is in the linked comment): main 689f2db + #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640, #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits from wondercrash/xcl, then #541, #2092's 3442b58 state, #1887, #1803, plus local changes; XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1; RTX 3090 24 GB (driver 616.56), Windows 11 22631; one clean run and one partial run.

What had to be there, beyond #541 + #2092 + #1803 as they are:

With both: 115 of 241 indirect mesh draws arrive with groups, 861 of 1 003 two-pass record headers carry real meshlet counts, and the main depth target is 91 – 100 % away from its clear value, with a character and the scene visible in the dumps. With either one alone nothing is rasterised (the culling that feeds the mesh draws reads its object lists from the GPU view too).

Not there yet: the scene's HDR colour target stays black and the presented frame is still close to uniform; the device is still removed about two minutes into the world (#1452).

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.