Skip to content

D3D12.X: a pipeline the driver gave up on is not built again - #1665

Open
zorde23 wants to merge 2 commits into
xcl-dev:mainfrom
zorde23:preload-skip
Open

zorde23 wants to merge 2 commits into
xcl-dev:mainfrom
zorde23:preload-skip

Conversation

@zorde23

@zorde23 zorde23 commented Nov 24, 2026 •

Copy link
Copy Markdown

Stacked on #1300; only the top commit belongs here. Part of #1035.

The pipeline preload (#690) builds every pipeline an earlier run used. On an AMD RX 6750 XT two compute programs of a retail
title (~14 MB and ~23 MB of translated DXIL) each kept the driver busy 45-55 s, took the commit to the limit and were
refused with E_OUTOFMEMORY, in every run, because a failed build leaves nothing behind and the key stays in
used-pipelines.txt (#1300 logs the refusal). #1398 (retry without DXC GVN) and the switch-form retry of #680 do not
change that here (numbers below); another RX 6750 XT on #1398 also reports the ~14 MB one still refused.

#1524 (in main now) changes when these builds run, not whether they fail: big programs go to the driver a few at a time
(XCL_HUGE_PSO_CONCURRENCY, default 1, and ≥ 4 MiB in a lane of its own), which this preload already did one at a time.
Each of the two programs alone still takes the driver to its limit here. This PR now sits on #1524's gate: the
big-compile turn it checks is the slot driver_compile_identified takes.

When the driver returns E_OUTOFMEMORY after working 1 s or more on a build ahead that had its big-compile turn (commit
free, no title thread waiting for it), the shader set gets a !<key> line in used-pipelines.txt. Pipelines of such a
set get their stand-in at once (what they got before, when the build failed) instead of being built again, ahead or at a
bind. Other failures, an out-of-memory next to a title thread that waits for the pipeline, and an attempt followed by a
retry that fails for another reason are tried again next run. Older builds pass over the new lines.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: driver_compile_identified also returns whether the compile had its slot; each
    attempt of translated_compute_pso_once (the cached-blob one, its cold retry, the switch-form retry) sets
    pso_async::note_driver_gave_up(driver_gave_up(hr, slot, time in the driver)): E_OUTOFMEMORY, the slot, ≥ 1 s.
  • crates/xcl/src/hle/d3d12x/pso_async.rs: used::skipped / skip / is_skipped (!<key> lines, one write_all per
    line); build(.., preload = true) marks the set when the driver gave up; the preload worker drops queued pipelines of a
    marked set; submit_as completes a marked set's pipeline as failed at once. Tests: a_skipped_key_is_read_from_the_file,
    a_pipeline_the_driver_gave_up_on_is_not_built_again (fails on main: the second pipeline is not done at once),
    a_build_ahead_that_fails_otherwise_is_tried_again (also: gave up, then a retry that fails otherwise),
    only_a_long_out_of_memory_in_its_turn_is_giving_up (real.rs).

Tested

Regression run

Both on main 1d027e5 (with #1321) and this PR rebased onto it, release, scripts/smoke.ps1 -Seconds 60, the game folder
passed as a neutral junction (title: retail-a), monitor attached, preload on, a watchdog at 90 % of the system commit
limit (not reached). The PR's run starts with the two ! lines already in used-pipelines.txt; main passes over them
and builds those two sets ahead (no refusal within 60 s). System commit peak: main 34.8 GB, PR 34.2 GB.

main:

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: AMD Radeon RX 6750 XT
title: retail-a
seconds: 60
exit: 0x0
frames shown: 1496 (PresentX 1496)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19084 MB

PR:

xcl-smoke v1
commit: daf72219421f6815e2faa88c089ccd119327c72a
gpu: AMD Radeon RX 6750 XT
title: retail-a
seconds: 60
exit: 0x0
frames shown: 1556 (PresentX 1556)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18076 MB

Not tested

AI use

  • Claude Code (Claude Opus 5.5) investigated, wrote the code, tests and this text from runs on my machine; Claude Fable 5.2
    reviewed the design and the rebased diff and tried to break it (its findings changed the marking rule). I reviewed and
    ran everything.

Written with Claude Code from runs on this machine.

🤖 Generated with Claude Code

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…g, DirectStorage, and stream tracking

Cherry-picks upstream stabilization improvements across VRAM allocation,
pipeline caching, DirectStorage lifetime, descriptor heap indexing, Media
Foundation device bridging, and stream PSO tracking:

- D3D12.X: reclaim cooling and idle tiles on pool heap OOM (xcl-dev#1663,
  addressing xcl-dev#1585 and xcl-dev#1668). When CreateHeap returns 0x8007000E (E_OUTOFMEMORY),
  Pages::take_tile waits on Pages::fence up to 1000 ms to drain cooling tiles or
  force-evict idle pages rather than failing immediately. (by Nikita Romanovich)

- DirectStorage: close a queue when its last reference is released (xcl-dev#1675).
  Moves queue_close logic into QueueInner::close and invokes it when the final
  queue reference is released, preventing background workers from writing to freed
  caller buffers and marking pending entries complete with E_QUEUE_CLOSED. (by eizispark)

- D3D12.X: a pipeline the driver gave up on is not built again (xcl-dev#1665).
  Persists driver E_OUTOFMEMORY refusal state into used-pipelines.txt (!<key>)
  so giant compute pipelines that the host driver refuses to compile are skipped
  on subsequent runs. (by zorde23)

- Recompiler: access outside heap windows takes a null view without branching
  (xcl-dev#1669, xcl-dev#680). Replaces conditional branches in XCL_HEAP_WINDOWS=1
  (if (xcl_w >= windows)) with a branchless select pointing out-of-bounds accesses
  to a dedicated null UAV view (MEM_HEAP_NULL). (by milesah3ad)

- HLE: bridge ID3D12Device before direct ResetDevice and cache D3D11 companion
  (xcl-dev#1677). Fixes MFResetDXGIDeviceManagerX in mfplat.rs to bridge
  ID3D12Device COM pointers and caches multithreaded companion ID3D11Device
  instances per adapter LUID. (by eizispark)

- D3D12.X: route stream graphics PSOs through create_graphics_pso_tracked
  (xcl-dev#1661, finding XCL-BT-023 from xcl-dev#1489). Ensures stream-created
  graphics PSOs receive D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS and are
  tracked in device_x::note_base for CreateDerivedPipelineStateX and RSSetDepthBiasX.
  (by fixgep)

Assisted-by: Antigravity
@papasmurph0

Copy link
Copy Markdown

Regression run for this PR on Windows / NVIDIA, since it has no xcl-smoke pair yet.

Tested

main:

xcl-smoke v1
commit: 85e38262ff94aecd75d6f83fa8156a8b7697bd13
gpu: NVIDIA GeForce RTX 4080 SUPER
title: t1
seconds: 60
exit: 0x0
frames shown: 1537 (PresentX 1537)
presents per 2 s (last 3): 57 60 60
device removals: 0
crashes: 0
peak commit: 15976 MB

this PR:

xcl-smoke v1
commit: 599c69c58bfd4ebe35ee03c76a345e46dacdb497
gpu: NVIDIA GeForce RTX 4080 SUPER
title: t1
seconds: 60
exit: 0x0
frames shown: 1532 (PresentX 1533)
presents per 2 s (last 3): 59 48 53
device removals: 0
crashes: 0
peak commit: 19686 MB

Both runs started from the same state: the title showed its first-run screens (terms, screen narration) in both, so the pair is like for like. The title saved its settings during this PR's run, so later runs on this machine skip those screens and are not comparable with these two.

The PR's run is within the limits: 99.7 % of main's frames, 123 % of its peak commit, no crash, no device removal.

Not tested: the world load, where the PR's change applies; a 60 s run does not reach it here. On this machine (125 GB commit limit) the title's screen-probe programs reach the in-title driver build in longer runs, so a longer run of this PR is possible if useful.

AI use: Claude Code (Claude Opus 5.5) built the trees, made the runs on my PC and wrote this report; I asked for it to be posted.

anoyarou added a commit to anoyarou/xcl that referenced this pull request Nov 24, 2026
…driver gave up callback

Eliminates compiler warnings for unused items:

- D3D12.X: removes rb_fence and rb_value from sparse::State and test fixtures
  (xcl-dev#1732). Readback fences are now managed per-queue in RB_QUEUES
  by async readback workers, making the fields on State obsolete.

- D3D12.X: hooks note_driver_gave_up in real::translated_compute_pso_once when
  driver_compile_identified returns E_OUTOFMEMORY after DRIVER_GAVE_UP_AFTER
  (xcl-dev#1665, xcl-dev#1524), ensuring failed massive compute pipelines are
  persisted in used-pipelines.txt (!<key>) and eliminating dead code warnings.

Assisted-by: Antigravity
@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, ~22 ignored.

Thanks!

@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
zorde23 and others added 2 commits November 24, 2026 20:15
The refusal went only through note_translation_error, which logs its first 40
distinct reasons; a retail title's mesh warnings use them up in the first seconds,
so a 14 MB program the AMD driver worked on for 45 s and refused with E_OUTOFMEMORY
left no line at all. Log hr, DXIL size and the time in the driver (first 16, then
powers of two).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The preload builds every pipeline an earlier run used (used-pipelines.txt). On an
AMD RX 6750 XT two retail compute programs (14 and 23 MB of DXIL) kept the driver
busy 45-55 s each, took the process to ~53 GB of commit and were refused with
E_OUTOFMEMORY, in every run, since nothing was kept. When the driver runs out of
memory after working for 1 s or more on a build ahead that had its big-compile
turn (commit free, no title thread waiting for it), its key now gets a !<key>
line; such pipelines get the stand-in at once (as when the build failed) instead
of being built again, ahead or at a bind. Other failures, and an out-of-memory
next to a title that waits for the pipeline, are tried again next run; each
attempt (a retry in the switch form too) is judged on its own. Older builds pass
over the new lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zorde23
zorde23 marked this pull request as ready for review November 24, 2026 23:37
@JJAutoCompare

Copy link
Copy Markdown

XCL PR #1665 verification

Head daf72219421f6815e2faa88c089ccd119327c72a (clean detached checkout). The PR changes crates/xcl/src/hle/d3d12x/{pso_async,real}.rs.

STOR-WINLAB, Windows 11 Enterprise Evaluation x64 build 26200.9974, AMD Family 23 Model 113 (12 logical CPUs), Intel Arc A770 (16 GiB), driver 32.0.101.9175, DXC 1.9.2609.5, rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Unoptimized dev/test profiles, debug info and incremental compilation disabled.

Tested

  • cargo build --workspace and cargo test --workspace --no-run succeeded outside the Arc mutex.
  • With XCL_ADAPTER=NONE_CPU_ONLY, cargo test -p xcl --lib pso_async::used_tests -- --test-threads=1 had 9 passed, 0 failed, 0 ignored, 0 skipped. New tests checked parsing !<key> markers, returning the stand-in at the next bind without executing the replacement build after a simulated driver failure, and retrying when the final attempt failed for another reason.
  • With the same adapter setting, cargo test -p xcl --lib only_a_long_out_of_memory_in_its_turn_is_giving_up -- --test-threads=1 had 1 passed, 0 failed, 0 ignored, 0 skipped. It checked that only E_OUTOFMEMORY after at least one second with a compile slot qualifies.
  • Under Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1, cargo test --workspace --no-fail-fast -- --test-threads=4 exited 101. All four new unit tests passed again. Summing pr1665-suite.log gave 944 harness passes, 19 failures, and 43 ignored across 20 results (19 executables and one doctest target).

Workspace failures and skips

  • The library target had 14 CreateComputePipelineState failures (0x80070057) and four result mismatches. The e2e target failed the test title's dynamic depth-bias pixel check (blue where green was expected).
  • 25 exact SKIPPED lines provide no coverage. Reasons include missing wave64 (17), per-lane lowering refusal (3), missing debug layer (2), and one each for tiled tier below 2, unavailable cache control, and unavailable heap windows.

Not tested

Matched main run, retail-title smoke, real driver OOM, on-disk skip-marker write and reuse across processes, or other adapters.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1665-suite.log and published.

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.

5 participants