Repository navigation
D3D12.X: bound compute pipeline waits so slow compiles do not trip wa… - #533
XaviFortes wants to merge 1 commit into
Conversation
|
thanks sm antigravity this is exactly what we were stuck on over here! |
|
Tested after the rebase GitHub's integration revision
Not tested GPU output from a dispatch recorded during a forced timeout, and the retail watchdog. AI use Codex with GPT-6.2 Sol ran the tests and drafted the update. Results on earlier revisionsThe two bounded-wait tests passed on Windows 11 build 26300, Rust 1.99.1 MSVC, debug, at f849ecc. The tests verify that the real pipeline becomes available after a timeout. There’s also a command-recording case worth checking. While resolution still returns the stand-in, direct Could a synthetic GPU test read back a value written by a dispatch recorded during the timeout, then consumed by a dependent command? My verification covers the source and unit tests. The GPU dispatch path and retail behavior remain untested here. I also extended the existing fake command-list test locally at this commit. A channel held the compute build pending across a 25 ms timeout. The recording calls added zero native direct dispatches, one skipped direct dispatch, and one native indirect call. Releasing the build gate made the real pipeline available, with the native direct-dispatch count still unchanged. The extended test passed (1 passed, 0 failed, 0 ignored) with AI use Codex with GPT-6.2 Sol extended the scratch fixture, ran the unit tests, traced the dispatch paths, and drafted this report. Follow-up on 359851f The updated fake command-list test passed on Windows. It observed the new skip for an indirect dispatch whose compute pipeline was still pending. The three built-in wait tests also passed. Tested revision In a scratch test, two caller threads entered the resolver together while a channel held the same compute build pending. With a 200 ms budget, the counter recorded 400 ms of combined waits. Both callers can read the full remaining balance before either charges its wait. If the budget is meant to cap combined wait time across render threads, could callers reserve their allowance before waiting, then return any unused portion? If it is meant to cap wall-clock stall, the combined counter can include overlapping time. Windows 11 build 26300, Rust 1.99.1 MSVC, debug. Codex with GPT-6.2 Sol wrote the scratch probe, ran the tests, and drafted this update. GPU follow-up on 359851f The stock In a scratch copy I changed the readback fixture to require a pending compute stand-in and call the new This verifies the GPU result when compilation finishes within budget. Output from a command recorded during a forced timeout and retail watchdog behavior remain untested. Codex with GPT-6.2 Sol ran the tests and drafted this update. Follow-up to the 5e6aca8 update I checked the two-worker floor with The stock Codex with GPT-6.2 Sol wrote the scratch probe, ran the tests, and drafted this update. |
|
Direction makes sense — getting the build off the title's render thread and bounding the wait is the right shape for the watchdog. Three things to look at before this goes in. 1. if !super::real::is_translated_compute(pso) {
xlog_warn!("... Dispatch with a pipeline that has no translated console shader ...");
count(DISPATCHES_SKIPPED);
return;
}
if !gfx && !compute {
return pc(this, sig, max, args, args_off, count_buf, count_off);
}Before this PR that branch was rare, because 2. 3. A bounded wait does not help when the workers themselves are stuck. #156 is exactly this: all Two smaller ones:
Not tested: no smoke run. The GPU on this machine was at 100 % from an unrelated process for the whole session, so any frame timing from here would be meaningless. Everything above is from reading the diff and the two call sites; the |
|
I ran the dependent GPU readback suggested above on RTX 4080. At Tested
Not tested
AI use
Follow-up on the pending On the same Windows 11 25H2 (build 26200.9974) machine with an RTX 4080 and NVIDIA driver 621.01, I ran a test-only readback fixture on
The fixture passed 1/1 on each revision with On the clean |
|
Test report: Tested
So on this setup the bounded wait works as described (the four slow compute builds went to the background), but the "GPU Loc Sig" abort (#505 / #534) still came, at about the same point. Whatever starves it here isn't only first-bind compute waits. The frame rate falls to about 7 fps for a minute or more before the abort in both runs. Not tested: AI use: Claude Code, Claude Opus 5.5: merged and built the branch, ran it, and wrote this report from the logs (the runs were played by a person). |
|
Thanks everyone for the reviews and extra testing (@thehollowedone, @yyc160, @CryingLaughing, @sperm)! I pushed an updated commit (359851f) addressing the feedback: ExecuteIndirect pending compute stand-ins: now skipped cleanly (DISPATCHES_SKIPPED, matching Dispatch) instead of forwarding a timed-out stand-in to PC ExecuteIndirect, with the unit test in bind.rs extended to cover it. Also updated the PR description with the fresh 60 s smoke run and noted that non-compute stalls (e.g., graphics waits in #267) can still independently trigger +0x23cf683. |
|
Independent timing check of Tested: Not tested: actual driver compilation latency, retail loading or watchdog behavior, and the full workspace suite. These tests use synthetic timing. AI use: OpenAI Codex (GPT-6) ran the local tests and drafted this report. Follow-up on revised head On the same machine, Follow-up on revised head Same Windows/i5-8400 machine and Rust toolchain. |
f849ecc to
359851f
Compare
|
Test run of Setup: RTX 3080 10 GB, Ryzen (12 threads), 32 GB, Windows 11 26200, release build, What happens (3 runs, the last with this PR)
Question: is the intended direction to raise #567 (bounded Test report written with Claude Code (Claude Opus 5.5) from my own runs. |
|
Gonna fix the CI that fails, not a problem really just that the runner is 2-cores and cannot handle that much when bumping cores |
359851f to
5e6aca8
Compare
…hort With the compile thread count bounded by free memory (ivall#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (ivall#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers.
|
@XaviFortes we've been preparing a change in What #533 doesn't have, in one line: a bind that is waiting on a compute pipeline should jump to the front of the compute pool's queue. Why that matters, and why it comes from the other two:
So after #533 lands, the only piece from our side worth having:
Nothing else from our branch. Our graphics-first queue isn't needed, because your separate pools already keep graphics builds out of the compute queue. Would you like (1) in #533 directly? If not, we'll send it as a small PR on top of #533 once it lands, with its own tests and regression runs. For whoever resolves the merges: our branch and #533 conflict in four places in AI use: Claude Code (Claude Opus 5.5) read the three diffs, did the trial merge and wrote this comment. |
|
Fixed, if anybody elseThanks everyone for the reviews and extra testing (@thehollowedone, @yyc160, @CryingLaughing, @sperm, @qinrxx)! I've pushed an updated commit (5e6aca8) addressing the review feedback: Pending compute stand-ins in ExecuteIndirect (@thehollowedone, @yyc160): bind::execute_indirect now checks pso_async::is_pending_compute and skips cleanly (DISPATCHES_SKIPPED, matching bind::dispatch) instead of forwarding a timed-out stand-in to native PC ExecuteIndirect. Extended async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect to cover this path. All CI checks and the full local workspace suite (680 passed, 0 failed, 41 ignored) are green. |
…hort With the compile thread count bounded by free memory (ivall#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (ivall#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers.
|
@XaviFortes thanks, agreed. Once #533 is merged, we'll send the ordering as a small PR on top of it: inside the AI use: Claude Code (Claude Opus 5.5) drafted this reply. |
|
Tested on an RTX 5080: pass at the current head
Not tested
AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2) |
|
Test report on the retail title into the world, AMD RDNA2 on Windows: with this PR the bounded compute wait does fire, and the watchdog still ends the title at about the same time. At the stop, the title's threads are no longer waiting in Setup: AMD Radeon RX 6800 16 GB (RDNA2, native wave64), driver 32.0.21045.5002; Intel Core i5-10600KF ( Builds: Run:
Both runs hold 60 presents per 2 s up to about 190 s, then fall to 0–9 per 2 s while the world loads. Where the title's threads wait at the stop. From XCL's thread dump, symbolized against each run's own release build with
So on this machine the bounded compute wait works as described, and the stall moves to draws and indirect calls that still wait in Not tested
AI use: Claude Code (Claude Opus 5.5): ran the tests and wrote this report. Update: this PR together with #267, and a larger page file (same machine). #267
So on RDNA2 / Windows, bounding both waits and roughly doubling the pipelines built before the stop still leaves the heartbeat abort at about 300 s. Not tested (update): this PR and #267 at their current heads ( Update: merging this PR (
With #267 on top I also changed |
5e6aca8 to
a966993
Compare
|
Had to make new commit to solve conflicts done by merging other PRs probably. Solved now |
|
NVIDIA / wave32 data point (the "Not tested" axis): the bounded compute-pipeline waits work on an RTX 3080 Ti — the fallback path exercised 16 times in a loading-phase soak, with no watchdog trip or device removal. Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB, RTX 3080 Ti 12 GB (driver 621.01, wave32-only), PR head Suite at this head: 679 passed / 0 failed / 41 ignored, 2 internal Soak (266 s, into the cold-compile wave): the new path fired 16 times: Limit, honestly: the run ended at 266 s in the pre-existing #232 null write ( Not tested: Intel GPUs, gameplay past the #232 crash, other titles. AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the suite and the soak with scripted input and wrote this report from the logs; a human reviews it before posting. No code changes. |
…hort With the compile thread count bounded by free memory (xcl-dev#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (xcl-dev#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers. (cherry picked from commit 8b9313f)
…tchdog Integrates upstream PR ivall#533 alongside used-pipeline preloading and two-pass mesh dispatch: - Add a dedicated xcl-pso-compute-* worker pool and a shared per-frame XCL_COMPUTE_PSO_WAIT_MS budget (default 4000 ms, reset on PresentX) so bursts of cold gameplay compute shader compiles finish in the background instead of blocking the render thread for 30+ s and tripping stall watchdogs. - Skip pending compute stand-ins in ExecuteIndirect and resolve DispatchMesh pipelines without blocking on uncompiled graphics/mesh PSOs.
Compute pipeline first-bind and ExecuteIndirect resolution previously ran uncached DXC + driver builds inline via resolve_wait on the title's render thread with no timeout, tripping retail watchdog aborts when large compute shaders take 20+ s to compile. Move compute pipeline builds onto a dedicated xcl-pso-compute-* worker pool so graphics backlogs cannot starve compute builds, bound total compute wait time with a shared per-frame budget (XCL_COMPUTE_PSO_WAIT_MS, default 4000 ms, 0 = unbounded) reset at PresentX, recover sent on channel send failure, and skip pending compute stand-ins in ExecuteIndirect cleanly (matching Dispatch) until the background build finishes. Assisted-by: Antigravity (Gemini 4 Neon) # Conflicts: # crates/xcl/src/hle/d3d12x/bind.rs # Conflicts: # crates/xcl/src/hle/d3d12x/pso_async.rs
a966993 to
001e37d
Compare
|
Rebased onto current main (1ec4c98) at 001e37d and resolved the #690 conflict in pso_async.rs, folding in the two suggestions from overnight: @CowboyBingus: added p.note_use() in resolve_compute_within + bounded_compute_wait_records_the_pipeline_for_the_next_run so pipelines bound through the bounded wait are still recorded in used-pipelines.txt for #690 preloading. Updated the PR description with a fresh 60 s smoke run on 001e37d (1,374 frames, 60 60 60 presents/2 s, 14,942 MB peak commit, 0 crashes, 0 device removals). |
…hort With the compile thread count bounded by free memory (ivall#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (ivall#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers. (cherry picked from commit 8b9313f)
|
Thanks. Confirmed at On the graphics side, our traces support AI use: Claude Code (Claude Opus 5.5) read the diff and the thread dumps; I ran the tests. |
…hort With the compile thread count bounded by free memory (xcl-dev#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (xcl-dev#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers. (cherry picked from commit 8b9313f)
|
Test report: Builds (merged locally onto
Retail title, 300 s per run. Same machine, same warm caches, DXC 1.9.2609.5,
Two crashes that are probably not this PR:
I did not see the Tested
Not tested: AMD / Intel; more than one or two runs per build; whether skipped work shows up as wrong rendering (the title never left its loading screen in these runs); #533 with #267 or #891. Test runs, log and dump analysis and this comment by Claude Code (Claude Opus 5.5); I checked the logs it is based on. |
|
Closing as superseded by #891, which has already been merged into |
…hort With the compile thread count bounded by free memory (ivall#572), a machine with ~8 GB of commit free gets two compile threads, and the dedicated compute pool (ivall#533) took half of that: one worker. A single driver build of tens of seconds then held every other compute pipeline behind it, and the per-frame wait budget handed the title stand-ins for all of them. Measured: bounded_compute_wait_shares_per_frame_budget_across_pipelines failed with 8.3 GB of commit free (one compute worker) and passed with XCL_DXC_THREADS=8. The pool now has 2 to 4 workers. (cherry picked from commit 8b9313f)
|
On a 32-lane NVIDIA GPU, the skipped compute work this PR falls back to hung the GPU; with skipping off there was no GPU hang, only the title's watchdog. Three runs of the retail title (1.0.2.1) into world loading, same build, differing only in Setup: RTX 5070 Ti 16 GB (driver 32.0.16.2101), Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2609. Release build of
So on this machine the skip path trades the watchdog for a GPU hang: a skipped dispatch or ExecuteIndirect appears to leave GPU-side waits that depend on its results unsatisfied. With 0, the only remaining problem was how long the builds take. That suggests a default that does not skip (or skips only work no GPU wait depends on), with the build time itself addressed by building compute pipelines ahead (#889) and a warm driver cache. Note that Together with #889, one of this PR's tests fails: assert!(
worker_name.starts_with("xcl-pso-compute-") || worker_name.starts_with("xcl-pso-pre-"),
"compute pipelines must be built off the binding thread, got {worker_name:?}"
);Before that change, No game data, logs only. AI use: Claude Code (Claude Opus 5.5) merged the PRs, ran the builds and the three runs. |
crates/xcl/src/hle/d3d12x/bind.rs: usepso_async::resolve_for_indirectindispatchandexecute_indirect; skip pending compute stand-ins inexecute_indirect(DISPATCHES_SKIPPED) instead of forwarding to PCExecuteIndirect; extendasync_compute_pso_success_and_failure_in_dispatch_and_execute_indirectto verify pending compute stand-ins are skipped.crates/xcl/src/hle/d3d12x/present.rs: callpso_async::reset_frame_budget()at eachPresentXboundary.Tested
rustc 1.98.1, debug (tests) and release (smoke).cargo build --workspace && cargo test --workspace -- --test-threads=4: 680 passed, 0 failed, 41 ignored, 0SKIPPEDGPU tests.bounded_compute_wait_times_out_then_resolves_once_worker_finishes,bounded_compute_wait_returns_real_when_build_finishes_in_time,bounded_compute_wait_shares_per_frame_budget_across_pipelines(3 passed in 0.08 s), andasync_compute_pso_success_and_failure_in_dispatch_and_execute_indirect(1 passed in 0.04 s).359851f9ee117e8241dbf0505ccacb17077d56fccompletes with 1,304 frames (60 60 60presents/2 s), 14,817 MB peak commit, 0 crashes, and 0 device removals.Regression run
Not tested
AI use
xcl.log, wrote unit tests, and updated the PR description; all builds, tests, and smoke runs were executed locally on the hardware listed above.