D3D12.X: a pipeline the driver gave up on is not built again #1665
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1665
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@zorde23 on GitHub · 2026-11-24 18:57 UTC · original
zorde23:preload-skip→main· +202 −13 · 2 files · 1 commits · openPart 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).
85e3826vs 599c69c, 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
@papasmurph0 on GitHub · 2026-11-24 20:08 UTC · original
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.
@DavidM1911 on GitHub · 2026-11-24 21:26 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.Thanks!
@JJAutoCompare on GitHub · 2026-11-25 04:44 UTC · original
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.@Chrysana on GitHub · 2026-11-25 20:13 UTC · original
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
@DavidM1911 on GitHub · 2026-11-26 06:07 UTC · original
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
@bmjask on GitHub · 2026-11-25 21:22 UTC · original · reviewed
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.
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.