D3D12.X: a bind does not wait for a pipeline behind the workers' queue #1273
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!1273
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1273/head"
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?
@427001 on GitHub · 2026-11-24 14:04 UTC · original
427001:pso-wait-behind-queue→main· +90 −4 · 1 files · 1 commits · closed without mergingWith
XCL_PSO_WAIT_MSa compute bind waited its whole budget for every pipeline not built yet, also for one whose build stood behind others in the workers' queue and could not start in that time. At a retail title's world start this held the title's threads for about 20 s, with a 30 s hang watchdog. A bind now waits only when a worker has started the build or is free to start it; otherwise the pipeline is late at once, as after a wait that ran out. WithoutXCL_PSO_WAIT_MSnothing changes. Part of #505.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs: the workers' queue counts the builds no worker has taken yet and the workers at a build (send,BACKLOG,BUSY);resolve_withinasksworth_waitingbefore it waits, and logs the pipelines it does not wait for (the first 4, then at powers of two). Tests:binds_of_pipelines_behind_the_workers_queue_do_not_wait(fails without the change: six binds wait 6 x 300 ms, 1.84 s measured) anda_bind_waits_only_for_a_build_a_worker_has_or_can_start.Tested
stable-x86_64-pc-windows-msvc; tests in debug, runs in releasecargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4onbe8d052: 753 passed, 0 failed, 41 ignored;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaredevice_type = "lockhart"), 300 s runs withXCL_NETWORK=0 XCL_PSO_WAIT_MS=50 XCL_COHERENT_MB=512and scripted A presses, from the same saved state. These runs are not of this head:maindoes not reach the world on this profile, so they are of a local merge of47efa2e+ #605 + #495 + #615, without this change and with it applied on top (as it was before its rebase onto930e8b4; the same condition inresolve_within).+0x32648e1at 174.9 s,+0x43c5d59at 171.7 s+0x5228010at 165.7 s,+0x27c195dat 193.2 sXCL_THREAD_DUMP_ATevery 4 s) three of the title's threads are inbind.rs:710→resolve_for_bind→resolve_wait→ the condvar wait ofresolve_withinin the dumps of the stall.GPU queue.Wait … did not complete within 5000 mslines from 171 s; that is not this wait (17 to 32 binds ran out of their 50 ms in the whole run).Regression run
main(930e8b4):this PR's head (
be8d052):Both with the default (Series X) profile and without
XCL_PSO_WAIT_MS: 60 s stay in the title's first screens and do not reach the changed code.Not tested
AI use
🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@DavidM1911 on GitHub · 2026-11-24 14:07 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@l0g3n on GitHub · 2026-11-24 15:10 UTC · original
Tested
930e8b4andbe8d052on an RX 7600 with Adrenalin 26.11.2, Windows 11 build 26300.9974, and XCL_PSO_WAIT_MS=50 on both. The patched build logged at least 513 queued pipeline builds it did not wait for, and I saw slightly more of the first scene. Both runs ended with DXGI_ERROR_DEVICE_HUNG (0x887A0006). One run per build, baseline first, with a shared shader cache.@Chrysana on GitHub · 2026-11-24 16:03 UTC · original
RDNA4 run of
be8d052, adding to l0g3n's RX 7600 report. WithXCL_PSO_WAIT_MS=50the GPU hangs (0x887a0006) onmainas well, in every run, so the hang doesn't come from this PR. Without the variable the PR runs the same asmainhere.Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4), driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 26200.9974, rustc 1.100.0 MSVC, release. Retail title 1.0.2.1, the same saved state for every run.
main930e8b4against this PR's headbe8d052, which sits directly on it. Every run:XCL_NETWORK=0 XCL_PRESS_A_AT=20,25,30.With
XCL_PSO_WAIT_MS=50: 240 s runs into the world load,XCL_ACTIVITY=1. Run order:main, PR, PR, thenmainagain 20 min later. Driver blobs stay on disk between runs.main1main2mainit comes 31–41 s later. That's two runs each, so it's a pattern, not a measurement.(513 so far)at 108.5 s and 108.8 s, so it does what it says.main47efa2e, same saved state), skipped draws and dispatches stay at 0 and the runs end at the title's own stop at+0x23cf683at 134–147 s (#534).Wait64BitValueX … bridged to GPU queue.Wait (… wait-before-signal …). If that's it, any bind that gives up can hang the GPU (onmainafter 50 ms, on the PR at once), and the PR only gets there sooner.A warning for anyone testing this on AMD: back-to-back runs with the variable froze this PC completely. Three runs in a row gave 4 GPU timeouts (LiveKernelEvent 141) in 6 minutes. The driver recovered each time until it didn't, and the machine needed a hard reset. The fourth run above was run on its own, with a script that kills the title as soon as its log says the device was removed: one timeout, and the driver recovered.
Regression (without
XCL_PSO_WAIT_MS):scripts/smoke.ps1 -Seconds 60from each tree, alternating, two rounds.main1147 / 1134 frames, PR 1178 / 1182 frames; 0 crashes and 0 device removals in all four. First round:Tested
cargo test -p xcl --lib pso_async -- --test-threads=4(debug): 7 passed, 0 failed, 0 ignored, including both new tests (binds_of_pipelines_behind_the_workers_queue_do_not_wait,a_bind_waits_only_for_a_build_a_worker_has_or_can_start).Not tested
AI use
@Krashgamer on GitHub · 2026-11-24 16:04 UTC · original
Test report on an NVIDIA wave32 card, with where the title's threads wait in both builds. Short version: with this PR the subrender threads no longer wait in
resolve_within, as intended, but this machine then skips about 10× more draws and dispatches and ends earlier, twice with0x887a0006. The sample is small (2 runs vs 3), so I read it as a data point, not a verdict.Setup
XCL_NETWORK=0 XCL_PSO_WAIT_MS=50 XCL_PAGE_BUDGET_MB=4096, A pressed byXCL_PRESS_AT, 420 s cap. DXIL and driver-blob caches warm (earlier runs).main930e8b4+ #640 + #1316 + #1055 + #1102 + #800 (local test tree); "with" addsbe8d052. So this is not a cleanmainA/B.Results (counts from XCL's own log lines)
be8d052(3 runs)+0x23cf683at 403 s; no crash in 420 s0x887a0006at 194 s and 204 s; watchdog+0x23cf683at 249 squeue.Wait … released on CPUWhere the threads wait at the watchdog (thread dumps, symbolized against each build's PDB; title RVAs from my own copy of the exe)
+0x23cf6a0(called from the state handler at+0x8126a2) is not a fatal routine. It is the main thread's sync with the render thread: an infiniteWaitForSingleObjecton a semaphore the render thread releases after each frame (stack+0x56a0d < +0x23cf735 < +0x8126a7). The watchdog at+0x2215a60fires because the main thread sits there for 30 s.+0x23cefb0, frame+0x23cf4c0): waits at+0x43c3d5dfor its fiveSubrender:%02uworker threads.bind.rsdispatch →pso_async::resolve_within(stack… < +0x248c341 < +0x248cb78), 513+ pipelines logged "still being built after 50 ms" by 405 s. That is the chain this PR targets.pso_async. The submission thread (+0x24821e3) waits inlist_x.rswait_all_on; the last waits are direct-queue waits on compute queue 4 atcompleted = recorded − 1(… >= 0x381 did not complete within 5000 ms).So on this card the PR does remove the PSO wait from the hang chain; what it leaves behind is more skipped work and the GPU-side waits / device hangs. Whether the extra skips cause the hangs or only coincide with them I cannot tell from five runs; the video-memory difference (11.9 vs ~10 GB on a 10 GB card) is a second possible cause.
Not tested: plain
main+ this PR alone; AMD; more runs per build.AI use: Claude Code (Claude Opus 5.5) ran the runs, traced the waits (thread dumps, IDA on my own copy of the title) and wrote this.
@Royalflamejlh on GitHub · 2026-11-24 16:17 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA test of
be8d052onmain930e8b4+ #684 withXCL_PSO_WAIT_MS=50, 5 alternated runs of 140 s each way of a retail title: with it the first few hundred late binds passed in 1.3 to 1.7 s instead of 18 s or more, in 5 of 5 runs. The title did not get further for it: it stopped presenting about 25 s earlier and every run with it ended by 135 s, at the watchdog or a device removal, where no run without it had ended by 140 s.Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch,
VKD3D_CONFIG=ignore_shared_fence. RTX 4070 12 GB (driver 615.71.09, 32-lane waves), Ryzen 9 9950X3D (31 pipeline workers), 64 GB RAM. Release, cross-compiled tox86_64-pc-windows-gnu(rustc 1.98.0), DXC 1.9.2609.5,XCL_NETWORK=0,XCL_PSO_PRELOAD=0,XCL_PSO_WAIT_MS=50. Retail title 1.0.2.1, the first-run screens completed once and no story progress, one A press at 44.8 s throughXCL_PRESS_AT.be8d052merged ontomain930e8b4+ #684 (e56dbc3) without conflicts.mainisb7aa9f3now;pso_async.rsis the same in both.Tested
cargo test --release -p xcl --libfor the two tests it adds, under Wine, on the merge: 2 passed, 0 failed.930e8b4+ #684be8d052queue.Wait … did not complete within 5000 msD3D12 device removed: 0x887a00050x80000003atgame+0x2474606at 118.2 and 129.4 s; null write atgame+0x23cf683at 134.6, 134.5 and 134.6 sThe log line of the change in every run with it:
One more run without it, of 175 s, ended the same way later: last present at 137.9 s, the first
queue.Waitrelease at 142.9 s, the device removed and the null write atgame+0x23cf683at 168.6 s. So on this machine the change moves the same end about 34 s earlier (1 long run without it). In the first four runs of each, the title presented 3 to 8 frames between 104 and 140 s without it and 2 or 3 with it.The fifth run of each tree was later throughout (its late binds started 14 s later than in the other four), and the fourth and fifth with the change had NVIDIA kernel messages during them (312 and 1; the 1 is an Xid 31 from another process on the card). The first three pairs had none and show the same.
This card's video memory was full (9.6 GB local) from about 76 s in every run, so what follows the late binds here may be the card as much as the title. The order of events is the one the RX 9070 XT and RTX 3080 reports above give.
Read
pso_async.rs:590(worth_waiting) and:614: a bind is not waited for when every worker is at a build and it is not this pipeline's. That is what the runs show: 31 workers busy, and each such bind returns at once.pso_async.rs:558:resolve_withinis only reached with a budget, so withoutXCL_PSO_WAIT_MSnothing changes, as the description says. Not run here.queue.Waitreleases start 20 to 29 s earlier here. Is the wait worth keeping for a build that is next in the queue, or is the stall after it a separate matter for #505?Not tested: without
XCL_PSO_WAIT_MS; other limits than 50 ms; the preload of #690 on; a card with free video memory at that point; the rest of the test suite; AMD and Intel.AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the tests and the eleven runs with
XCL_PRESS_AT, compared the logs and wrote this report.@chippy01 on GitHub · 2026-11-24 16:51 UTC · original
Test report for
be8d052on an RTX 3070 Ti 8 GB (32-lane waves), with the default (Series X) profile at the world start: the case this PR lists under Not tested.Tested
cargo build --workspace+cargo test --workspace -- --test-threads=4onbe8d052: 753 passed, 0 failed, 41 ignored;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware. Both new tests pass.XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_WAIT_MS=50 XCL_FRAME_DUMP=1,scripts\smoke.ps1 -Seconds 360, one run per build:be8d052first, thenmain930e8b4. Both runs got the 4095 MB coherent window.main930e8b4be8d052Wait64BitValueXtimed out at…fe18(op 7,queue_type=0)bd1/bd9/bda/be4, memory holdsbcf/bd6/bd5/be2+0x2215c35at 208 s; no+0x23cf683watchdog…fe18goes down while the wanted one goes up, as in that report).Not tested
mainrun was stopped before it reached the counter stop or the watchdog, and ran second, with warmer caches (its world start came ~40 s earlier).XCL_PSO_WAIT_MSvalues, the Series S profile, AMD and Intel GPUs.AI use
@Gruzzberry on GitHub · 2026-11-24 18:14 UTC · original
Test report for #1273 (a bind does not wait for a pipeline behind the workers' queue) – PR head
be8d052merged intomainb7aa9f3(local merge672343c, no conflicts). Written for the stop atgame_scarlett_master.exe+0x23cf683(#846, #675).Tested
stable-x86_64-pc-windows-msvc, release build; DXC 1.9.2609 (XCL_DXC_DIR).XCL_NETWORK=0, warm DXIL and driver-blob caches, first-run setup done; menus walked withXCL_PRESS_A_AT(same script every run). NoXCL_PSO_WAIT_MS.mainb7aa9f3against the merge above, one clean run each (330 s limit, started only after the machine-wide shader precompile had exited);XCL_PRESS_A_AT=30,45,60,90,120, nobody at the controls.b7aa9f30xc0000005write at 0,+0x23cf683, 140.0 s0xc0000005write at 0,+0x23cf683, 123.1 s; the process then hung instead of exiting (0 % CPU, killed after 17 min)#101)+0x23cf683(123 s against 140 s on main). The run is one sample each; main's earlier runs under heavy concurrent shader compilation (not used here) ended at 135 s.Wait64BitValueX ... bridged to GPU queue.Wait (wait-before-signal, prod=qNone)lines appear at ~92 s, right as presents stop; main shows none in its log.Not tested
cargo teston the merge (not run).AI use
@ThiagoAlexsander on GitHub · 2026-11-24 18:36 UTC · original
Windows + NVIDIA datapoint: with this PR, the title still stops presenting during loading. At that moment the binds wait for pipelines that are already being compiled.
Setup: Windows 11 Pro 26300, RTX 5080 16 GB (driver 32.0.16.1088), Ryzen 7 9800X3D, 62 GB. Rust 1.100.0, release. Retail title 1.0.2.1. The build was a local tree of
mainb7aa9f3with this PR (be8d052), #541 and #681 merged, plus an unpublished switch of mine. That switch dumps every thread twice, 1 s apart, once no frame has been presented for 6 s, then ends the run. The run hadXCL_NETWORK=0,XCL_SHORT_MOVIES=1, an A press at 10 s, and noXCL_PSO_WAIT_MS.What the dumps show: presents stopped after frame 947, at about 53 s.
pso_async.rs:550, reached frombind.rs:238(frames symbolized from the PDB). Three of them had the same stack in both dumps.xcl-pso-0,-1,-4,-5andxcl-pso-pre-0) are insidenvgpucomp64.dll.game+0x23cf735, next to the+0x23cf683end of #846.Before this PR (
main930e8b4, same switch): the waiting title thread was inresolve_wait, reached fromDispatch(bind.rs:710). So this PR does change where binds wait. On this machine the remaining wait is for builds that are in flight, not queued.That run compiled 157 compute pipelines fresh: 52 s of driver time, with the slowest at 12.8 s. Seven of them took over 2 s each.
With
XCL_PSO_WAIT_MS=50(also on the older base), presents still stopped at about 50 s. Each pending pipeline still costs one budget on its first bind, and there are many at once: 7,612 dispatches in the 2 s before the stop.Not tested: this PR on its own, AMD, a fully warm driver-blob cache (in progress), and the regression-run pair.
AI use: Claude Code (Claude Opus 5.5) built and ran this, symbolized the dumps and wrote the report. Posted with my approval.
@427001 on GitHub · 2026-11-25 13:32 UTC · original
Closing this: the reports above and what
mainhas merged since show it should not go in.main(5f4d32f, #2176): leaving out dispatches of pipelines still being built also leaves out passes whose results later work reads, and that hangs the GPU. This change madeXCL_PSO_WAIT_MSleave them out sooner.mainwithout skipping anything:9cdae10(#1288) stops the title'sSleepfrom counting the time a bind waits.It also conflicts with
maininpso_async.rsnow, and I see no reason to carry it forward. Thanks to everyone who ran it: the thread dumps and the paired runs are what settled it.AI use: Claude Code with Claude Fable 5.2 read the reports and the commits named above and wrote this comment.
Pull request closed