d3d12x: bound PSO bind waits, guard pending draws, and auto-init uninitialized targets #1652
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!1652
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1652"
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?
@rdj415 on GitHub · 2026-11-24 18:43 UTC · original
rdj415:pso-compile-watchdog-unblock→main· +2892 −289 · 10 files · 10 commits · draftStacked on #1274. Prevent title watchdog freezes and
DXGI_ERROR_DEVICE_HUNG(0x887A0006) during cold shader compilation by bounding PSO bind waits per frame, skipping draws/dispatches with pending or unready pipelines, auto-initializing uninitialized placed/reserved RT/DS targets before the first draw, keepingD3D12_HEAP_FLAG_CREATE_NOT_ZEROEDfor non-RT/DS streaming textures, and blocking Backtrace telemetry uploads.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs,crates/xcl/src/gpu/recomp/dxc.rs,crates/xcl/src/hle/d3d12x/present.rs: bound runtime PSO bind waits (wait_budget: 250 ms per PSO, 2,000 ms cumulative perPresentXframe viapresent::frame_generation;resolve_wait_criticalgrace capCRITICAL_FRAME_WAIT_CAP_MS= 2,000 ms;XCL_PSO_WAIT_MS=0for unbounded waits), replace FIFO queues inpso_asyncanddxcwith priority-aware scheduling so wanted/warm builds preempt unwanted cold builds, and drop expired background worker threads toBELOW_NORMAL.crates/xcl/src/hle/d3d12x/bind.rs: close theresolve_wait/is_pendingTOCTOU window viaresolve_wait_checked, skip draws andExecuteIndirectdispatches when a translated pipeline is still pending or failed (graphics_bound_with,note_compute_signature/is_compute_signature), and avoid passing unready stand-in PSOs to the PC driver.crates/xcl/src/hle/d3d12x/list_x.rs,crates/xcl/src/hle/d3d12x/real.rs,crates/xcl/src/hle/d3d12x/device_x.rs,crates/xcl/src/hle/d3d12x/vram.rs: track placed/reserved/committed RT/DS targets and RTV/DSV handles (note_uninit_target_if_rt_ds,ensure_bound_targets_initialized,cl_discard_resource), stripD3D12_HEAP_FLAG_CREATE_NOT_ZEROEDonly for RT/DS targets and indirect buffers (should_strip_not_zeroed_resource) while preservingCREATE_NOT_ZEROEDfor ordinary textures/streaming buffers, coalesce duplicate in-flight compute PSO compiles (ComputeFlight), and persist slow (>= 250 ms)<16 KiBcompute driver blobs todriver_cache.crates/xcl/src/hle/netoff.rs,crates/xcl/src/host.rs: hookwinhttp.dll!WinHttpConnect(install_telemetry_block) to reject*.backtrace.iouploads withERROR_WINHTTP_NAME_NOT_RESOLVEDwhile forwarding all other hosts untouched.Tested
rustc 1.98.0-nightly (096694416 2026-06-29), release build and debug unit tests on Windows.cargo test -p xcl --lib -- --nocapture(commitfb07ff8): 747 passed, 0 failed, 21 ignored (SKIPPED GPU tests on 32-lane hardware:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64).scripts/smoke.ps1 -Seconds 60on clean9e3831e(upstream/main) and cleanfb07ff8(pso-compile-watchdog-unblock).Regression run
main:
PR:
Not tested
cargo test --workspace -- --test-threads=4,cargo test -p xcl --test gpu_compute_e2e,cargo test -p xcl --test shaders_e2e, and Python helper tests on commitfb07ff8.<game folder>.AI use
d3d12x-console-vtable-slots(15fab80), resolving thereal.rsconflict, runningcargo test -p xcl --lib, and running thescripts/smoke.ps1verification.06c9f55) into d3d12x-console-vtable-slots f3d1c4008d06c9f55) and d3d12x-console-vtable-slots (f3d1c40) into pso-compile-watchdog-unblock 5829b34f8e@throny on GitHub · 2026-11-24 20:01 UTC · original
World-loading test of
fb07ff8merged ontomainc160d86, againstc160d86itself, on the retail title (counts only).Result: in 3 of 6 runs of this PR, the process's commit climbed from about 16 GB to over 30 GB within 6 – 8 s while the title was still on its menu (22 – 44 s into the run, at about 2.5 – 3 GB/s), and our memory guard stopped the run. None of the 4
mainruns did this; they stay between 15 and 17.5 GB over the same stretch. So I couldn't check whether the PR gets past the stall:mainends at the title's watchdog at 110 – 113 s in all 4 runs, and the other 3 PR runs were stopped by the guard at 85 – 92 s with about 30 GB of commit, before that point.mainThe log shows no shader or PSO activity during the climbs, only the menu's normal presents (60 per 2 s). In the runs that reached world loading, the PR skipped 322 – 1 024 draws and 1 024 – 2 708 dispatches.
Tested
main: 2 runs with the default DXC threads, 2 withXCL_DXC_THREADS=4. PR: 2 with the default, 4 withXCL_DXC_THREADS=4(all three jumps were in those).Not tested: the suite on this head, AMD, a machine with more free commit (whether the PR gets to the end of the stall), and what allocates during the climbs.
This PR is about 2 800 added lines and bundles several changes (PSO wait budget, DXC queue scheduling, skipped draws, target initialisation,
NOT_ZEROEDhandling, driver-blob persistence, a telemetry block). Split into separate PRs, a memory jump like this one could be traced to one of them.AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this.
@DavidM1911 on GitHub · 2026-11-24 21:16 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!
@milesah3ad on GitHub · 2026-11-24 22:27 UTC · original
@rdj415 a question before I write anything, so we don't end up with two PRs for the same thing again. Would you split the per-frame cap on bind waits out of this PR into a small one of its own? That's
wait_budgetagainst a cumulative limit perPresentXframe (present::frame_generation), with binds past it going on with the stand-in. If you'd rather not, I'm happy to write it as a standalone PR that credits this one.Why that piece on its own:
XCL_PSO_WAIT_MSonmainis per pipeline. @MaurycyBartczak's watchdog runs on #156 built 41 compute pipelines during the stall, so a per-pipeline limit of 2 s still allows about 80 s, far past the title's 30 s countdown. A total per frame is what keepsPresentXcoming. VIctory takes the same approach for the same watchdog: 0.5 s of pipeline waits per title frame, after which a draw or dispatch whose pipeline isn't ready is dropped (victory-gpu/src/pipeline/make.rs; ideas only, it's GPL-3.0).Wait64BitValueX) on values whose producer dispatch was skipped. A smoke pair would need to show whether a capped frame trades the watchdog for that.AI use: Claude Code (Claude Opus 5.5) drafted this.
@rdj415 on GitHub · 2026-11-25 05:05 UTC · original
@throny @milesah3ad Thanks for testing and the clear breakdown!
I split out just the per-frame PSO bind wait cap (
present::frame_generation+FrameBudget/XCL_PSO_FRAME_WAIT_MS, with deterministic unit tests and a paired 60 s smoke run on currentmain) into #2114 so it can be reviewed and tested independently from the commit-growth regression and the rest of the changes here.For the open question on #1452: on a longer Windows RTX 5060 Ti run of #2114 alone (
8044bed), the per-frame cap kicked in during world load (at694.8 s) and kept the title past its watchdog with 0 device removals, reaching the opening cutscene dialogue (72,927Opus packets decoded, 0 errors) and opening credits.Wait64BitValueXdid time out 40 times at 2,000 ms while cold compute pipelines were still compiling (46,227dispatches skipped), without triggering a device removal.Converting this PR to draft while breaking out the remaining pieces cleanly.
@throny on GitHub · 2026-11-26 00:48 UTC · original
Two contributors checked independently and found that #1931 #2114 solves the same problem (for #505) in a different way: #1607, group D95. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@DavidM1911 on GitHub · 2026-11-26 05:58 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.