Skip to content

D3D12.X: build a split program's whole form as a background pipeline - #2372

Open
Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:chain-whole-async
Open

Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:chain-whole-async

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1269. Follows #2080 / #2107 / #2126.

A split compute program keeps its whole form for what its pieces can't run: an ExecuteIndirect, and a Dispatch with no allocator to keep its scratch, recorded in a bundle, or whose scratch allocation fails. On main that form is built in Chain::whole on the calling thread, the title's, the first time it's needed. A title thread's huge compile skips the huge-build slots, and XCL_PSO_WAIT_MS doesn't cover this path. Before the split, the same program was built through the async PSO path and its binds honoured the wait budget.

@claudetools-gh found this on #2080 (comment): from ~135 s their title's thread sat in bind::execute_indirect → dispatch_chain::whole → Chain::whole, building one 645–833 KB whole program after another, 20–35 s each, driver blob absent, with no present to the end of a 1,200 s run, XCL_PSO_WAIT_MS=50 set. Their local patch built the whole form on a thread of its own and kept the title presenting. Just above it, @KDenKC measured the same cold whole builds at world load after a full --precompile (comment): 28 cold compute builds of 10–23 s, one after another, and no present from 188 s.

With this change the whole form is built the way the unsplit pipeline would be: a lazy pipeline in pso_async, sent to the PSO workers when first needed. The huge-build slots, the driver blob cache and the orphan handling apply to it as to any other background pipeline. Its callers wait for it as a bind waits for an unsplit pipeline: up to XCL_PSO_WAIT_MS, after which the dispatch is skipped and counted until a worker has built it. With no budget set it waits until the pipeline is built, and builds it on the calling thread if no worker has started it, as main does now. So nothing changes by default; what this gives is that XCL_PSO_WAIT_MS now also works for split programs. Rebased onto the slab change (e9ddf17, 0829441): the slabs and the bounded scratch are main's, unchanged; only how the whole form is built and waited for differs.

What is in it

  • crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs:
    • The chain hands its whole form to pso_async::submit_lazy when the chain is built, under the chain's own address in place of a stand-in's.
    • Chain::whole resolves it with pso_async::resolve_wait_for and the bind's budget. It returns the pipeline, Building (skip the dispatch), or an error when the build failed.
    • The build itself is unchanged: compute_container with the chain's root signature and the .chain.pso blob. So a blob that a precompile writes for the whole form is still a hit.
    • forget releases the whole form, or marks it orphaned while it is being built, through pso_async::released.
    • The compute split: log line adds the whole forms asked for and built, and the dispatches skipped while one was being built.
  • crates/xcl/src/hle/d3d12x/bind.rs: ExecuteIndirect skips a dispatch whose whole form is still building and counts it as a skipped dispatch. Dispatch counts a fallback skip the same way.
  • crates/xcl/src/hle/d3d12x/console_list.rs: a console-list dispatch skipped this way counts as a skipped dispatch. Before, an error there ended the list's translation.
  • crates/xcl/src/hle/d3d12x/real.rs: under XCL_PSO_IMAGE_SKIP=1, a big image-only program's whole form is spared, as the unsplit pipeline would be (go_background).
  • crates/xcl/src/hle/d3d12x/pso_async.rs: resolve_wait_for and wait_budget are visible to dispatch_chain.
  • Test: a_whole_form_still_being_built_is_not_waited_for_past_the_budget (WARP when there's no GPU). A whole form whose build is held is asked for with a 30 ms budget. The test checks four things:
    • it returns Building within the budget, built on a xcl-pso worker and not on the asking thread;
    • a second ask doesn't wait again;
    • once built, it and dispatch_chain::whole hand out the pipeline;
    • forget drops the build's reference.

Tested

  • Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, Rust 1.99.0, DXC 1.9.2609.
  • cargo test --workspace -- --test-threads=4 (debug) on 9dd8715: 1273 passed, 0 failed, 46 ignored. 25 SKIPPED notices: 21 for no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and one for no heap windows.
  • cargo test -p xcl --lib -- <filter> --test-threads=4 (debug) on 9dd8715: dispatch_chain 10 passed, 0 failed (the new test ran; dispatch_chain_native_wave64_builds_whole skipped its GPU part, no wave64); split 32 passed, 0 failed, 1 ignored (the opt-in benchmark); execute_indirect 4 passed, 0 failed.

The title with a budget, as evidence for the case this PR is for (its runs are not the regression pair, which is below): scripts/smoke.ps1 -Seconds 300 with XCL_PSO_WAIT_MS=50 added, otherwise as the regression pair below (release builds, XCL_DIRECT_DXIL=1, the same private pipeline cache). @Eterst reported the same stop on #2080 with this budget set (comment): presents and submits stop for good at the title's first chained dispatches.

main 0829441 with XCL_PSO_WAIT_MS=50:

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 300
exit: 0x0
frames shown: 1322 (PresentX 1322)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 33147 MB

At 68.9 s the title's submitting thread, the one issuing its ExecuteIndirects, started a cold 790,016 B compute build, ungated (huge, ungated here (a title thread's …)). It took 149.7 s, and at 218.6 s the same thread started the next, 1,146,200 B. From 66 s to the end the run logged 0 presents and 0 submits. Presents per 2 s: 0 8 60 59 36 41 60 60 60 60 60 60 60 60 59 45 49 60 61 60 44 51 22 3 2 10 23 24 34 53 21 17, then 0 in all 117 remaining ticks.

This PR, 9dd8715, with XCL_PSO_WAIT_MS=50, run twice. Neither run reached its end, and neither crash is in this PR's code:

xcl-smoke v1
commit: 9dd8715e440251601ad7a65469e6e9106988e547
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 300
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 1 2 2
device removals: 0
crashes: 2
peak commit: 32113 MB
  • First run: presents per 2 s: 0 3 60 58 51 24 60 60 60 60 60 60 60 60 59 43 36 60 60 60 57 46 33 6 2 2 12 16 43 39 41 21 3 0 0 0 0 0 0 0 0 0 0 1 2 1 2 2. By 90 s it had asked for 64 whole forms, built none and skipped 473 dispatches; 33 of the 35 PSO workers were waiting for the huge-build turn (big_compile_turn), on unsplit compute pipelines. At 96 s it crashed in memcpy < tiling::Chain::detile_level < title_textures::subresources, on a subresources_on worker, reading title memory. That's the title-texture read racing a decommit (D3D12.X: title texture reads outside the coherent window use the safe copy #751, D3D12.X: tolerate concurrent page decommits in title texture reads #484); the same site crashed runs with no budget set on other PRs.
  • Second run: from 86 s to the crash the title presented 0–2 times and submitted 5–97 times per 2 s. By 140 s it had asked for 65 whole forms, built none and skipped 5,565 dispatches. Over the whole run, 18,031 dispatches and 25,067 draws were skipped, most for unsplit pipelines still being built. At 148 s the title crashed in its own code: a virtual call on one of its objects whose vtable pointer was null. Its crash handler then hung, so this run has no smoke block; the numbers are from its log.

Regression run

scripts/smoke.ps1 -Seconds 120, the same retail title, release builds from clean trees, run one after the other on the machine under Tested.

main 0829441 (this PR's base):

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1798 (PresentX 1798)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 29956 MB

this PR, 9dd8715:

xcl-smoke v1
commit: 9dd8715e440251601ad7a65469e6e9106988e547
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 30285 MB

PR vs main: 1654 / 1798 frames (92 %), peak commit 30285 / 29956 MB (101 %); device removals 0 and crashes 0 in both runs.

Both runs use XCL_DIRECT_DXIL=1 and no XCL_PSO_WAIT_MS. Each starts with the same private XCL pipeline cache, holding only the pipeline list; the driver's own cache was left alone. At 120 s the PR run logged compute split: 84 programs split, 772 pieces built, 92 chained dispatches issued in 92 slabs; scratch 68 MiB (most 68, largest dispatch 35 in one slab); whole form: 2 asked for, 2 built, 0 dispatches skipped while it was being built. The first whole form was asked for between 80 and 90 s, the second by 100 s. With no budget set both were waited for, as on main, so none was skipped. Presents per 2 s, PR run: 0 18 59 55 30 53 60 60 60 53 60 60 60 60 60 59 39 56 60 60 60 60 60 60 60 60 33 51 15 5 6 4 9 6 1 12 31 42 34 4 7 11 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0. main: 0 18 60 57 52 12 60 60 60 60 60 60 60 60 59 50 44 56 60 60 60 60 60 61 59 61 60 40 35 42 27 10 5 2 0 1 0 3 18 0 7 3 12 15 29 5 43 50 2 2 3 2 5 3 5 0 0 0 0.

Not tested

  • A budgeted run that stays up to its end on this title. With XCL_PSO_WAIT_MS=50 both runs of this PR crashed (above). Skipped dispatches under the budget can leave the title's state broken, as in the second run (a null vtable in the title's code). That's the budget's existing policy for any pipeline still being built: main skips the binds of unsplit pipelines the same way, and in that run most of the skipped dispatches were theirs. This PR applies the policy to whole forms too, where main blocks the title's thread instead.
  • How long whole forms take to build on the workers. None was built in either budgeted run (about 30 s and 80 s after the first ask, which both runs made between 60 and 70 s) while the huge-build turn was taken by unsplit compute pipelines.
  • @claudetools-gh's and @Eterst's setups weren't reproduced here, and this isn't claimed to fix their trees.
  • With no budget set, a whole form is still built on the title's thread when first needed, ungated, as an unsplit pipeline is without a budget. That's unchanged from main and deliberate here.
  • A skipped ExecuteIndirect counts as a skipped dispatch. An unsplit pipeline still being built under ExecuteIndirect counts as a skipped draw on main, and logs its own warning; this path has no warning of its own. pso_async still warns when a whole form goes late.
  • XCL_ASYNC_PSO=0 together with XCL_PSO_WAIT_MS: the whole form still goes through pso_async and honours the budget, while unsplit pipelines are built at creation in that mode.
  • Until its whole form is built, each split program adds one lazy entry to pso_async's still-building count (the compiling overlay, background_pipelines). Lazy unsplit pipelines that are never bound already count there the same way.
  • AMD; Linux.

AI use

Claude Code (Claude Opus 5.5) wrote the change, the test and this description, and ran the tests, the regression pair and the budgeted runs, and read the crash sites from their logs.

🤖 Generated with Claude Code

A split compute program keeps its whole form for what the pieces cannot
run: an ExecuteIndirect, and a dispatch with no allocator to keep its
scratch, in a bundle, or whose scratch allocation fails. That form was built in
`Chain::whole` on the calling thread, the title's, the first time it was
needed, ungated (a title thread's huge compile skips the huge-build
slots) and outside `XCL_PSO_WAIT_MS`. A retail title's ExecuteIndirect
of split programs then held its thread for one 20-35 s whole build after
another, with no present (reported on xcl-dev#2080).

The whole form is now a lazy pipeline in `pso_async`, behind the chain's
address as a stand-in's: it is sent to the PSO workers on first need,
where the huge-build slots and the driver blob cache apply as before (the
build itself, `compute_container` with the chain's root signature and its
`.chain.pso` blob, is unchanged). Its callers wait for it as a bind waits
for an unsplit pipeline: with `XCL_PSO_WAIT_MS` up to the budget, then the
dispatch is skipped and counted until a worker has built it; without a
budget, until it is built, built on the calling thread if no worker has
started it, as before. `XCL_PSO_IMAGE_SKIP` spares it as it would spare the
unsplit program. `forget` releases it, or marks it orphaned while it is
being built. The `compute split:` log line counts the whole forms asked
for and built and the dispatches skipped while one was being built.

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

upipibi commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

NVIDIA test report for 9dd8715 (head as is, base 0829441). RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, after cargo build --workspace:

  • cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 1264 passed, 0 failed, 46 ignored. The end-to-end title tests pass.
  • main 0829441 (this PR's base) on the same machine, same command: 1263 passed, 0 failed, 46 ignored. The extra pass is the new dispatch_chain::whole_tests::a_whole_form_still_being_built_is_not_waited_for_past_the_budget.
  • Skipped hle::xaudio2, because its tests fail or hang on this machine on main too. The PR doesn't touch it.
  • SKIPPED lines: 26: 21 no wave64 on this card, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off.

AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.

@b3IKK

b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Independent retail check on an RTX 5080 (retail 1.0.2.1, XCL_PSO_WAIT_MS=50, 600 s): on clean head 9dd8715, the run reports compute split: 0 programs split, 0 pieces built ... whole form: 0 asked for, 0 built for the whole run, so this PR's path is not exercised by this title. The run presented to 182 s and ended with the same 0xc0000005 at game_scarlett_master.exe+0x4e8b4be as its base 0829441 (which presented to 200 s; the difference is cache warmth between the two runs). No regression observed, but no validation of the whole-form change either: this title has no split programs, so #2338/#2372 do not apply to it.

Also, the Build and test check on 9dd8715 is red on gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which is not in the files this PR changes and passes on this GPU. Probably a no-GPU-runner flake, but it blocks the check.

AI use: OpenCode, Claude Fable 5.2 ran both 600 s retail runs, read the logs and wrote this.

@kole07139

kole07139 commented Nov 25, 2026 •

Copy link
Copy Markdown

RTX 3070 8 GB, Windows, main 55d64c2 against 55d64c2 + this PR (9dd8715), both with XCL_PSO_WAIT_MS=50, two runs each, alternated. With this PR the title kept presenting to the end of the 300 s run in both runs, and ran 10–40× more chained dispatches. On main presents stopped at ~106 s in one run and at 220 s in the other. The whole-form counter shows what it costs: 7 336 and 13 306 dispatches skipped while a whole form was being built.

@b3IKK's run above saw 0 programs split, so this PR's path did not run there.

  • Here it did: 121–247 programs were split in every run.
  • My guess, not checked in the code: the split is on the direct route only, and these runs have XCL_DIRECT_DXIL=1. A run without it would show the 0 he saw.

Setup

  • Hardware and software:
    • RTX 3070 8 GB (NVIDIA 617.42, 32-lane waves), i9-9900K, 32 GB RAM;
    • Windows 11 Pro N 26200, Rust 1.99.0, release.
  • Trees:
    • main 55d64c2;
    • 55d64c2 with this PR merged; it merges cleanly and touches no translator file, so both trees use the same caches.
  • XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_WAIT_MS=50 XCL_NETWORK=0 XCL_ACTIVITY=1, no XCL_UMA_SHADOW.
  • 300 s runs, A pressed every 5 s from 15 s.
  • Every compute pipeline was precompiled first (2 689 made, 0 refused).
  • Runs in the order main, PR, main, PR on the same caches.
run tree last presents presents after 110 s first mid-list Wait64 split compute split: at the end whole form (this PR's counter)
1 main 152 s (the stream ends at ~106 s, one present at 152 s) 1 105.6 s 121 programs split, 1 037 pieces, 227 chained dispatches –
2 this PR 300 s 727 175.1 s 176 programs, 1 522 pieces, 2 484 chained dispatches in 23 501 slabs 148 asked for, 43 built, 7 336 dispatches skipped while it was being built
3 main 220 s 1 289 219.5 s 247 programs, 2 080 pieces, 121 chained dispatches –
4 this PR 295 s 85 117.3 s 247 programs, 2 080 pieces, 4 981 chained dispatches in 49 964 slabs 200 asked for, 63 built, 13 306 dispatches skipped
  • On main:
    • presents end where the first mid-list split comes (105.6 s and 219.5 s);
    • after that the run idles, with no device removal.
    • Run 3 got further than run 1; one run each side does not settle by how much.
  • With this PR:
    • both runs still presented in their last 2 s window, and neither was removed;
    • run 4's presents after 110 s are sparse (85), run 2's denser (727);
    • the first mid-list split still comes (175 s, 117 s), but the title presents past it.
  • Thread dumps (added later, two more runs). Same trees, caches and settings, 240 s, XCL_THREAD_DUMP_AT=125,150,200. The XCL frames are symbolized with each build's xcl.pdb.
    • main 55d64c2: presents end at 132 s (first mid-list split at 132.6 s). At 150 s and at 200 s one title thread is in the same place, in both dumps:
      game+0x248cbc1 → bind::execute_indirect+0x8b0 → dispatch_chain::whole+0x17e
        → dispatch_chain::Chain::whole+0x2ca → Mutex::lock_contended
      
      That is the stall @throny traced on his RTX 4080: an ExecuteIndirect of a split program waiting for its whole form, on the title's thread.
    • This PR: presents to 235 s (first mid-list split at 125.1 s).
      • No title thread is in Chain::whole in any of the three dumps.
      • At 125 s two title threads are in pso_async::resolve_wait_for → Condvar::wait_timeout, the XCL_PSO_WAIT_MS bounded wait: one from bind::execute_indirect, one from a draw (draw_instanced → graphics_bound).
      • At 150 s and 200 s title threads are in texture uploads (title_textures::refresh_once → texture::upload_batch → fence::wait) and in XMemMapPhysicalPagesScatter, with stacks that change between dumps.
    • In both trees the title's main thread waits in its own code in all dumps; it is the same game frames in both.
  • Peak local video memory was 14.2–16.0 GB on this 8 GB card in all four runs (no XCL_TEXTURE_LEVEL_PAGES), and peak commit 30.5–34.7 GB.

Not tested

AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the six runs, symbolized the dumps, read the logs and wrote this report. I checked it before posting.

@KDenKC

KDenKC commented Nov 25, 2026 •

Copy link
Copy Markdown

RTX 5090 A/B, both arms cold: with this PR no huge pipeline is built on a title thread any more (13 → 0), but this run ended in the title's own int3 at +0x4da6315 124 s after the legal screens, before the point where the base froze. One run per arm, so a data point next to @kole07139's RTX 3070 pairs.

Setup

  • RTX 5090 32 GB (driver 621.24), Ryzen 7 9800X3D, 62 GB RAM, Windows 11 26200, rustc 1.99.1 MSVC, release.
  • Base 0829441 and head 9dd8715 (this PR as it is), each built clean.
  • Both arms cold: no precompile, a private empty XCL_DXIL_CACHE each, and each run under an exe file name never used before (xclc01.exe / xclc02.exe), since NVIDIA's implicit shader cache is keyed by the exe name.
  • XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_WAIT_MS=50 XCL_NETWORK=0, 600 s limit, fresh data folder, pad input through the menus. The two arms waited on the Legal Notices screen for different times (they left it at ~153 s and ~274 s), so the rows below are aligned on leaving it.
base 0829441 this PR 9dd8715
left Legal Notices ~153 s ~274 s
world starts drawing (> 2,000 dispatches per 2 s) +87 s +80 s
huge pipeline builds ungated here (a title thread's …) 13 0
whole form built on the title thread 2 asked for, 0 built, 120 dispatches skipped while it was being built
presents after leaving Legal Notices 1,021 986
end presents stop at +167 s (320.3 s; at the stop a title thread is building record 33743bd6d1e45443, 707 KB, cold, 318.3–334.8 s, and more such builds follow) and never resume to 600 s; no removal, no crash presents to +124 s (398.3 s), then 0x80000003 at game_scarlett_master.exe+0x4da6315; no removal
compute split at the end 163 programs, 1,421 pieces, 11,875 chained dispatches 5 programs, 10 pieces, 2,840 chained dispatches
peak local video memory / commit 16.4 GB / 36.5 GB 16.1 GB / 32.9 GB
GPU-wait timeouts 0 0

Not tested: more than one run per arm; warm or precompiled caches; XCL_PSO_WAIT_MS unset; the test suite on this head (@upipibi's run covers it).

AI use: Claude Code (Claude Opus 5.5) built both trees, ran both arms, read the logs and wrote this.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@KDenKC thanks for the 5090 run. On the low split count: nothing in this PR decides or counts the split differently, as far as the code and our own logs show.

  • Where the split happens: it is decided in translated_compute_pso_once before any driver compile, and counted in dispatch_chain::build after the pieces are built, both as on main.
  • What the PR changes: only how the whole form is built and waited for. Pieces are built by the worker that translates the program, and they aren't gated.

What we think differs is the work the run reaches. A big program is split only once a PSO worker translates it.

  • With the PR, the title keeps binding, so late huge unsplit jobs queue up. Each holds its worker while it waits for the huge-compile slot, and big programs behind them wait too.
  • Under the budget in our runs, 30 workers were parked on that slot at the crash. The slot was held all run by the preloader's 2.4 MB cold compile, which started at ~8 s and never finished, on main too.
  • Small programs are split at creation and still get through, which would fit your 5 programs / 10 pieces.
  • On main, the title freezes in the whole build, stops adding jobs, and the queue drains, so its count keeps rising.

Our two budgeted arms were the same to 60 s (79 programs split each). By 140 s it was 92 with the PR and 108 on main.

So this would be an existing limit the PR exposes: a job waiting for the huge slot keeps its worker. It isn't a change in what is split.

Your two arms ran different lengths after the legal screens (~430 s and 124 s), so the totals can't be compared directly. If you still have the logs, three things would settle it:

  • the compute split: line from each arm at the same time after the legal screens (base at about +124 s);
  • the number of compute PSO with the translated console CS lines up to then;
  • what the xcl-pso threads were doing at the end.

The 0x80000003 failfast is the one on #1833 / #2140. We can't tell from here whether the skipped dispatches lead to it.

AI use: Claude Code (Claude Opus 5.5) read the code and our logs and wrote this reply.

@thehollowedone

thehollowedone commented Nov 25, 2026 •

Copy link
Copy Markdown

Independent Windows integration check of 9dd8715 on 2898511. The local merge and workspace build passed. Workspace tests reported 1,364 passed, 0 failed and 46 ignored, including 26 runtime skips. The bridged-mask barrier test that failed in the older Windows CI run passed on this integration.

The dispatch-chain filter reported 10 passes, including one native-wave64 skip. The stock wait-budget test ran and passed. All five ExecuteIndirect tests passed with zero skips.

RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC and DXC 1.8.2502.11. Synthetic checks only. AI-assisted. Codex (GPT-6, exact variant unavailable) reviewed the local integration, ran the tests and drafted this report.

Update after #2118 merged: I integrated the unchanged head 9dd8715 locally with main e0d93c8, without a commit. The clean merge produced tree 7de7d09e8cc69ea08126212153b12baee2e278db, and git diff --check passed. This includes #2118's deferred dispatch scheduling.

On the same RTX 3080 Ti / NVIDIA 621.35 setup above, with XCL_NETWORK=0, XCL_ADAPTER=RTX 3080 Ti, SDK XCL_DXC_DIR, and no optional debug layer: cargo build --offline --locked --workspace --jobs 6 passed. The PR's a_whole_form_still_being_built_is_not_waited_for_past_the_budget test passed (1/0/0), and cargo test --offline --locked -p xcl --lib dispatch_chain --jobs 6 -- --test-threads=1 --nocapture passed 11/0/0. cargo test --offline --locked --workspace --no-fail-fast --jobs 6 -- --test-threads=4 --nocapture reported 1,422 passed, 0 failed, 46 ignored, with 26 runtime GPU skip notices.

This is a synthetic integration check. I did not run a paired retail smoke on this merged tree or resolve the reported budgeted retail crash; the passing suite does not establish that runtime outcome. AI-assisted. Codex (GPT-6, exact variant unavailable) ran the checks and drafted this update.

@KDenKC

KDenKC commented Nov 25, 2026

Copy link
Copy Markdown

@Kalmarv the three numbers, from the same two logs, cut at +124 s after each arm left the legal screens (base 277 s, PR 398 s):

base 0829441 this PR 9dd8715
last compute split: before the cut 20 programs, 70 pieces, 4,173 chained dispatches (270.0 s) 5 programs, 10 pieces, 2,420 chained dispatches (390.0 s)
compute PSO with the translated console CS lines up to the cut 368 340
programs split at +60 s 19 4
  • So the gap is there from early on (19 vs 4 at +60 s) with about the same number of compute pipelines translated, not only in the totals.
  • No 2 MB+ cold compile was stuck in either arm. The base arm had one ≥ 2 MB compute build (#574, 2,177,324 B, started 268.2 s), and it finished. The PR arm had none ≥ 2 MB.
  • What was waiting at the PR arm's end: two compute builds open (#493 303 KB and #494 398 KB, both driver blob absent, started 398.5 / 400.0 s), and in the last ~10 s ten builds finished after gated (waited …) of 3–31 s (five of them ≥ 20 s), i.e. they sat on the huge-compile slot that long first. The base arm logged longer gate waits still (up to 209 s), so I can't say from these logs that the queue was worse with the PR.
  • I have no thread dump of either run, so I can't say what each xcl-pso thread was doing at the end. A rerun with XCL_THREAD_DUMP_AT at the same offset in both arms would answer that; I can do it if it helps.

AI use: Claude Code (Claude Opus 5.5) read the two run logs and wrote this.

@b3IKK

b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Independent retail check on an RTX 5080 (retail 1.0.2.1, 600 s, XCL_DIRECT_DXIL=1, XCL_PSO_WAIT_MS=50): on clean head 9dd8715, the title presents to 166 s (30 two-second intervals after the 96 s mark) and the log's last counters are:

compute split: 266 programs split, 2,621 pieces built, 8,598 chained dispatches issued ...; whole form: 198 asked for, 30 built, 16,701 dispatches skipped while it was being built

Then it crashes: 0xc0000005 in game_scarlett_master.exe+0x5293422 (read at 0xffffffffffffffff) at 166.5 s. Without this PR on the same settings it stopped at 96 s behind 13 whole forms of 0.67–1.13 MB.

So the background whole form does move the bind past the compile, but the 50 ms budget skips 16,701 dispatches — the world is missing that work — and the title then crashes. 198 whole forms asked for and only 30 built in 166 s also shows the workers are far behind the budget.

What this title needs from the PR is a default-wait path: enqueue the whole form on the workers and wait for the worker instead of taking the job on the caller. With resolve_wait_for(None) the job is built on the calling (title) thread, so the PR only helps when the budget is set — and then it skips too much. If the default path could enqueue-and-wait on a worker, the whole forms would leave the title's thread without skipping their dispatches.

AI use: OpenCode, Claude Fable 5.2 ran the retail title on this machine and wrote this.

@Kalmarv

Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@b3IKK thanks for the RTX 5080 run, that's a useful data point.

What the numbers show. With the budget, the title's thread no longer builds whole forms. It presented to 166 s, where it stopped at 96 s without this PR. But the workers are far behind: 30 of 198 whole forms were built in 166 s, so 16,701 dispatches were skipped, and then the title crashed in its own code. That matches our runs on an RTX 5070 Ti. With XCL_PSO_WAIT_MS=50, both runs of this PR crashed after mass skips (one in the title's code, one in the known title-texture race #751 / #484), and no whole form was built at all. The huge-compile slot was held the whole run by a 2.4 MB pipeline the preloader started at ~8 s, and 30 workers sat waiting for that slot with unsplit pipelines. So yes: the budget lets the title go on, at the cost of work, and this PR doesn't change that trade.

Enqueue and wait on a worker, with no budget set. We'd rather not take this, because it wouldn't give the title its frames back. With no budget, the title's thread waits for the whole form either way; the only difference is which thread runs the compiler. Its wait would get longer, not shorter:

  • the job goes to the back of the workers' queue, and a job waiting there for the huge slot keeps its worker, so with all workers parked it doesn't even start;
  • once it starts it needs a huge slot: as a wanted build it can take the second one, but it shares that with every other wanted build, while on the title's thread it starts at once.

This is also how an unsplit pipeline behaves with no budget: resolve_wait waits for a worker that has started it, and otherwise builds it on the caller. This PR keeps the two the same on purpose.

The fix for the stall at the default is to need the whole form less. #2404 runs an ExecuteIndirect of a split program through its pieces, and asks for the whole form only when the arguments need more slabs than its rounds (and for bundles, lists without scratch and other command signatures). This PR is planned to land after it. Then the 198 asks above become rare, and what stays here is that XCL_PSO_WAIT_MS also covers the whole form when it is still needed. The two problems you hit are separate: the queue and the slot (a waiting job holding its worker, and the preloader holding the slot) are a worker-pool issue in their own right. They'd need their own PR, not this one.

AI use: Claude Code (Claude Opus 5.5) read the code and our logs and drafted this reply.

@treybertram06

Copy link
Copy Markdown
Contributor

Test report: #2372 and #2404 on an RTX 3080, retail title 7952987A

Summary: both PRs remove the world-load freeze on this card. With either one applied, every run then hits the silent 0x887a0005 device removal (#1452) at about 85–122 s.

Setup

Conflicts with current main

Base, 6 runs

  • Freeze: in 5 of 6 runs everything stops: presents, submits, dispatches and DirectStorage. Four froze at about 90 s and one at about 270 s. Audio keeps going until the end of the run.
  • Where it waits: thread dumps at 120, 240 and 400 s show a title thread in bind::execute_indirect → dispatch_chain::whole → Chain::whole. In 2 of the 3 dumps it is waiting; in the other it is in nvgpucomp64.dll. One dump also shows a second title thread in Chain::whole, presumably behind the build lock.
  • Device removal: 2 of 6 runs (90 s and 387 s).

#2404, 3 runs

  • Freeze: none. Log: ExecuteIndirect: 3455 chained (0 of them whole, 0 slabs lost), 37 whole, and no title thread builds a whole form.
  • Device removal: 0x887a0005 in 3 of 3 runs, at 90, 90 and 122 s. Each comes about 2 s after the first chained ExecuteIndirects, after a burst of 1-tile sparse maps.
  • Skips: the no buffer for the commands of a chained ExecuteIndirect skips come 2 ms after the removal, so they are a consequence of it.

#2372, 3 runs

  • Freeze: none. Log: whole form: 146 asked for, 146 built, 0 dispatches skipped while it was being built.
  • Device removal: 0x887a0005 in 3 of 3 runs, at 85, 90 and 94 s.

What this says
On this card the freeze has been hiding the removal: while the title waits on a whole build, it submits nothing. Once it keeps submitting, the removal comes at the next step every time. These runs can't tell whether either PR's GPU work contributes to the removal. One base run was also removed at 89.8 s, before the freeze took hold.

Not tested: AMD, other titles, and runs without XCL_UMA_SHADOW.

(Runs and report by Claude Code with Claude Opus 5.5. The commands and counts above come from these runs.)

@b3IKK

b3IKK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A stacked PR for the default-wait path is up: #2491, on this PR's head 9dd8715. It adds pso_async::resolve_wait_worker so Chain::whole enqueues the whole form on an xcl-pso worker and waits for it, instead of taking the job on the calling title thread when XCL_PSO_WAIT_MS is unset.

Retail 1.0.2.1 on an RTX 5080, XCL_DIRECT_DXIL=1, 600 s:

this PR + wait 50 ms #2491, default wait
whole forms asked / built 198 / 30 46 / 45
dispatches skipped 16,701 0
last present 166 s 92 s
crash 0xc0000005 at 166.5 s none

The stack removes the skips and the crash, but the bind now waits for 45 serialized 0.7–1.1 MB worker builds, so presentation stops at 92 s. #2491's test fails without the change (built on None, not on a PSO worker); suite 1274/0/46, smoke 1627.

AI use: OpenCode, Claude Fable 5.2 implemented and ran the comparison on this machine and wrote this.

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.

8 participants