Skip to content

D3D12.X: a bind never builds a cold pipeline on the title's thread - #2615

Open
iggyvilla wants to merge 2 commits into
xcl-dev:mainfrom
iggyvilla:no-inline-cold-bind-r3
Open

iggyvilla wants to merge 2 commits into
xcl-dev:mainfrom
iggyvilla:no-inline-cold-bind-r3

Conversation

@iggyvilla

Copy link
Copy Markdown
Collaborator

With XCL_PSO_WAIT_MS unset (the default), a bind of a pipeline that is not built yet took the build from the queue, ran it on the title's own thread (DXC and the driver's compile), and waited until it was done. On a retail title that put one title thread into the AMD driver's compile of a 2.4 MB compute program at 124.0 s (its driver compile start), where it stayed to the end of a 600 s run: the compile never finished, the last frame was shown at about 125–126 s and none after it, while all the xcl-pso-* workers were idle. A title thread's build also passes the big-compile gate ungated, so several title threads could each run a huge driver compile at once.

Now a bind with no budget gets the stand-in at once (its dispatches are skipped, its draws draw nothing, exactly as for a pipeline that is late after XCL_PSO_WAIT_MS today), and the build is sent to the workers. The build is marked wanted before it is sent, which is new (the inline build ran ungated on the title's thread and was marked only after it finished): it goes before the builds made ahead and takes the wanted slots of big_compile_turn (at most XCL_HUGE_PSO_WANTED_CONCURRENCY). XCL_PSO_WAIT_MS=<ms> still waits up to that long, unchanged. XCL_ASYNC_PSO=0 still builds every pipeline in the create call.

Since #2118, a Dispatch (or a dispatching ExecuteIndirect) whose pipeline is still being built is put off to the list's submit, in a segment (a PC command list) of its own, and ExecuteCommandLists / KickoffX record it there through the same resolve_wait. With no budget, the submitting title thread built the pipeline itself if no worker had started it, and waited for it without end. So the wait moved from the bind to the submit, but it was still unbounded and still on a title thread: main 08db802 stops presenting at 144–150 s on this title (2 runs), and at 136 s on NVIDIA (#2581).

With this PR no bind or submit waits for a pipeline until it is built, so nothing is put off: list_x::defer returns false while pso_async::waits_until_built() is false, which it always is with this change. A dispatch whose pipeline is still being built is recorded at once and skipped as a stand-in's, as before #2118. A put-off would only move a wait the submit no longer makes, and it costs a segment per call. With the put-off kept, on top of no wait, 3 walks of this title went past 8 000 put-off calls and lost the device (0x887a0007) at 175 s, 218 s and 222 s; in two of them a GPU fence wait had timed out just before (2 s), in the third no wait had timed out before it. main 08db802 without this PR, with XCL_PSO_WAIT_MS=1 (the put-off and a bounded wait), hung the GPU the same way at 200.6 s (1 walk), as #2581 saw on NVIDIA. So the hang is in that path and not in this change; its exact cause (DRED: a page fault at GPU VA 0) is not found. Without the put-off, 3 of 3 walks ran to 355–361 s with no device removal.

What this gives up: a put-off dispatch whose pipeline was built between the recording and the submit ran; it is now skipped. #2118's put-off stays in the code for a mode that waits until a pipeline is built; with this PR there is none. The cases where #2118 waited at the call itself (a list that cannot be split, predication), console-list replay and draws (graphics_bound) go through resolve_wait too, and no longer wait either.

Every bind path already handles a stand-in: Dispatch and console-list replay skip it (is_translated_compute is false for a stand-in and for the shared stand-in driver pipeline), ExecuteIndirect skips it (is_pending), a draw binds the title's root signature and draws nothing (graphics_bound), and SetPipelineState / ClearState / Reset / CreateCommandList bind the stand-in's driver pipeline.

This also changes draws: graphics_bound called resolve_wait too, so a draw of a cold graphics pipeline used to wait for it. Now it draws nothing until the pipeline is built, as SetPipelineState already did for graphics pipelines.

Sequencing: #2364's submit_ahead doc ("a bind that reaches one not started takes the job itself") is no longer true after this; whichever of the two lands second fixes that line. ExecuteIndirect reads is_pending after resolve_wait, so a build that ends between the two sends the stand-in to the PC call. Until now only XCL_PSO_WAIT_MS / XCL_PSO_IMAGE_SKIP opened that window; with this PR the default path does too. #2598 fixes that on its own (bound_unbuilt, one lookup), and #1652 fixes it too.

#2581 makes defer return false while XCL_PSO_WAIT_MS is set, for the same reason (a bounded wait makes the put-off only move the wait), after Close → E_OUTOFMEMORY and a device removal on NVIDIA with XCL_PSO_WAIT_MS=1. With this PR it holds for the default too. Both add an early return at the top of defer, so whichever lands second has a small conflict there, and #2581's check becomes part of this one.

amd-dev (6a0bb5b4) bounds this wait differently. A draw or dispatch, and a submit's put-off dispatch, waits for its pipeline within a per-frame window of 12 s for each kind (XCL_PSO_FRAME_BUDGET_MS), and the build stays on the workers. This PR is for main and goes further: with no budget there is no wait at all. When main is merged into amd-dev, it conflicts in pso_async.rs (resolve_wait_for, the module doc, the worker loop) and in bind.rs, and amd-dev's window should be kept there. The whole form of a split program that ExecuteIndirect compiles on the title's thread (#2404) is not changed here; amd-dev already builds it off that thread.

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs: resolve_wait_for with no budget calls the new resolve_unwaited instead of building and waiting; wait_built (wait until a stand-in's build is over, for tests); module and field docs that said compute pipelines are waited for at their first bind.
  • Tests (pso_async.rs): new a_bind_with_no_budget_neither_builds_nor_waits_for_the_pipeline (compute and graphics: the bind returns the stand-in while the build is blocked, the build runs on an xcl-pso* worker and is wanted, then the bind gets the real pipeline). Tests that used a no-budget bind to wait for a build now use a budget (they test the waiting bind: title_held, wanted) or wait_built.
  • bind.rs tests, tests/gpu_compute_e2e.rs, tests/gpu_pso_e2e.rs: resolve_wait used to wait for a build → wait_built. execute_indirect_skips_failed_shared_console_compute_standin builds its second shell with wait_built before binding it.
  • bind.rs, console_list.rs: two comments that said the bind waits.
  • list_x.rs: defer returns false while pso_async::waits_until_built() is false (new, pso_async.rs). D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118's test a_dispatch_with_a_pipeline_still_building_waits_at_the_submit is now ..._is_recorded_at_once_and_skipped: no segment is added, each dispatch returns at once and is skipped at the bind, the submit records nothing and does not wait; then the build is let finish and the list runs. real.rs: one comment from D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118 ("compute: waited for at its use") now adds "up to XCL_PSO_WAIT_MS".
  • Docs only (pso_async.rs, bind.rs): lazy(), the used module, resolve_for_bind and a bind_abi comment no longer say a compute bind waits for its build; wait_built says it returns at once for a pipeline that is no stand-in.

Not in this PR

  • Not waiting the budget while a build sits behind a taken big-compile slot (XCL_PSO_WAIT_MS>0). After this change the bounded wait is opt-in only. Deciding on "a big-compile slot is taken" alone would also skip the wait for pipelines that build in milliseconds and are never gated; the console shader's size is known when the pipeline is created (D3D12.X: start big compute pipelines building when they are created #2364 routes on it) but is not kept in Pending, so doing it precisely means recording that size at submit. Deferred for its own measurement, not ruled out.

Tested

  • AMD Radeon RX 6650 XT 8 GB (RDNA2), driver 32.0.21045.29003, Ryzen 7 5700X, 32 GB RAM + 64 GB pagefile, Windows 11 26300, rustc stable-x86_64-pc-windows-msvc. Tests in debug, smoke and walks in release, interactive session, clean tree.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on a0734c9f: 1429 passed, 1 failed, 47 ignored. The failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 783, res[64] = 0xc, CPU 0x7fffffff), which fails the same way on main. The e2e tests pass. SKIPPED: 6× lower_dxil f16/f32 per-lane programs (refused, gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (the driver cache cannot be disabled without Developer Mode).
  • cargo test -p xcl --no-fail-fast -- --test-threads=4 on a0734c9f (a3, debug, after cargo build --workspace): 1428 passed, 2 failed (fuzz_validate_and_gpu_1, and e2e test_title_runs_and_game_folder_is_untouched with no desktop session), 47 ignored. The list_x test fails without the defer check (0 passed, 1 failed: "a dispatch was put off to the submit").
  • Retail walk, 360 s, restored save, no network, release, with D3D12.X: title texture reads outside the coherent window use the safe copy #751 (59f8e7c) merged locally, on this tree (built as 6336dce1, the same tree as a0734c9f):
    • XCL_PSO_WAIT_MS unset, 2 runs: no put-off, no device removal. Last present at 361 s in run 1. Run 2 was ended at 357 s by the title's int3 after Close → E_OUTOFMEMORY, when the system had 1.2 GB of physical memory left (73.8 of 95.9 GB committed); that is not a device removal. 12–14 % of dispatches skipped (32 768 of 263 370, 45 789 of 337 045). On average 11.2 and 10.6 presents per 10 s over 120–350 s, unevenly spread.
    • XCL_PSO_WAIT_MS=200, 1 run: no device removal, last present at 356 s, 8 192 of 186 604 dispatches skipped, 6.2 presents per 10 s.
  • On 60371139 (base 08db802: this change without the defer check, so with D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118's put-off), + D3D12.X: title texture reads outside the coherent window use the safe copy #751, 3 walks: device removed (0x887a0007) at 217.98 s, 174.85 s and 222.23 s, each after more than 8 000 put-off calls; 701 of 33 056, 1 604 of 28 086 and 659 of 35 326 dispatches skipped. The third ran with XCL_DRED=1: a page fault at GPU VA 0, no allocation there. main 08db802 (2 walks): stops presenting at 144–150 s, no removal.
  • Earlier, before D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118:

Regression run
(scripts/smoke.ps1, same title, 60 s, adjacent runs in the order main, PR, main)

main 08db802 (run 1):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1573 (PresentX 1574)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20094 MB

this PR, a0734c9f:

xcl-smoke v1
commit: a0734c9f0931b3e4d122a4de3fd6b310236af1fc
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1579 (PresentX 1579)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20122 MB

main 08db802 (run 2):

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1595 (PresentX 1595)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 20167 MB

Not tested

  • Tested on AMD RDNA2 only (Radeon RX 6650 XT). NVIDIA, RDNA4 and wave32-only GPUs were not measured; the NVIDIA stop at 136 s is D3D12.X: with bounded pipeline waits, dispatches are not put off to the submit #2581's measurement, not ours.
  • Whether the compute dispatches now skipped on the default path leave outputs that a later ExecuteIndirect or dispatch reads. The XCL_PSO_WAIT_MS path skips them the same way, and once hung the GPU like that (see the doc of image_skip). No device removal was seen in the 7 walks with this PR, but all of them end in the intro / credits. Later gameplay was not reached.
  • Rendering while pipelines are built: on a cold cache, skipped dispatches and draws mean missing work on screen for minutes after the 126 s burst. Not compared image by image.
  • Interaction with d3d12x: cap cumulative PSO bind waits per PresentX frame #2114 (skipped work in a frozen frame): not checked.
  • How many dispatches the put-off would have let run on a cold cache: not measured. With warm driver blobs most of them ran (above).
  • The access violation in one walk on 55d64c2 (and in a second run in a reproduction) is in XCL's texture detile, not in code this PR changes. title_textures::subresources → gpu::tiling::Chain::detile_level copied from title memory that title_bytes had borrowed after a single readable() check, and a page of it was no longer mapped by then. D3D12.X: title texture reads outside the coherent window use the safe copy #751 fixes that read (0 crashes in 5 walks with it). main has the same code but does not reach it in this walk, because it stops presenting at 126–142 s. The walks on 8184b43 all ran with D3D12.X: title texture reads outside the coherent window use the safe copy #751. This PR alone was not walked on 8a3f912, and neither was main.

Docs

  • HANDOFF.md becomes wrong in two places: line 1051 ("compute is waited for at its first bind / replay (resolve_wait …)") and lines 1420–1421 ("draws wait for pipelines still being built (resolve_wait in bind::graphics_bound …)"). With this PR neither waits unless XCL_PSO_WAIT_MS is set. Not edited here.

AI use

  • Brief: o8, Muse Spark 1.3 (XCL-150).
  • Code, tests and this description: Claude Code, Claude Opus 5.5 (a3).
  • Workspace suite, smoke runs and retail walks: Claude Code, Claude Sonnet 5.5 (a1).
  • Diff reviews: o6, Muse Spark 1.3 (XCL-153, XCL-173, XCL-181); finding D3D12.X: title texture reads outside the coherent window use the safe copy #751 for the detile crash: o5, Muse Spark 1.3.
  • Launched the runs in the interactive session and read the diff: Claude Code, Claude Opus 5.5 (the coordinator).

With XCL_PSO_WAIT_MS unset (the default) a bind of a pipeline not built
yet took its build from the queue, ran DXC and the driver's compile on
the title's own thread, and waited until it was done. On a retail title
that kept one title thread in the AMD driver's compile of a 2.4 MB
compute program from 124 s to the end of a 600 s run (it never finished)
with no frame shown after 126 s and every xcl-pso worker idle. A title
thread's build also passed the big-compile gate ungated.

A bind with no budget now gets the stand-in at once - its dispatches are
skipped and its draws draw nothing, as for a pipeline that is late after
XCL_PSO_WAIT_MS today - and the build goes to the workers, wanted (it
goes before the builds made ahead, within big_compile_turn's wanted
cap). XCL_PSO_WAIT_MS=<ms> still waits up to that long.

Since xcl-dev#2118 a Dispatch or a dispatching ExecuteIndirect whose pipeline
is still being built is put off to the submit, in a segment of its own,
and the submit waited for it the same way: with no budget it built the
pipeline itself when no worker had started it, and waited without end
(main 08db802 stops presenting at 144-150 s on the same title). With no
bind or submit waiting until a pipeline is built, a put-off would only
move a wait that no longer happens, at a segment per call, so
list_x::defer now returns false (pso_async::waits_until_built) and the
call is recorded at once and skipped as a stand-in's, as before xcl-dev#2118.
Measured on an RX 6650 XT, 360 s walks: with the put-off kept, 3 of 3
walks went past 8 000 put-off calls and the GPU hung (0x887a0007, DRED
page fault at VA 0); so did main with XCL_PSO_WAIT_MS=1 (1 walk, no
change of ours). Without it, 3 of 3 walks (one with
XCL_PSO_WAIT_MS=200) ran to 355-361 s with no device removal; one of
them ended at 357 s when the system ran out of physical memory. The
test that xcl-dev#2118 added for the submit's wait now checks that the
dispatch is recorded at once and skipped.

wait_built waits for a stand-in's build for tests that used a no-budget
bind to do so.

AI-assisted.
Assisted-by: Claude Code (Claude Opus 5.5)
Docs of lazy(), the used module, resolve_for_bind and a bind_abi comment
still described the inline build and unbounded wait removed in the
previous commit. wait_built says it returns at once for a pipeline that
is no stand-in (also with XCL_ASYNC_PSO=0).

Assisted-by: Claude Code (Claude Opus 5.5)
@DarkPanda69

Copy link
Copy Markdown

NVIDIA and RDNA4 run (both listed as untested): the new and changed tests pass on an RTX 3060 and an RX 9070 XT. One flaky list_x test fails on the RTX 3060 at the same rate on main.

Head a0734c9 applied on main b49be18, debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER, integration tests run with --nocapture:

RX 9070 XT (RDNA4, 32.0.32029.2010) RTX 3060 (32.0.16.1088)
--test gpu_compute_e2e 7 passed, 1 SKIPPED (heap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows, same on main) same
--test gpu_pso_e2e 7 passed, no skips 7 passed, no skips
--lib -- d3d12x:: 255 passed, 0 failed 255 passed; see below

On the RTX 3060, hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares sometimes fails in the parallel d3d12x:: run: list_x.rs:7146, left -2147024809 (0x80070057), right 0. It is not from this PR. Over 8 runs each, it failed 1/8 on main and 1/8 with this PR. It passes alone 5/5 on both, and 0/8 on the RX 9070 XT either way.

Not tested: a world run on RDNA4 or NVIDIA (no title here), wave32-only performance, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA, the title, 3 runs with #2615 and 3 without: without it the title stopped presenting 1.1 to 3.1 s after its first call of ID3D12GraphicsCommandList10::#101 (72.5 to 74.5 s), in 3 of 3; with it, 2 of 3 runs went on submitting and dispatching to the 120 s end, but from 76 s presented about once a second (35 and 42 presents), and the frames kept then showed no picture. The third run with it lost the device at 58 s, before the world load.

Setup: 08db8020 (the commit it is based on) + #684 e56dbc3, against the same + #2615's two commits (dee610f, a0734c9), in turn. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, the first-run screens completed once and no story progress, 120 s, A pressed when ready (16.0 to 16.5 s), XCL_PSO_PRELOAD=0, XCL_PSO_WAIT_MS unset.

without (3 runs) with #2615 (3 runs)
first #101 71.4, 71.1, 72.7 s –, 72.9, 52.9 s
last 2 s with a present 72.5, 74.2, 74.5 s 46.0, 118.3, 118.2 s
presents / dispatches from 76 s to 120 s 0 / 649, 0 / 0, 0 / 0 –, 35 / 41,986, 42 / 57,318
not built yet when used (XCL's log counters) dispatches put off to the submit: 1,024 or more, 3 of 3 pipelines given the stand-in: 14, 1,025 or more, 1,025 or more
device removed 0 of 3 1 of 3
  • From 76 s the frames kept showed no picture: in 212355-b, 1430 and 1460 (79.9 and 106.6 s) were all black; in 204741-b, 1400 and 1430 (76.0 and 108.7 s) were the loading screens' dark background colour, the second with some black and grey. The frames kept before 72 s were loading pictures, in 212355-b also for 19 s after its first #101 at 52.9 s.
  • The removal (203603-b): presents and submits stopped at 46.0 s, and D3D12 device removed: 0x80004005 Call failed. came at 58.28 s with vkd3d-proton's Failed to submit semaphore waits, vr -4; no NVIDIA kernel message. One removal in 3 runs does not tie it to D3D12.X: a bind never builds a cold pipeline on the title's thread #2615.
  • Two runs, one of each tree, did not exit within a minute of the 120 s end.

Not tested: today's main b49be18; XCL_PSO_WAIT_MS set; runs past 120 s; the suite; Windows; AMD and Intel.

AI use: Claude Code (Claude Opus 5.5) ran the title and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

@itsSio

itsSio commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent dual-PC NVIDIA full-workspace test report on clean head a0734c9f0931b3e4d122a4de3fd6b310236af1fc.

Tested

  • Machine 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1430 passed, 0 failed, 47 ignored (list_x::tests::a_dispatch_with_a_pipeline_still_building_is_recorded_at_once_and_skipped and pso_async::used_tests::a_bind_with_no_budget_neither_builds_nor_waits_for_the_pipeline both pass)
    • SKIPPED: 26 (wave64-only GPU tests, #1426 wave32 f16/cvt refusals, heap_window_out_of_memory_falls_back_to_the_switch_form, pso_measurement_compiles_an_exact_synthetic_record)
  • Machine 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1430 passed, 0 failed, 47 ignored (both new tests pass)
    • SKIPPED: 29 (same 26 as Machine 1 plus 3 requiring d3d12SDKLayers.dll)

Not tested

  • Retail title / scripts/smoke.ps1 runs
  • Release builds (--release)
  • AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Claude Opus 5.5 (High)): built the branch and ran the workspace test suite on both NVIDIA machines.
  • Google Antigravity CLI (Gemini 4 Neon (High)): coordinated the runs and wrote this test report.

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV.
Targeted run of a_bind_with_no_budget_neither_builds_nor_waits_for_the_pipeline, a_dispatch_with_a_pipeline_still_building_is_recorded_at_once_and_skipped: 2 passed.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

@GreemSC

GreemSC commented Nov 26, 2026 •

Copy link
Copy Markdown

Linux (Wine + vkd3d-proton) + AMD RDNA3, the retail title, 2 runs with #2615 + #2598 + #751 and 2 without, alternated: without them the title stopped presenting at 120.2 / 122.2 s; with them it presented to 349.6 / 358.4 s of 360 s, 0 crashes, 0 device removals.

Tested

base (2 runs) + #2615 #2598 #751 (2 runs)
first ListX #101 118.7 / 101.3 s 116.4 / 119.4 s
last present 120.2 / 122.2 s 349.6 / 358.4 s
crashes / device removals 0 / 0 0 / 0
compiles after #101 244 / 323 325 / 363
peak RAM + swap of the game 14.4 / 15.4 GB 17.0 / 16.6 GB (at the cap from ~180 s)
peak local VRAM 16.2 / 16.5 GB 18.9 / 20.3 GB
  • Base: the thread dump at 352 s has a title thread held in bind::dispatch on a condvar (the cold-pipeline wait this PR removes). The driver compile of record 95cc13288a27a96e (2,456,668 B DXIL, the record iggyvilla names) starts at 122.1 / 130.7 s and does not finish in any of the 4 runs.
  • Head: the same compile starts (118.9 s in the first run) and does not finish either, but the title goes on: the intro cutscene's subtitles and credits on a grey background (the 3D scene is not drawn), about 1 frame/s, presenting until the run ends; the next limit here is memory.
  • xcl lib suite under Wine (Windows MSVC test binary), --test-threads=4: base 1335 passed / 7 failed / 27 ignored, head 1339 / 7 / 27; 6 of the head's 7 also fail on plain main under Wine. The other one is D3D12.X: title texture reads outside the coherent window use the safe copy #751's title_bytes_leave_guard_pages_alone.

Not tested

  • Windows; plain main + these three PRs without the Wine stack (plain main stops at ~2.5 s under Wine); NVIDIA; runs longer than 360 s; more than 2 runs per side.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the runs and wrote this report.

@Royalflamejlh

Royalflamejlh commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Edited (07:47 UTC): a fourth run of the tree without this PR (with a logging-only count line) lost the device at 199.7 s, Xid 13 then Xid 32, the same form as with it. So these runs do not tie the loss to this PR; with it the title reached the same point sooner (106–234 s, against 199.7 s in 1 run).

On Linux + NVIDIA (RTX 4060 Ti 16 GB), main b49be18 with #2404 and this PR together lost the device in 18 of 18 runs, at 106 to 234 s: 2 of the tree as merged and 16 with one diagnostic change each. With #2404 alone, 3 runs had no loss: from about 76 s the title was held by pipeline builds until 130–156 s, then drew until our low-memory stop at 213.7 and 272.6 s, and to the 300 s end. Our review above (RTX 4070, without #2404) had one removal, before the world load; GreemSC's RADV runs above, with #2404, this PR, #2598 and #751, had none.

Setup: main b49be18 + #684, #751, #1599, #1860, #2082, #2404 97a70a7, ± this PR a0734c9 (#2598 1e28011 in 17 of the 18, in none of the runs without this PR); NVIDIA 615.71.09, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch (11 of the 18 and the breadcrumbs_sync row: the same on dxil-spirv 694cc674); XCL_DIRECT_DXIL=1 XCL_HUGE_PSO_WANTED_CONCURRENCY=6 XCL_DXC_THREADS=4 XCL_PSO_DISK_CACHE=0; first-run screens done once, no story progress; copies of the same warmed caches; 300 s asked; local video memory peaked at 15,434–15,542 MB in every run, with a loss or without.

tree runs lost the device kernel message
+ #2404 (2 runs with a logging-only line) 3 0 (our low-memory stop at 213.7 and 272.6 s; 300 s) –
+ #2404 + this PR 18 18, at 106–234 s (one seen only at the 300 s end, after an Xid at 125 s) Xid 109 in 13 (3 also Xid 31), Xid 31 in 1, Xid 32 in 2, Xid 13 then 32 in 2
the same, #2118's put-off restored, XCL_PSO_WAIT_MS=60000 2 1, at 229 s (the other reached our stop at 264 s) –
the same, vkd3d-proton's trace build with breadcrumbs_sync (a full barrier after every command; one run with a cold NVIDIA cache) 3 0 (our stop at 167–188 s) –
  • Without a wait budget (17 of the 18), the title drew on through its world burst at about 76 s, with dispatches skipped, and lost the device at 106–169 s. With XCL_PSO_WAIT_MS=60000 nothing was skipped and the title was held until 130–134 s, as with D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404 alone; 2 of those 3 runs still lost the device, at 229 and 234 s (one with D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118's put-off restored), and the third reached our stop at 264 s.
  • 2 of the 18 were the tree as merged; none of the 16 changes kept the loss off. XCL: XCL_PSO_WAIT_MS=60000 (nothing skipped), no D3D12.X: ExecuteIndirect skips a stand-in whose build ends during the call #2598, UAV barriers around every chained piece, an inert scout patch with the translation cache off, a count of early reuse of released memory (0 to the loss). vkd3d-proton, each on a newer dxil-spirv: that alone, plain breadcrumbs, a full barrier between lists, every barrier made full (5 runs), no hoisted preprocess, resource releases held (2 runs, one also heap releases).
  • With plain breadcrumbs (1 run) the queue stood in the first piece of split program cs 520a7d5cb893a9f7, in the chain main records for a title's Dispatch.
  • Read: this PR leaves that chain's code alone (pso.rs, record_dispatch_chain). Here it changes two things: a bind of an unbuilt pipeline gets the stand-in, not a build on the title's thread (pso_async.rs:1119), and no dispatch is put off to the submit (list_x.rs:2657).

Not tested: Windows; AMD; this PR without #2404 past the burst (1 run on this card drew nothing after it).

AI use: Claude Code (Claude Opus 5.5) merged the trees, made and read the runs, and wrote this.

Posted without review by a person: the account owner was away and reads replies later.

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 26, 2026
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
Integrated XCL already keeps cold title-visible builds on workers, superseding xcl-dev#2615's title-thread compile fix without adopting its correctness-losing default skip policy. Worker failure still had terminal holes: a panicking job was caught only outside the Build and never woke its waiters, a panicking parallel piece omitted a result, and zero workers or a refused queue left accepted work with no executor.

Catch pipeline and piece panics as failed results, restore worker-local/preload state before publishing completion, and fail exact jobs when no normal worker can start or the queue refuses them. Failed speculative-preload startup leaves the build dormant so a later title demand can schedule it normally.

The Windows GNU library/test cross-check passed with the existing 11 library warnings and 2 test warnings (1 duplicate). Windows MSVC runtime, GPU, and smoke tests were not available here.

Panic-recovery source: xcl-dev#2053 by RandomGithub12309, written with Antigravity (Gemini 4 Neon).

Assisted-by: Codex (GPT-5.6-sol)
bmjask pushed a commit to bmjask/xcl that referenced this pull request Nov 26, 2026
Integrated XCL already keeps cold title-visible builds on workers, superseding xcl-dev#2615's title-thread compile fix without adopting its correctness-losing default skip policy. Worker failure still had terminal holes: a panicking job was caught only outside the Build and never woke its waiters, a panicking parallel piece omitted a result, and zero workers or a refused queue left accepted work with no executor.

Catch pipeline and piece panics as failed results, restore worker-local/preload state before publishing completion, and fail exact jobs when no normal worker can start or the queue refuses them. Failed speculative-preload startup leaves the build dormant so a later title demand can schedule it normally.

The Windows GNU library/test cross-check passed with the existing 11 library warnings and 2 test warnings (1 duplicate). Windows MSVC runtime, GPU, and smoke tests were not available here.

Panic-recovery source: xcl-dev#2053 by RandomGithub12309, written with Antigravity (Gemini 4 Neon).

Assisted-by: Codex (GPT-5.6-sol)
@jennydeth

Copy link
Copy Markdown

Windows / NVIDIA results for a0734c9 with the retail title (1.0.2.1) on an RTX 3060 12 GB. With default settings the title kept presenting past the point where main stops, but both runs then crashed in texture detiling (0xc0000005). So this PR's runs don't meet the merge check here.

Regression run (default settings, 600 s)

main b49be18:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 2047 (PresentX 2047)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 35859 MB

This PR, a0734c9, run 1:

xcl-smoke v1
commit: a0734c9f0931b3e4d122a4de3fd6b310236af1fc
gpu: NVIDIA GeForce RTX 3060
title: 9cc6a39e
seconds: 600
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 2 3 3
device removals: 0
crashes: 2
peak commit: 33144 MB

Run 2, the same commit rebuilt:

xcl-smoke v1
commit: a0734c9f0931b3e4d122a4de3fd6b310236af1fc
gpu: NVIDIA GeForce RTX 3060
title: 9cc6a39e
seconds: 600
exit: 0xc0000005
frames shown: none logged (the run did not reach its end)
presents per 2 s (last 3): 3 5 2
device removals: 0
crashes: 2
peak commit: 42702 MB
  • Presents: main stopped at 100.3 s, with 2 presents after 100 s. With this PR the title went on presenting:
    • Run 1: 167 presents from 100 s until the crash at 134.2 s.
    • Run 2: 71–96 presents a minute until the crash at 324.3 s.
    • The frame dumped at frame 2120 (228.8 s, run 2) is black, so I can't say what those frames show.
  • Skipped work: by 131.4 s (run 1) the counter read 65672 dispatches (4096 skipped), and by 317.9 s (run 2) 761944 dispatches (84275 skipped), with 205015 draws skipped. main's last counter line, at 98.7 s, had 0 skipped.
  • The crash: both runs have the same stack. It is a read fault in VCRUNTIME140.dll (reads at 0xdbcac0000 and 0xdee810000), called from gpu::tiling::Chain::detile_level ← hle::d3d12x::title_textures::subresources on a title_textures::subresources_on worker thread. I resolved this with cdb and the PDB of the run 2 build.
    • That is texture upload code this PR doesn't touch. My guess is that the title only reaches that texture because it keeps going, but I haven't shown that: main stops presenting at ~100 s and never gets that far.
  • Peak commit was 33,144 MB in run 1 and 42,702 MB in run 2 (at 293 s), against 35,859 MB on main.
  • Direct DXIL (XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1, warm caches, 900 s): the device was lost (0x887a0005, NVIDIA: the device is removed when the pipelines in use need more than 512 MB of shader code (0x887a0005) #2403) at 214.8 s, last present at 160.9 s, with the same DRED line as on main (page fault at GPU VA 0x0; allocations there: []; recently freed: []). Three b49be18 runs today with the same switches lost it at 110.6, 211.2 and 216.0 s, so one run can't tell this PR apart from main there.

Tested

  • NVIDIA GeForce RTX 3060 12 GB, driver 32.0.16.2101 (32-lane waves only); Ryzen 5 5600X; 32 GB RAM; Windows 11 Pro 10.0.26300.9974; Rust 1.100.0 (stable-x86_64-pc-windows-msvc); release; DXC 1.9.2609.5.
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4 on a0734c9: 1430 passed, 0 failed, 47 ignored. SKIPPED (29): 21 × no wave64; 3 × per-lane form refused; 3 × no D3D12 debug layer / d3d12SDKLayers.dll; 1 × no heap windows; 1 × pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache).
  • Retail title 1.0.2.1, scripts/smoke.ps1 -Game <folder> (XCL_NETWORK=0), the same scripted pad presses into the story load in every run; XCL_FRAME_DUMP=300 in the 600 s runs, 100 in the direct DXIL runs. Every run was of a copy named xcl-noprofile.exe: this machine has xcl run: xcl nvprofile puts xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590's 1 GiB shader-heap profile on xcl.exe, and a copy under another name does not match it.

Not tested: which texture the detiler read (the address is not in the log); this PR together with #2598 / #751 as in @GreemSC's runs; AMD / wave64.

AI use: Claude Code (Claude Opus 5.5) built the commit, ran the suite and the runs on my machine, resolved the crash stack, read the logs and wrote this.

@safesearch77

Copy link
Copy Markdown

Reviewed a0734c9f against main (8b957bec). Taking cold builds off the title's thread when
XCL_PSO_WAIT_MS is unset and skipping list_x::defer when waits_until_built() is false both
make sense, with two concrete catches on main:

  1. split_compute_prefers_the_offline_whole_pipeline (crates/xcl/tests/gpu_compute_e2e.rs:124)
    still calls pso_async::resolve_wait with XCL_PSO_WAIT_MS unset and will panic on main.

    • #2615 updated the three older resolve_wait sites in gpu_compute_e2e.rs (388, 527,
      587 on main) to pso_async::wait_built, but #2371 (b49be183) added a fourth call at
      crates/xcl/tests/gpu_compute_e2e.rs:124:
      let pso: ID3D12PipelineState = unsafe { dev.CreateComputePipelineState(&desc) }.unwrap();
      let resolved = pso_async::resolve_wait(pso.as_raw() as usize);
      assert!(real::is_translated_compute(resolved));
    • The child test runs with XCL_ASYNC_PSO, XCL_LAZY_PSO, and XCL_PSO_WAIT_MS all unset
      (gpu_compute_e2e.rs:150-165). In dev_create_compute_pso (real.rs:5751 on 8b957bec), the synchronous
      dxc::cached_only probe hits if super::pso_async::lazy() && crate::gpu::recomp::dxc::defer() { return Some(Err(())); } (real.rs:4327-4329) and returns a lazy stand-in via go_background
      even in the "hit" case. With wait_budget() == None, resolve_wait at line 124 now enters
      resolve_unwaited and returns the unbuilt stand-in immediately, so line 125
      (assert!(real::is_translated_compute(resolved))) fails on a GPU runner (cargo test --lib
      does not compile integration test targets under tests/). Changing line 124 to
      pso_async::wait_built(pso.as_raw() as usize) fixes it.
  2. pso_async::wait_built (crates/xcl/src/hle/d3d12x/pso_async.rs:1276-1290) omits p.want(),
    stalling >= 256 KiB builds in big_compile_turn under low commit and leaving preload builds
    at THREAD_PRIORITY_LOWEST.

    • Old resolve_wait_for(pso, None) called p.want() before waiting on p.cv, and both
      resolve_within (pso_async.rs:1150) and resolve_unwaited (pso_async.rs:1182) call
      p.want(). wait_built enqueues p and blocks unboundedly on p.cv.wait(done) without
      calling p.want():
      • On an xcl-pso* worker, pso_async::build_is_wanted() (pso_async.rs:56, queried by
        real::driver_compile_identified -> big_compile_turn at real.rs:4047-4050, 4092-4104) stays
        false, so any >= 256 KiB (huge_pso_bytes()) shader waited on by wait_built (such as
        retail_pipelines_built_in_the_background_behind_a_stand_in in gpu_pso_e2e.rs:351) cannot
        use wanted_most and blocks indefinitely inside big_compile_turn whenever free pagefile
        commit is below big_compile_headroom(bytes) (3 GiB floor, scaling to 512 * dxil_len).
      • If a THREAD_PRIORITY_LOWEST preload worker (pso_async.rs:75-80, 97-110) already claimed
        the job before wait_built, wait_built never boosts that worker to
        THREAD_PRIORITY_NORMAL and wanted_here() (pso_async.rs:63-65) stays false.
    • Calling p.want(); right before if !p.sent.swap(true, Ordering::AcqRel) in wait_built
      closes both while still keeping p.note_use() out of tool/test waits.

Checked by merging a0734c9f onto main (8b957bec) and running cargo check --workspace --tests
(x86_64-pc-windows-gnu) with both fixes applied (0 errors, 0 new warnings); no GPU, Wine or
Windows run.

AI use: Antigravity (Gemini 4 Carbon High) audited the diff against 8b957bec and compile-checked
the fixes; independently verified by Gemini 4 Hydrogen XHigh.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

A follow-up to our report above (7185722614), on Linux + NVIDIA: on a vkd3d-proton build that releases command-pool memory, the device losses came with #2404's free_aside, not with this PR. Our first tree (#2404 97a70a7 + this PR + #2598), unchanged, lost the device 37 and 63 s after the world load (the first #101) in 2 of 2 runs, Xid 109 in both. With free_aside returning nothing, the same tree kept the device in 2 of 2 runs, for 210 and 234 s after the world load, to the 300 s limit. Without this PR, #2404 5b9d4ff + #2633 lost it 153 s after the world load (1 run, Xid 109).

Setup: RTX 4060 Ti 16 GB, NVIDIA 615.71.09, Wine 11.21 Staging. vkd3d-proton was our report's build, with its allocator Reset releasing the command pool's memory (#2404, 7189698499). The base was main b49be18 + #684, #751, #1599, #1860, #2082 + the rows below. Settings were XCL_DIRECT_DXIL=1 XCL_HUGE_PSO_WANTED_CONCURRENCY=6 XCL_DXC_THREADS=4 XCL_PSO_DISK_CACHE=0, no wait budget, first-run screens done once, 300 s. The two runs of our first tree came 6 to 7 h before the others, before one more offline shader pass; the 5b9d4ff run with free_aside came right after the two without it. One of the first two also logged vkd3d-proton warnings to a file.

tree #2404's free_aside runs lost the device
+ #2404 97a70a7 + this PR a0734c9 + #2598 1e28011 (our first tree) yes 2 2, at 107.8 and 149.8 s
the same, free_aside returning nothing (a local change) no 2 0
+ #2404 5b9d4ff + #2633 db34184, a logging-only line, neither PR yes 1 1, at 232.7 s
+ #2404 5b9d4ff + #2633 db34184 + #2707 dff6edc + this PR + #2598, a logging-only line no (#2707's reset in its place) 2 0
+ #2404 5b9d4ff + #2707 dff6edc, neither PR no 1 0
  • So on this build the losses came with free_aside, with or without this PR. The 18 in our report above were on the build without the pool change and were not rerun without free_aside.
  • On D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404, Raul-Paiva traced a GPU page fault on Windows to free_aside dropping a chained ExecuteIndirect's command buffer 3 ms to 1.1 s after it was recorded (7195594188). KDenKC and thehollowedone read it as a race with another thread that reuses that allocator (7196846147, 7196877276). With a patch for the race, b3IKK's 2 runs had no device removal (7198145884, 7199036830) and Raul-Paiva's 3 had no page fault (7199386758). Our runs of the patch will go to D3D12.X: an ExecuteIndirect of a split program runs its pieces #2404.

Not tested: Windows; AMD; our report's build without free_aside.

AI use: Claude Code (Claude Opus 5.5) merged the trees, made and read the runs, and wrote this.

Posted without review by a person: the account owner was away and reads replies later.

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Conflict note, source read of a0734c9, no run. Besides the PRs the description lists, two open PRs rely on behaviour this changes, and neither would fail to compile:

AI-assisted (Claude Code, Claude Opus 5.5).

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.

10 participants