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>
@shortside

Copy link
Copy Markdown

A Mac data point for the stop @kole07139 describes above (#2057 (comment)) and again on main in #1773 (comment): the same sequence shows up on Apple's D3DMetal, on a different tree, so it does not look tied to NVIDIA or to this branch. On the Mac the title then goes on for two more frames before the queue stops.

Setup. Not this PR's tree: @vakaobr's mac/integration at 5f9a58f (the Mac branch mac7 plus #615, #1405, #1993 and Mac fixes, see #258), release build. MacBook Pro M5 Pro, 24 GB, macOS 27.2.1, CrossOver 26.3, D3DMetal (32-lane waves). The retail title of #505 (my own copy), device_type = "lockhart", raytracing = "off", XCL_VRAM_ARENAS=1 XCL_PSO_WAIT_MS=50, HLSL path, compute pipelines built as the title asks for them, A pressed every 6 s. One run, 330 s. Details of the three runs of that evening are in #258 (comment).

The sequence

s what the log has
up to 193 37 – 47 presents per 2 s
194.9 – 195.1 8 × Wait64BitValueX at … >= 0xeec bridged to GPU queue.Wait (waiter=q0/q2/q3/q4, prod=qSome(1)/tySome(0); wait-before-signal, after_write64=false)
195 – 197 0 presents, 7 submits, 4,812 dispatches in the 2 s window
196.5 split command list (type 2) around mid-list Wait after Write64 (#1)
197 – 221 no presents, almost no submits; compute pipelines are being built (one of 823,448 B of DXIL took 5.5 s at 221 s)
220.8 – 222.3 splits #2, #3, #4
221 – 226 two presents, with 2,533 and 6,044 dispatches and 74 and 222 draws in their 2 s windows; on screen one flat colour after black
229.4 4 × GPU queue.Wait at … >= 0xeee did not complete within 5000 ms (… recorded=0xeef, submitted=0xeed/0xeee, completed=0xeed) – released on CPU to prevent GPU hang
after no present; writes after the GPU … although their queue had not got there after 10000 ms every 10 – 20 s; the title's stall watchdog fires three times and is skipped; D3D12 queue drain: GPU fences still pending after 10 s at exit

Same as on the RTX 3070: the burst of dispatches with no presents, the mid-list split right after it, the Wait64BitValueX … wait-before-signal lines, and a flat-colour frame followed by black.

Different: here the producer of every wait is named (prod=qSome(1) or qSome(4), none qNone), the title presents twice more about 25 s after the first split, and the stop is reported: the GPU-wait watchdog releases four waits at 229 s. I have no thread dumps of that run, so I cannot say what the title's threads wait on.

Not tested: this PR's tree on the Mac; main; a second run; compute pipelines built ahead (the 25 s without presents may be nothing but pipeline builds).

AI use: Claude Code with Claude Fable 5.2 built the tree, ran the run on my machine, read the log and wrote this comment.

Ariorh1337 added a commit to Ariorh1337/xcl that referenced this pull request Nov 25, 2026
`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 lane per title queue: a fence the title's queue
signals after its lists, and a queue of its own that GPU-waits for that
fence. The submitting thread returns. With one fence for all title
queues, a later signal on another queue let a copy start before its own
queue's lists ran (CharlyRien); with one queue for all, a title queue
waiting for work still to come held back the copies of the others.
The lanes (8) are made in `init`, before the device's methods are hooked:
made later, a lane's queue was adopted as one of the title's, and the e2e
title under the debug layer read 0 for what its lists wrote.
A copy back's allocator and list are made with the device's own methods,
past its hooks (`real::create_own_list`), as `init`'s objects are: made
through the adopted device, the list took XCL's list hooks on the lane's
queue, and vkd3d-proton crashed at its Close (St5sz2Jk, RDNA4 / Wine).
Tiles quarantined behind the title queues' marks (xcl-dev#2345) also wait for
the copies back still to run on a lane: they read the windows after the
title's work. A lane serves
a title queue while that queue has copies back in flight; with all lanes
busy (or none made), the old path runs. Readback buffers are sized to the
copy (64 KiB and up) and reused; idle ones above 256 MB are given back
(each holds commit, and with the title's queues stalled every submit's
copies wait, one buffer each; found by Chrysana's RDNA4 run). Each time the
buffers pass another doubling from 64 MB, their size is logged.

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 (waiting for the copy once the title's lists it
  follows are done), and in the CPU memory waits of Wait64BitValueX, which
  only try the sparse state's lock: its holder can be waiting for work the
  waiting thread is to submit;
- 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.
  These only try the lock; a copy whose title work is done but which still
  runs is waited for with the lock let go, then landed. Waiting for it with
  the lock held stood every submit behind a copy that stood behind a stalled
  GPU (lucsoft, RDNA3).
Lanes land in their own order, so an older copy back of one lane can land
after a newer one of another: it leaves the bytes the newer one landed.
A CPU wait for a copy uses its lane's event, not the sparse state's: a wait
that gave up leaves its registration behind, which set the shared event
later and ended a tile-queue wait early (theaustinayers, in xcl-dev#2057).

Tests:
- `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;
- `a_copy_back_waits_for_its_own_title_queue`: two title queues, the first
  blocked; with one lane for both, the first one's copy lands before its
  list ran;
- `an_older_copy_back_does_not_overwrite_a_newer_one`.
- `a_copy_still_running_after_its_title_work_is_waited_for_outside_the_lock`.
- `idle_copy_back_buffers_above_the_cap_are_given_back`.
- `a_copy_back_list_of_an_adopted_device_is_not_adopted`.
- `quarantined_tiles_wait_for_copies_back_still_to_run`.
They run on a WARP device of their own: they block a queue on purpose, and
on the GPU's device, which the tests in the process share, other queue
tests then hung in the driver releasing resources (upipibi; reproduced in 3
of 3 runs of the d3d12x queue tests). 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>
@BillyBuilds

BillyBuilds commented Nov 25, 2026 •

Copy link
Copy Markdown

RTX 5070 (32-lane waves), 32 GB RAM, Windows 11, driver 621.40. Tree: this branch at 4df1e6e
(same tree as @frenziedcoder's rows). Retail title of #505, 1.0.2.1. Env: XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_DRED=1, raytracing off in xcl.toml, A pressed by hand at the
account prompt.

Setup: all compute pipelines precompiled first (--precompile --only cs --pipelines,
XCL_PRECOMPILE_SLICE over i = 0..3): ~2,900 pipelines, 0 refused, ~3,800 driver blobs / 1.3 GB,
all on 621.40.

Result, one run:

  • boot to menus ~4 s, ~8 fps through the menus and into the load, 900 frames presented by t=121 s
  • world load: long stall while graphics PSOs built cold (122 of the 256-512 KB class at 3-8 s each
    on this driver); the precompiled compute ones came back blob-supplied in 0.3-0.5 s, the >1 MB
    ones included
  • run stayed alive 1704 s, then a device removal: DRED page fault at GPU VA 0x0, the title's own
    crash handler (0x80000003) right after. Same fault as the RTX 5080 at 424 s here, at 4x the
    runtime and with half the RAM (32 GB).

Cold driver-compile times for the big compute programs on 621.40 (earlier runs, same tree, before
the precompile): 265 KB ~ 3 s, 700 KB ~ 43 s, 1.0 MB ~ 2 min, 1.5 MB ~ 4 min, 3.3 MB ~ 5.3 min -
roughly quadratic in DXIL size. With the blobs, the same >1 MB programs bind in ~0.5 s.

A note on XCL_PRECOMPILE_SLICE for the next tester: i/n selects the shaders whose index % n == i,
so i runs 0..n-1 - 4/4 and 8/8 quietly select nothing (an empty 0.6 s run).

Everything the run built is banked; I'll re-test the newer head of this branch with warm caches.

AI use

  • Cline (VS Code) with an abliterated GLM-5.3-Flash model read this run's xcl.log and
    eport.json and wrote the text above; the run, the precompile, the hardware and the A press at the prompt are mine, and every number comes from that real run.

Follow-up - second run, same env, one local diagnostic patch on top of 4df1e6e

I added 16 lines to log_device_removed (crates/xcl/src/hle/d3d12x/real.rs): log when GetAutoBreadcrumbsOutput() returns Err, when its node list is empty, and the node count when it is not. Happy to send it as its own PR if wanted.

Run 2 died at t=533 s with the same 0x887a0005 / DRED page fault at GPU VA 0x0 (both allocation lists empty, again). The new line:

DRED: no auto-breadcrumb nodes (the driver's list is empty)

So on driver 621.40 the call succeeds but the head is null: SetAutoBreadcrumbsEnablement(FORCED_ON) is set at init, GetPageFaultAllocationOutput() works, yet no breadcrumb nodes ever come back. The op-level DRED: list ... operations done, around: ... lines XCL already prints cannot appear on this driver. If someone sees breadcrumbs on another NVIDIA driver or on AMD, that difference is worth posting; on 621.40 the page-fault output is all DRED gives.

Two smaller things from reading this run's log:

kole07139 pushed a commit to kole07139/xcl that referenced this pull request Nov 25, 2026
A retail title's world load can stop with no GPU-wait time-out: presents,
submits and DirectStorage requests go to 0 and every thread waits. The
watchdog's summaries of pending title fences and of XCL's own unmet queue
waits are only logged at a time-out, so such a stop did not say whether
a fence or a queue was behind.

At each XCL_THREAD_DUMP_AT dump XCL now logs the two summaries and the
number of armed GPU waits, on a thread of its own so that a lock the
stall holds cannot hold up the next dump. On xcl-dev#2057's tree this showed
every fence and queue caught up at 135, 200 and 300 s after a stop at
110 s (xcl-dev#2057 (comment)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW
Ariorh1337 added a commit to Ariorh1337/xcl that referenced this pull request Nov 25, 2026
`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 lane per title queue: a fence the title's queue
signals after its lists, and a queue of its own that GPU-waits for that
fence. The submitting thread returns. With one fence for all title
queues, a later signal on another queue let a copy start before its own
queue's lists ran (CharlyRien); with one queue for all, a title queue
waiting for work still to come held back the copies of the others.
The lanes (8) are made in `init`, before the device's methods are hooked:
made later, a lane's queue was adopted as one of the title's, and the e2e
title under the debug layer read 0 for what its lists wrote.
A copy back's allocator and list are made with the device's own methods,
past its hooks (`real::create_own_list`), as `init`'s objects are: made
through the adopted device, the list took XCL's list hooks on the lane's
queue, and vkd3d-proton crashed at its Close (St5sz2Jk, RDNA4 / Wine).
Tiles quarantined behind the title queues' marks (xcl-dev#2345) also wait for
the copies back still to run on a lane: they read the windows after the
title's work. A lane serves
a title queue while that queue has copies back in flight; with all lanes
busy (or none made), the old path runs. Readback buffers are sized to the
copy (64 KiB and up) and reused; idle ones above 256 MB are given back
(each holds commit, and with the title's queues stalled every submit's
copies wait, one buffer each; found by Chrysana's RDNA4 run). Each time the
buffers pass another doubling from 64 MB, their size is logged.

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 (waiting for the copy once the title's lists it
  follows are done), and in the CPU memory waits of Wait64BitValueX, which
  only try the sparse state's lock: its holder can be waiting for work the
  waiting thread is to submit;
- 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.
  These only try the lock; a copy whose title work is done but which still
  runs is waited for with the lock let go, then landed. Waiting for it with
  the lock held stood every submit behind a copy that stood behind a stalled
  GPU (lucsoft, RDNA3).
  Until they landed, the title is not told its work is done: the thread-pool
  wait tries again every millisecond before it sets the title's event (10 s
  at most), and `GetCompletedValue` gives no more than the value the fence
  was last seen at with its copies landed (its initial value at first).
  Before, a lock that could not be had let the title read stale memory
  (bmjask).
Lanes land in their own order, so an older copy back of one lane can land
after a newer one of another: it leaves the bytes the newer one landed.
A CPU wait for a copy uses its lane's event, not the sparse state's: a wait
that gave up leaves its registration behind, which set the shared event
later and ended a tile-queue wait early (theaustinayers, in xcl-dev#2057).

Tests:
- `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;
- `a_copy_back_waits_for_its_own_title_queue`: two title queues, the first
  blocked; with one lane for both, the first one's copy lands before its
  list ran;
- `an_older_copy_back_does_not_overwrite_a_newer_one`.
- `a_copy_still_running_after_its_title_work_is_waited_for_outside_the_lock`.
- `idle_copy_back_buffers_above_the_cap_are_given_back`.
- `a_copy_back_list_of_an_adopted_device_is_not_adopted`.
- `quarantined_tiles_wait_for_copies_back_still_to_run`.
- `a_title_fence_shows_its_work_done_only_once_copies_back_can_land`: an
  adopted fence, the sparse state held by another thread.
- `a_fence_value_goes_past_its_landed_copies_only_once_they_land`.
They run on a WARP device of their own: they block a queue on purpose, and
on the GPU's device, which the tests in the process share, other queue
tests then hung in the driver releasing resources (upipibi; reproduced in 3
of 3 runs of the d3d12x queue tests). 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>
@justrhoto

Copy link
Copy Markdown

RTX 4070 Ti SUPER 16 GB: #2057 with the fixes from this thread, merged with main at c56e744 (70 commits behind main now). The compute pack, chain pipelines included, now loads from kept blobs, so compute no longer stalls. What remains: graphics pipelines built cold leave draws skipped (58–78 % in the first runs: a grey world with only the 2D overlay drawn; 24 % by the third), and the device is removed at 328–373 s in every run.

Tree: justrhoto/xcl@pr2057-tree-main2:

Head 06053a1 (justrhoto@06053a1), no uncommitted changes.

Setup

Tests: cargo test --release -p xcl --lib -- --test-threads=4: 1327 passed, 0 failed, 26 ignored.

  • SKIPPED: the no wave64 tests, one no dxil.dll, one 0x887A002D, and f16 refusals.
  • This was the xcl lib only, not --workspace.

Precompile: xcl shaders <pack> --precompile --only cs --pipelines with XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1, in four processes (XCL_PRECOMPILE_SLICE=0/4 … 3/4).

  • All four finished with 0 refused.
  • 14 144 .chain.pso blobs and 9 922 plain compute blobs are on disk.

Title runs: XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_COHERENT_HEAPS=sparse:16 XCL_LOOK_SKIP=1 XCL_WATCH_HOT=0 XCL_COHERENT_MB=512. Three runs on 06053a1, each keeping the graphics blobs of the runs before it:

run 1 run 2 run 3
compute pipelines compiled in the run 2 (727 from kept blobs) 0 0
graphics pipelines 36 cold, 1 from disk 45 cold, 26 from disk 47 cold, 69 from disk
driver time on huge graphics compiles 216 s 309 s 272 s
longest wait at the huge-compile gate 85 s 163 s 117 s
draws skipped (pipeline still building, #1798) 68 998 of 118 908 (58 %) 113 395 of 146 234 (78 %) 64 221 of 266 175 (24 %)
dispatches skipped 0 0 0
end 0x887a0006 at 373.3 s, then the title's int3 at +0x2474606 device removed at 355.6 s (first seen as 0x887a0005 on CreatePlacedResourceX), then the same int3; the process then hung and had to be ended device removed at 327.9 s (0x887a0005 on CreatePlacedResourceX), then the same int3
  • Compute: fixed by the precompile change. The fps drops now line up with the huge graphics compiles, which run one at a time behind the gate.
  • Picture (runs 1–2): grey 3D, with the 2D overlay (minimap, credits text) drawn. This matches the skipped draws. Each run keeps its graphics blobs: by run 3 the skipped share fell to 24 %.
  • Before the removal: nothing in the log points at a cause.
    • no Wait64BitValueX timeout;
    • no GPU-wait watchdog line;
    • no mid-list Wait64 split.
    • The only unusual notes are "a command list is submitted while its previous submit is still on the GPU" (12–13 per run), and the "command list reset while its last submit is on the GPU" / allocator put-aside counters.
  • The hang: after the removal in run 2, the log stops 0.15 s after it, and report.json was written only when I ended the process.

Next: a run with XCL_DRED=1 to name the work in flight at the removal. I'll edit this comment with the result.

Not tested

  • cargo test --workspace and the integration tests; scripts/smoke.ps1.
  • Graphics pipelines precompiled.
  • XCL_HUGE_PSO_CONCURRENCY above the default.
  • XCL_DRED / XCL_GPU_PROFILE on this head.
  • Without XCL_UMA_SHADOW.
  • AMD.

AI use: Claude Code (Claude Opus 5.5) did the following:

  • merged the tree with main;
  • wrote the --pipelines chain fix and its test;
  • ran the unit tests;
  • read the runs' logs and reports;
  • drafted this comment.

I ran the precompile and the title, and checked the comment before posting.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 26, 2026
- title_textures.rs / kernelx.rs / present.rs: integrate xcl-dev#2057 hot-block
  write-watch (with Wine-tuned 4 MiB gap, 15 s hot TTL, and throttled walk),
  1 MiB src_pieces index, incremental GPU-view remap tracking, and PresentX
  skip; bound watched ranges to actual textures/sparse/mirrors via WATCH_TEX_GEN
  instead of 60+ GiB uncommitted reservations.
- title_textures.rs / texture.rs: integrate xcl-dev#455 pooled non-blocking uploads on
  the submitting DIRECT queue (128 MiB in-flight cap, cross-queue GPU fence
  ordering via wait_other_upload_queues, stalled-queue guard), VEH-guarded
  xcl_safe_memcpy bypassing Wine ReadProcessMemory IPC, reusable DETILE_POOL
  buffers, and avoid ephemeral thread::scope spawns for small Wine batches.
- tiling.rs / uma.rs: add detile_level_into buffer reuse with specialized inner
  loops; fix Uma::is_committed / in_committed_window bounds checks against
  WindowKind::Committed size.
- sparse.rs / cpu_writes.rs / list_x.rs: unlock STATE during GPU copy wait,
  route immediate Write32/64 and WriteTimestamp to sparse windows through
  per-queue cpu_writes workers while keeping Copy/Fill synchronous.
- alloc_pool.rs / real.rs / host.rs: wait briefly under Wine before resubmitting
  in-flight command lists (debug layer id 553) and add 2 s perf breakdown under
  XCL_ACTIVITY=1.

Assisted-by: Antigravity (Gemini 4 Neon)
@xpatfussy69x

xpatfussy69x commented Nov 26, 2026 •

Copy link
Copy Markdown

A run of this merged tree in the retail title (1.0.2.1) on a 12 GB card, since the description says it has not run in the game yet: it stops presenting at ~82 s, earlier than main on the same machine, with local video memory at 21.6 GB on a 12 GB card; the first loading screen flickers.

Tested

  • Exact head 4df1e6e (clean), release. NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only, the suite reports "no heap windows" on this adapter), AMD Ryzen 5 7500F, 32 GB RAM, Windows 11 (26300), Rust 1.100.0.
  • Your switches: XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_COHERENT_HEAPS=sparse:16 XCL_LOOK_SKIP=1, plus XCL_NETWORK=0, XCL_FRAME_DUMP=300, A every 4 s from 20 s, scripts/smoke.ps1 -Seconds 300. Compute pipelines not built ahead; driver-blob cache warm from earlier runs of main today.
xcl-smoke v1
commit: 4df1e6e3d40a011501c046148b6aa470437aa2eb
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 300
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 41611 MB

What happened

  • Menus at 30 fps; the first loading screen flickers (seen at the screen; it did not on main 08db802 with default settings on this machine). The frame dumps, one per 300 frames, are too sparse to show it.
  • Presents fall off from ~56 s and stop at ~82 s; none after, to 300 s. The last dumped frame (1520) is black.
  • Local video memory: 19.4 GB at 60 s, 21.6 GB from 80 s (the XCL_UMA_SHADOW window adds 4 095 MB); peak commit 41.6 GB. No out-of-memory message, no device removal.
  • From 106 s: ExecuteIndirect of CS … arguments at … – out of range, not run for three programs (9387facebc35be6d, 4401d482ef24797c, 1ada490879c33c0e; 46 so far at the first line).
  • Still building compute pipelines at the end (D3D12.X: XCL_DRED=1 names the pipeline bound where the GPU faulted #1592 at 296 s, 754 284 B DXIL, no driver blob).

For comparison, main 08db802 on the same machine and route (no switches, 180–240 s): presents to ~150–162 s, then the story-load stall of #846, local video memory up to 13.9–14.8 GB; XCL_PSO_WAIT_MS=50 and title_memory_mb = 10240 do not change that, and Series S mode (XCL_DEVICE_TYPE=lockhart) ends in the title's assert with E_OUTOFMEMORY at 161 s.

Update: the loading-screen flicker is the hot-block looks (7c18bc4); XCL_WATCH_HOT=0 removes it. Same head and machine, 70 s runs, A from 20 s, every 3rd frame dumped (XCL_FRAME_DUMP=3). A frame counts as a flicker when it differs from both neighbours while they agree; on the loading screens these are all black frames, often 24 frames apart (914, 938, 962, 986, 1010 in the run with every switch). One fade frame the title draws itself, present in every run including main, is left out.

tree, switches black frames (of ~500 dumped)
main 08db802, none 0
this head, none 4
this head, XCL_DIRECT_DXIL=1 only 0
this head, XCL_HEAP_WINDOWS=1 only 0
this head, XCL_COHERENT_HEAPS=sparse:16 only 5
this head, XCL_LOOK_SKIP=1 only 5
this head, XCL_UMA_SHADOW=1 only 8
this head, all five 34
this head, none, XCL_WATCH_HOT=0 0
this head, all five, XCL_WATCH_HOT=0 0

That fits the trade-off the description names: with hot looks a write to a block idle for 1.5 s (XCL_WATCH_HOT_MS) is found by the walking thread ~10 ms later, so a submit can go before the loading screen's CPU-written data; with XCL_UMA_SHADOW the GPU reads only that uploaded copy. One run each, so the counts are rough.

Separately: the all-switches run with XCL_WATCH_HOT=0 lost the device at 56 s (0x887a0006, then the title's assert at +0x2474606). One run; the all-switches runs with hot looks on (70 s and 300 s) did not, so I do not attribute it to the switch.

Not tested

  • Which switch causes the early stop (one 300 s run, all switches together); this tree with pipelines built ahead; the older base 7f7e768.

AI use

  • Claude Code (Claude Opus 5.5) built the tree, ran it on the machine above, read the log and frames and wrote this report; the flicker was seen by the person at the screen.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
A retail title's world load can stop with no GPU-wait time-out: presents,
submits and DirectStorage requests go to 0 and every thread waits. The
watchdog's summaries of pending title fences and of XCL's own unmet queue
waits are only logged at a time-out, so such a stop did not say whether
a fence or a queue was behind.

At each XCL_THREAD_DUMP_AT dump XCL now logs the two summaries and the
number of armed GPU waits, on a thread of its own so that a lock the
stall holds cannot hold up the next dump. On xcl-dev#2057's tree this showed
every fence and queue caught up at 135, 200 and 300 s after a stop at
110 s (xcl-dev#2057 (comment)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
A retail title's world load can stop with no GPU-wait time-out: presents,
submits and DirectStorage requests go to 0 and every thread waits. The
watchdog's summaries of pending title fences and of XCL's own unmet queue
waits are only logged at a time-out, so such a stop did not say whether
a fence or a queue was behind.

At each XCL_THREAD_DUMP_AT dump XCL now logs the two summaries and the
number of armed GPU waits, on a thread of its own so that a lock the
stall holds cannot hold up the next dump. On xcl-dev#2057's tree this showed
every fence and queue caught up at 135, 200 and 300 s after a stop at
110 s (xcl-dev#2057 (comment)).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZrhsCAiLU1tTuEBwPLaRW
@throny throny added the goal:world-load Bears on the retail title getting past world loading label Nov 26, 2026
@PACDevX

PACDevX commented Nov 26, 2026

Copy link
Copy Markdown

I tested offline shader precompilation at eae015021 on an RTX 3090 (driver 621.24, Windows Sandbox vGPU) with 16 descriptor-heap windows and split wave64.

  • With the stock binary, the CLI enumerated 29 ACCC/FSPX compute containers and reported 0 compiled, 0 PSOs, and 0 errors. The bulk loop filters those containers at xbox::parse; the runtime has a separate FSPX compute path.
  • I routed valid FSPX through the existing offline compute path in shaders.rs. The same 29 inputs then produced 29 translations and 29 D3D12 PSOs, with 0 translation errors, driver refusals, or pending duplicates. I verified all 29 translated-cache records in the 16-window namespace and all 29 new driver blobs.
  • The patch has CPU coverage for a valid synthetic FSPX container and a malformed one. Commit on my fork

AI assistance: OpenAI Codex for the patch, verification, and report.

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.