D3D12.X: a pipeline the driver gave up on is not built again #1655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1665"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by zorde23 on 2026-11-24T18:57:59Z.
Part of #1035. No longer stacked: #1918 (in
main) logs the driver's refusal of a huge compute program, which is what #1300 did.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(#1918 logs the refusal). #1398 (retry without DXC GVN) and the switch-form retry of #680 do notchange that here (numbers below); another RX 6750 XT on #1398 also reports the ~14 MB one still refused.
#1524 (in
mainnow) 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. #1996 caps the builds a title waits for and
gives them a slot without waiting for commit; #2178 drops queued builds the title already released. Neither keeps a
refused build from coming back next run. The turn this PR checks is a slot
driver_compile_identifiedtook through thecommit check (since #1996, a slot taken for a waiting title thread is not one).
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 inused-pipelines.txt. Pipelines of such aset 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 (when the build started or by
the time it failed), 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_identifiedalso returns whether the compile had its turn (itsslot came through
big_compile_turn's commit check; the other callers ignore it); each attempt oftranslated_compute_pso_once(the cached-blob one, its cold retry, the switch-form retry) setspso_async::note_driver_gave_up(driver_gave_up(hr, turn, time in the driver)): E_OUTOFMEMORY, the turn, ≥ 1 s.crates/xcl/src/hle/d3d12x/pso_async.rs:used::skipped/skip/is_skipped(!<key>lines, onewrite_allperline);
build(.., preload = true)marks the set when the driver gave up; the preload worker drops queued pipelines of amarked set;
submit_ascompletes 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; gave up whilea title thread waited),
only_a_long_out_of_memory_in_its_turn_is_giving_up(real.rs).Tested
Windows 11 Pro 26200; Rust 1.100 MSVC; release.
cargo test --workspace --no-fail-fast -- --test-threads=4(debug build first): at this PR on06c9f551268 passed,1 failed, 46 ignored; at main
06c9f551264 / 1 / 46. The same test fails on both here and this change does nottouch it:
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1.SKIPPED on both:
f16_programs_on_the_gpu/f32_programs_on_the_gpu(some forms refused),pso_measurement_compiles_an_exact_synthetic_record(no Developer Mode),test_title_draws_with_a_root_signature_under_the_debug_layerand
uploads_start_from_each_subresources_state(no debug layer),heap_window_out_of_memory_falls_back_to_the_switch_form.XCL_NETWORK=0, release, a watchdog that ends the run at 90 % of the system commitlimit (peaks below are system commit). #1321 applied to all four (without it main's commit grows from
b8b1f49):!lines: 240 s, peak 34.3 GB.!lines were written by runs of this change on main47efa2e(preload on, 90 s): peak 53.0 → 53.1 → 19.6 →20.7 GB over four runs, one set marked in each of the first two (the ~23 MB one only shows once the first is skipped).
85e3826vs599c69c, comment above):99.7 % of main's frames, 123 % of its peak commit, no crash or device removal. A 60 s run there does not reach the world
load, where this change applies; on NVIDIA nothing is refused, so nothing is marked. Thanks!
Regression run
Both on
main06c9f55and this PR rebased onto it, release,scripts/smoke.ps1 -Seconds 60 -Title retail-a, preload on,a watchdog at 90 % of the system commit limit (not reached). The PR's run starts with the two
!lines already inused-pipelines.txt(its log: 2 shader sets not built again);mainpasses over them and builds those two sets ahead(no refusal within 60 s). System commit peak: main 33.7 GB, PR 34.2 GB.
main:
PR:
Not tested
reports in #1035: NVIDIA on Windows and Linux, RADV): only a driver's E_OUTOFMEMORY answer marks a set.
main's runs before any refusal), the first runs still pay the full cost and may end the title; it converges one set per
run that survives. The main run above does not write marks (it has no such code): the lines came from runs of this change on
47efa2e.!line (driver update, more memory, a recompiler change that shrinks the DXIL,XCL_HEAP_WINDOWS):the user deletes it to retry; the log line says so. The mark also applies with
XCL_PSO_PRELOAD=0.driver_gave_up); the driver answering it was only seen in theruns above.
compile beside it (#1524's ≥ 4 MiB lane runs next to the other one by default; #1996 lets builds a title waits for skip
the commit check) can use up the commit during a 30-60 s
build; the driver then answers E_OUTOFMEMORY too and the set is marked, for good, though it might build on another run.
Marking only after two such runs would avoid that, at the price of one more run at the limit; not done here.
build in the stats.
#1113 (textual overlap in
used::getand the file format) or #1398 (merges cleanly; its retry resets the timer, so the1 s is measured on the last attempt).
AI use
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
Imported from ivall/xcl. Originally posted by papasmurph0 on 2026-11-24T20:08:40Z.
Regression run for this PR on Windows / NVIDIA, since it has no
xcl-smokepair yet.Tested
scripts/smoke.ps1 -Seconds 60on the retail title of #505 (game folder passed as a neutral junction, hencetitle: t1), each build from a clean worktree of the exact commit.main:this PR:
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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T21:26:32Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.Thanks!
upstream-sync referenced this pull request2026-11-25 04:08:41 +00:00
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T04:44:36Z.
XCL PR #1665 verification
Head
daf72219421f6815e2faa88c089ccd119327c72a(clean detached checkout). The PR changescrates/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 --workspaceandcargo test --workspace --no-runsucceeded outside the Arc mutex.XCL_ADAPTER=NONE_CPU_ONLY,cargo test -p xcl --lib pso_async::used_tests -- --test-threads=1had 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.cargo test -p xcl --lib only_a_long_out_of_memory_in_its_turn_is_giving_up -- --test-threads=1had 1 passed, 0 failed, 0 ignored, 0 skipped. It checked that onlyE_OUTOFMEMORYafter at least one second with a compile slot qualifies.Invoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1,cargo test --workspace --no-fail-fast -- --test-threads=4exited 101. All four new unit tests passed again. Summingpr1665-suite.loggave 944 harness passes, 19 failures, and 43 ignored across 20 results (19 executables and one doctest target).Workspace failures and skips
CreateComputePipelineStatefailures (0x80070057) and four result mismatches. Thee2etarget failed the test title's dynamic depth-bias pixel check (blue where green was expected).SKIPPEDlines 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
mainrun, 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.logand published.Imported from ivall/xcl. Originally posted by Chrysana on 2026-11-25T20:13:31Z.
RDNA4 run of
cd46e3f, for "Other GPUs/drivers" under Not tested (your note says RDNA4 on driver 32.0.31044.16 doesn't grow; on 32.0.32015.2008 it does). On an RX 9070 XT the change works as described: the driver's refusals of builds ahead in their turn get a!line, and the next run doesn't build those sets again. But the largest program here,95cc13288a27a96e(ActivateRays, 2.4 MB DXIL), is never marked: it is refused and built again in every run. That one is where most of the memory goes on this card (#1598).Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4), driver 32.0.32015.2008; Ryzen 7 9800X3D, 31 GB RAM (commit ceiling 79 GB with the page files at their maximum); Windows 11 26200.9974; rustc 1.100.0 MSVC, release. Retail title 1.0.2.1, preload on (1181 shader sets in
used-pipelines.txt, no!lines at the start),XCL_NETWORK=0 XCL_ACTIVITY=1, A pressed every 4 s from 12 to 120 s, 200 s runs,cd46e3fas pushed (its base is06c9f55).How I got the refusals without running the whole PC out of commit: (a first try at a 37 GB limit was stopped by my own system-memory guard at ~142 s, before any refusal.) on
mainhere, ActivateRays alone grows the process by ~16 GB and is refused only when the system nears its limit, at ~44 GB of process commit after 69 s in the driver (numbers in #1598). That took other programs down with it once, so I ran the title in a Windows job object with a 33 GB commit limit for all its processes (JOB_OBJECT_LIMIT_JOB_MEMORY). The driver's allocations fail inside the title, it returns0x8007000eas at the system limit, and the rest of the machine keeps its headroom. The catch: the refusals come sooner (after 4–13 s in the driver), and some programs that would build with more headroom get refused here.Run 1 under the cap, no
!lines at the start: six compute programs refused with0x8007000e, two of them marked:!line67e870153afb3a94ungated here95cc13288a27a96e(ActivateRays)ungated here68d630a8567ab575ungated here517e7bab67ece93fgated (waited 114983 ms)!6c3726c018616a2fb6dd852172e5f719gated (waited 5288 ms)!7edd0762558da1f533743bd6d1e45443ungated hereThe two marks match the two gated builds (same thread and time as their
the driver gave up on a pipeline built ahead (shaders …): not built againlines). The fourungated hereones are what your description leaves to be tried again.Run 2, same cap, with those two lines:
2 shader sets the driver gave up on in an earlier run are not built again (stand-ins; …).517e7bab67ece93fnorb6dd852172e5f719is compiled (nodriver compile startfor either).gated (waited 101125 ms), so it had its turn, and it is still not marked.!lines at the end). These are artefacts of the 33 GB limit: with more headroom some of them would build.Both runs ran the full 200 s, exit 0, no device removal. First
#101at 105.2 / 103.7 s; presents stop 2–3 s after it in both (the four-queue wait of #1993, the same asmain).What this means on RDNA4, as far as I can tell:
mainwithout the cap (69 s in the driver) and in run 1 here, its compile isungated here(a title thread's). In run 2 it is gated, but its compile starts 1.4 s after the first#101, as the world load binds it. Going bybuild(), a gated refusal isn't marked when the build isn't the preload's own or a title thread came to wait for it, and I'd guess the latter, though the log doesn't say which. So under this PR it comes back each run, as onmain. Whether a refusal the title waited for should be remembered too is your call.!line stays until someone deletes it. On a machine that is short of commit for a moment (other programs open, as here under the cap), a build ahead that would succeed later is skipped in every run after. The log line says how to retry; it may be worth logging the free commit when the mark is written, so it's possible to tell a real "never fits" from a busy moment.Not tested
mainreached it without the cap in #1598's runs).XCL_PSO_PRELOAD=0, the RDNA2 iGPU.AI use
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:22:11Z.
Review: COMMENTED
No concrete source-level defect found. Marker parsing/preload behavior and retry-state replacement look sound; current Windows CI is green. Residual documented tradeoff: a transient long E_OUTOFMEMORY can suppress a shader set until user deletes its ! line. Consider logging available commit at mark time to support that manual recovery decision. I found no blocker.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T06:07:45Z.
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
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T14:46:27Z.
Independent desktop NVIDIA verification of PR #1665 at head
cd46e3fc2bd9d298143d20dc5c49b209027621d0(1commit; exact parent & merge-base:06c9f5505f63f10c5ec49ef932d75b2c28177324, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
cd46e3fc)cargo test --release -p xcl --lib -- --nocapture a_skipped_key_is_read_from_the_file a_pipeline_the_driver_gave_up_on_is_not_built_again a_build_ahead_that_fails_otherwise_is_tried_again only_a_long_out_of_memory_in_its_turn_is_giving_up(3 consecutive runs)4 passed; 0 failed; 0 ignored; 1222 filtered out× 3 (0.01s,0.01s,0.01s,0skipped)cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::pso_async::(3 consecutive runs)13 passed; 0 failed; 0 ignored; 1213 filtered out× 3 (0.61s,0.61s,0.60s,0skipped)cargo build --release -p xcl1m 49s, exit0,0new warnings in PR-touched lines)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
06c9f5505f63f10c5ec49ef932d75b2c28177324, cached baseline on the same machine):PR #1665 (
cd46e3fc2bd9d298143d20dc5c49b209027621d0):Limits of coverage
4new unit tests (a_skipped_key_is_read_from_the_file,a_pipeline_the_driver_gave_up_on_is_not_built_again,a_build_ahead_that_fails_otherwise_is_tried_again,only_a_long_out_of_memory_in_its_turn_is_giving_up) and the fullhle::d3d12x::pso_async::suite (13/13,0skipped) passed3/3, directly verifying!<key>skip persistence,driver_gave_upgating (E_OUTOFMEMORYafter>= 1 sin a big-compile turn), and retry behavior for other failures.E_OUTOFMEMORYPSO refusal occurred during the 60 s retail smoke on RTX 4060 (0device removals,0crashes, steady 60 Hz), so the end-to-end driver-refusal skip-file write path was verified via the unit tests rather than a live driver OOM; single-run frame/commit delta vs. the cached parent reflects normal startup variance.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T15:28:20Z.
At head
cd46e3f, I found a same-launch gap in the refusal marker.submit_lazychecks!<key>when it creates a pending job, and the preload worker checks after taking one. If another job with that key is already pending when the first build records the marker, a direct bind can still run its closure on the title thread; a budgeted bind can send it to a normal worker without another marker check. That can repeat the driver build this PR intends to avoid.I added a synthetic regression that submits a lazy job, marks its key, then binds it. On the unmodified head, it failed at the direct bind: the job ran and returned
0x4327instead of the stand-in. The candidate below checks the marker when a worker claims the job and before a direct bind executes it, drops skipped closures, and completes their pending entries. It covers both direct and budgeted binds. With the candidate, the new test passed (1/0) andcargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::pso_async:: -- --test-threads=4passed 14/0.cargo build --offline --locked -j 4 --workspacepassed.cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --quietrecorded 1,269 passed, 1 failed, 46 ignored, with 25 GPU skip notices. The sole failure,console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(DXIL not compiled yet), reproduced with the same focused command on a separate, untouched checkout of this PR head. I did not run a live driver-refusal scenario or a paired smoke on this uncommitted candidate.Candidate regression and fix
AI use: Codex (GPT-6.2 Sol) wrote and ran the regression and candidate; Codex (GPT-6.2 Astra) independently traced the affected paths and reviewed the candidate.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-27T16:12:30Z.
Tested on AMD / Linux:
cd46e3fc(RX 9070 16 GB, RDNA4, Mesa 26.3.1 RADV; Ryzen 5 9600X, 32 GB; CachyOS; Proton Experimentalexperimental-11.0-20261112with vkd3d-proton masterec207194plus a local patch dropping thelpVtblchecks of command allocators and lists; DXC 1.9.2609.5; Rust 1.96.0,x86_64-pc-windows-gnudebug build, tests run under Wine)The head as it is (not merged onto current
main), with its base06c9f550as the baseline.Tests (
XCL_REQUIRE_GPU=wave64)cargo test -p xcl --lib -- hle::d3d12x::pso_async:: --test-threads=1: 13 passed, 0 failed, 0 ignored.cargo test -p xcl --lib -- only_a_long_out_of_memory_in_its_turn_is_giving_up --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(here the first loses the RADV device, the other two run out of memory under Wine): lib 1184 passed, 16 failed, 26 ignored; base06c9f550(this PR's base) the same session: lib 1180 passed, 16 failed, 26 ignored. The failures are the same set as on the base. The other binaries fail the same 3 tests as on the base (e2e,pls_quota,predication_e2e).d3d12_resource_and_sync: 3 passed, 0 failed on this head; on the base its fence and queue test ended the process (exit 1), which it does in most trees here,mainincluded.Not tested
XCL_PSO_PRELOAD=1) there is nothe driver refused the compute PSOline and noE_OUTOFMEMORY, so a run would not reach the new path on RDNA4 / RADVAI use
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:28:11Z.
merge-check claim
head:
cd46e3fc2bImported from ivall/xcl. Originally posted by throny on 2026-11-27T23:41:20Z.
merge-check
base:
2c717a04head:
cd46e3fc2bmerge: clean
build: cargo build --workspace -> FAILED (E0308)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> not run (the merge result does not build); base alone: 1466 passed, 0 failed, 47 ignored (26 SKIPPED lines)
review: blocking: merged onto current main it does not compile, although GitHub shows no conflict and git merges it cleanly. The PR makes driver_compile_identified return three values; main has since gained a caller in the mesh path (real.rs, 'let (hr, took) = driver_compile_identified(label, mesh_bytes, ...)') that takes two: error E0308 at real.rs:6138 of the merge result. Also to decide before merging, from reading the change: a 'gave up' mark is a line in used-pipelines.txt and stays for ever, across driver and XCL updates (the key is per shader set), and it is written after an out-of-memory result of a build-ahead compile, so a shortage caused by other programs at that moment makes the skip permanent; a draw with such a pipeline keeps its stand-in (a graphics draw draws nothing). Open from the thread: within one run a direct or budgeted bind can still build a marked key; the largest program is never marked because the title waits for it; log the free commit when a mark is written.
performance: no frame cost; saves memory and time where the driver runs out of memory (reasoned).
verdict: not yet: rebase and update the mesh caller; and an expiry or a driver-identity part for the mark (or a note why permanent is right). I will rerun the suite on the new head.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:26:55Z.
Triage (#1607) – head
cd46e3fNo open or merged PR makes the same change. #2527 (also #1035) deals with the same runaway driver compiles in a different way: it refuses compute programs from a hand-written
XCL_REFUSE_CSlist. This PR does it automatically: a build ahead that ends in E_OUTOFMEMORY after at least 1 s in its own big-compile turn is written to used-pipelines.txt as a!<key>line and gets the stand-in from then on.No correctness problems found in the diff. Two things are design choices for the maintainer. The mark lasts across runs until someone deletes the
!line by hand, so a single run that was short of memory disables that pipeline for every later run. Only compute builds set the flag; graphics builds never mark.The PR conflicts with main: driver_compile_identified now takes
(record: Option<u64>, cached: bool), and pso_async.rs has grown a lot.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.