Skip to content

D3D12.X: bound compute pipeline waits so slow compiles do not trip wa… - #533

Closed
XaviFortes wants to merge 1 commit into
xcl-dev:mainfrom
XaviFortes:pso-async-bounded-compute-wait
Closed

XaviFortes wants to merge 1 commit into
xcl-dev:mainfrom
XaviFortes:pso-async-bounded-compute-wait

Conversation

@XaviFortes

@XaviFortes XaviFortes commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor
  • crates/xcl/src/hle/d3d12x/bind.rs: use pso_async::resolve_for_indirect in dispatch and execute_indirect; skip pending compute stand-ins in execute_indirect (DISPATCHES_SKIPPED) instead of forwarding to PC ExecuteIndirect; extend async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect to verify pending compute stand-ins are skipped.
  • crates/xcl/src/hle/d3d12x/present.rs: call pso_async::reset_frame_budget() at each PresentX boundary.
    Tested
  • Hardware / OS / toolchain: AMD Radeon RX 7900 XT (20420 MiB VRAM), AMD64 Family 25 Model 33 Stepping 2 (Zen 3), Windows 11 (10.0.26200.0), DXC 1.8.2502.11, rustc 1.98.1, debug (tests) and release (smoke).
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 680 passed, 0 failed, 41 ignored, 0 SKIPPED GPU tests.
  • New / updated 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), and async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect (1 passed in 0.04 s).
  • Retail title smoke run: 60 s run on clean HEAD 359851f9ee117e8241dbf0505ccacb17077d56fc completes with 1,304 frames (60 60 60 presents/2 s), 14,817 MB peak commit, 0 crashes, and 0 device removals.

Regression run

xcl-smoke v1
commit: 4017f8ff8faaae6007fd83910d230a027dd85a33
gpu: AMD Radeon RX 7900 XT
seconds: 60
exit: 0x0
frames shown: 1195 (PresentX 1196)
presents per 2 s (last 3): 56 54 57
device removals: 0
crashes: 0
peak commit: 14950 MB
xcl-smoke v1
commit: 001e37d400c5591b59b3f23a4f7090301b1e6d20
gpu: AMD Radeon RX 7900 XT
seconds: 60
exit: 0x0
frames shown: 1374 (PresentX 1374)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14942 MB

Not tested

  • NVIDIA / Intel GPUs and wave32-only adapters.
  • Other retail titles (Minecraft Preview, Unicorn Overlord, Fortnite, XDefiant).
  • Long gameplay soak combined with D3D12.X: a slow graphics pipeline waits at most 4 s once per build (#232) #267.
    AI use
  • Antigravity with Gemini 4 Neon: diagnosed the crash dump from xcl.log, wrote unit tests, and updated the PR description; all builds, tests, and smoke runs were executed locally on the hardware listed above.

@nieahax

nieahax commented Nov 24, 2026

Copy link
Copy Markdown

thanks sm antigravity this is exactly what we were stuck on over here!

@thehollowedone

thehollowedone commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested after the rebase

GitHub's integration revision 09a58f3 combines PR head a966993 with main at dd2ae9a. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.

  • cargo build --offline --locked --workspace passed. cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 reported 693 passed, 0 failed, 41 ignored. Two of the reported passes returned early for lack of native wave64 (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware).
  • The stock mock dispatch test passed 1/1, including the pending indirect-dispatch skip. With the D3D12 debug layer enabled, cargo test --offline --locked -p xcl --test gpu_compute_e2e -- --nocapture --test-threads=1 passed 2/2 on the selected GPU with no runtime skips or debug-layer errors.

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 revisions

The two bounded-wait tests passed on Windows 11 build 26300, Rust 1.99.1 MSVC, debug, at f849ecc. cargo test --offline --locked -p xcl --lib bounded_compute_wait -- --nocapture reported 2 passed, 0 failed, 0 ignored.

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 Dispatch is counted as skipped. ExecuteIndirect takes the native forwarding branch, and the compute stand-in uses dummy bytecode. Later binds get the real pipeline, but that leaves earlier compute outputs unverified. Direct dispatch · Indirect dispatch · Stand-in

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 XCL_COMPUTE_PSO_WAIT_MS=25 cargo test --offline --locked -p xcl --lib async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect -- --nocapture (environment variable set in PowerShell). This checks command recording with a fake list. GPU readback remains open.

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. cargo test --offline --locked -p xcl --lib bounded_compute_wait -- --test-threads=1 --nocapture reported 4 passed including the scratch probe. The same command with the filter async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect reported 1 passed. Both runs had zero failures or ignored tests. This CPU-side check leaves GPU output and retail behavior open.

Codex with GPT-6.2 Sol wrote the scratch probe, ran the tests, and drafted this update.

GPU follow-up on 359851f

The stock gpu_compute_e2e integration tests passed 2/2 on the RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC, debug. I used XCL_ADAPTER=3080 Ti, XCL_REQUIRE_GPU=1, and a fresh DXIL cache. Tested revision

In a scratch copy I changed the readback fixture to require a pending compute stand-in and call the new resolve_compute path with the 4,000 ms budget. It returned the translated PSO from the cold build. The fixture dispatched it on the hardware and matched both expected output words at each of 768 positions (1,536 words total). The scratch run passed 1/1 with no reported skips. Both runs used cargo test --offline --locked -p xcl --test gpu_compute_e2e -- --test-threads=1 --nocapture, with the scratch run filtered to the readback test.

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 XCL_DXC_THREADS=2. In a scratch Windows test, the first compute job held one worker at a channel gate while a second job ran on a compute worker. The second job ran before releasing the first, so the two jobs did not serialize behind that gate. The probe passed 1/1. Author update · Tested revision

The stock gpu_compute_e2e tests also passed 2/2 on RTX 3080 Ti (621.35) with the D3D12 debug layer enabled and no reported skips. XCL logged live-object warnings at process exit. Windows 11 build 26300, Rust 1.99.1 MSVC, debug, serial tests. This exercises the worker scheduling and synthetic compute readback. Retail watchdog behavior remains untested here.

Codex with GPT-6.2 Sol wrote the scratch probe, ran the tests, and drafted this update.

@yyc160

yyc160 commented Nov 24, 2026

Copy link
Copy Markdown

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. execute_indirect sends the stand-in to the PC implementation. In bind.rs, dispatch handles an untranslated pipeline by skipping it:

if !super::real::is_translated_compute(pso) {
    xlog_warn!("... Dispatch with a pipeline that has no translated console shader ...");
    count(DISPATCHES_SKIPPED);
    return;
}

execute_indirect does not:

if !gfx && !compute {
    return pc(this, sig, max, args, args_off, count_buf, count_off);
}

Before this PR that branch was rare, because resolve_wait either returned the real pipeline or blocked. With a bounded wait, the stand-in becomes an everyday return value — so this call now reaches ID3D12GraphicsCommandList::ExecuteIndirect on the PC list with a PSO the PC driver has never seen. Does that need to skip like dispatch does, or is the command list a PC one whose PSO was already set? Worth confirming, because it is the one place where a timed-out pipeline is still passed onward.

2. sent never recovers if the send fails. if !p.sent.swap(true, AcqRel) { queue().send(...) } — if send returns Err (a SyncSender that is full or disconnected), sent stays true and the job is never queued again, so the pipeline never lands and every later bind takes the stand-in path. A failed send should clear sent and either retry with backoff or wake the waiters with the error.

3. A bounded wait does not help when the workers themselves are stuck. #156 is exactly this: all xcl-pso-* threads sit inside nvgpucomp64.dll on the heap lock. Timeout returns the thread to the title, which is the point, but the compute pipeline is now queued behind jobs that may never finish, so its dispatches are skipped indefinitely rather than for 4 seconds. If compute can end up behind a wall of large graphics programs, it may need a reserved worker or a separate pool — otherwise this turns "the title hangs" into "the title runs with a class of dispatches missing", which is harder to attribute when someone reports a wrong frame.

Two smaller ones:

  • compute_wait_timeout bounds one bind. A title that binds ten uncached compute pipelines in a row still spends up to 10 × 4000 ms in these waits. A shared per-frame budget would bound the total.
  • timed_out is checked after real, so a late-landing pipeline is picked up on the next bind — that ordering looks right to me, just noting it as the reason the permanent flag is acceptable.

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 execute_indirect question in particular should be settled by someone who can run the title on an idle card.

@CryingLaughing

CryingLaughing commented Nov 24, 2026 •

Copy link
Copy Markdown

I ran the dependent GPU readback suggested above on RTX 4080. At f849ecc738a4791cbdf8eca9c174824562e8586e, the direct and indirect calls recorded while the producer PSO was pending both left its output at the initial value. A dependent GPU shader read that value in both cases. New calls recorded after the PSO resolved wrote and consumed the expected producer value.

Tested

  • RTX 4080, NVIDIA driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, DXC 1.8.2502.11, debug. XCL_ADAPTER=4080, XCL_REQUIRE_GPU=1, all XCL_SAMPLE_* variables unset.
  • The local diagnostic adds only a #[cfg(test)] fixture. It calls the PR's bind, dispatch, and indirect hooks on a real D3D12 command list. A channel holds the producer's PSO pending until the queue has completed both pending submissions. The indirect call uses a dispatch-only signature and a real argument buffer. The producer and XOR consumer use synthetic HLSL and coherent UMA, separated by a UAV barrier. Each trial starts with the same initial word.
  • With XCL_COMPUTE_PSO_WAIT_MS=10, cargo test -p xcl --lib --locked -j 4 gpu_pending_compute_dispatch_output_is_not_recovered -- --show-output passed 1/1. The run logged the timeout and the skipped direct dispatch.
First dispatch recorded Producer word Dependent consumer word
Direct, while pending 0x11223344 0x11dd33bb
Indirect, while pending 0x11223344 0x11dd33bb
Direct, after resolution 0xa5c01234 0xa53f12cb
Indirect, after resolution 0xa5c01234 0xa53f12cb
  • On the clean PR head, cargo test -p xcl --test gpu_compute_e2e --locked -j 4 console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --show-output passed 1/1. cargo build --workspace --locked -j 4 passed, and cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output reported 679 passed, 0 failed, 41 ignored, including the two bounded-wait tests and both compute integration tests.
  • The workspace pass count includes opt-in game-data tests that returned early and four explicit SKIPPED tests: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (native wave64), plus test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state (D3D12 debug layer).

Not tested

  • Retail behavior, release builds, other adapters, or delays from DXC or driver work. The diagnostic controls the pending interval itself.

AI use

  • OpenAI Codex (GPT-6 family, exact variant unavailable) wrote the scratch fixture, ran the commands, and drafted this report.

Follow-up on the pending ExecuteIndirect guard

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 f849ecc738a4791cbdf8eca9c174824562e8586e and 5e6aca8305a3d555437046ecc310988fc32ddfbb. The native stand-in shader writes 0x5354414e to its own word. This distinguishes running the stand-in from skipping the pending dispatch even when both leave the producer's output unchanged.

Synthetic dispatch f849ecc marker 5e6aca8 marker
Native indirect, before marking the pipeline pending 0x5354414e 0x5354414e
Direct, pending 0x00000000 0x00000000
Indirect, pending 0x5354414e 0x00000000

The fixture passed 1/1 on each revision with XCL_COMPUTE_PSO_WAIT_MS=10 and cargo test -p xcl --lib --locked -j 4 gpu_pending_compute_indirect_standin_marker -- --show-output --test-threads=1. The dependent consumer read the initial producer word while pending on both revisions, and the resolved direct and indirect dispatches each wrote the expected producer and consumer words.

On the clean 5e6aca8 head, bounded_compute_wait_shares_per_frame_budget_across_pipelines passed 1/1, and cargo build --workspace --locked -j 4 passed. The workspace test run with --test-threads=4 was stopped after four recompiler GPU tests reported over 60 seconds. A fresh cargo test --workspace --locked -j 4 -- --test-threads=1 --show-output completed with 680 passed, 0 failed, 41 ignored, including the same four explicit capability skips listed above. The serial run establishes the test result. The cause of the parallel stall is unverified. OpenAI Codex prepared the synthetic follow-up fixture and ran the checks.

@sperm

sperm commented Nov 24, 2026

Copy link
Copy Markdown

Test report: f849ecc (this PR) merged onto main 508a0c7, retail GTA VI on AMD RX 9070 XT (RDNA4), but under Linux/Wine, which XCL doesn't support. Treat it as a data point, not a Windows regression run.

Tested

main 508a0c7 + #533
presents 2,841 2,235
fps (300-frame windows) 30 → 29.5 → 6.9 30 → 14.3 → 7.7 → 21.4 → 7.6
still building after 4000 ms – proceeding with stand-in – 4× (at 176.9, 180.9, 184.9, 189.5 s)
end 0xc0000005 write at +0x23cf683 at 229.8 s the same at 202.7 s
title crash context (main run) Game Running, 3m18s, frame 2455, 637 streaming requests not written this run

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: cargo test (the crate doesn't build natively on Linux), Windows, smoke.ps1, other XCL_COMPUTE_PSO_WAIT_MS values, #267 together with this.

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).

@XaviFortes

Copy link
Copy Markdown
Contributor Author

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.
Shared per-frame wait budget: XCL_COMPUTE_PSO_WAIT_MS is now shared across all uncached compute binds within a frame and reset on PresentX, so binding multiple new compute pipelines in one frame (like the 4 consecutive 4 s waits in the RADV log) queues all of them without multiplying wait time.
Dedicated compute worker pool (xcl-pso-compute-*): compute pipelines no longer sit behind graphics PSO backlogs/stalls (#156).
sent recovery: enqueue() clears sent if channel send ever fails instead of wedging future binds.

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.

@alpz1000

alpz1000 commented Nov 24, 2026 •

Copy link
Copy Markdown

Independent timing check of f849ecc738a4791cbdf8eca9c174824562e8586e on Intel Core i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, debug.

Tested: cargo test --locked -p xcl --lib bounded_compute_wait -- --test-threads=2 --nocapture passed both tests. Then I reran the same test executable with bounded_compute_wait --test-threads=2 in 30 fresh processes. All 30 passed both tests (60 test executions, no failures or skips). The tests cover returning the real pipeline when ready in time and timing out then resolving after the worker finishes.

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 359851f9ee117e8241dbf0505ccacb17077d56fc

On the same machine, cargo test --locked -p xcl --lib -- --test-threads=4 bounded_compute_wait async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect passed all four tests. I repeated the same filters with four threads in 30 fresh processes: 30/30 passed, 120 test executions, no test skips. This includes exhausting the wait budget across two slow pipelines, resetting it for the next frame in the test, and skipping ExecuteIndirect while its compute pipeline is still pending. This remains synthetic coverage; no driver compile or retail title was exercised. Codex ran and summarized the checks.

Follow-up on revised head 5e6aca8305a3d555437046ecc310988fc32ddfbb

Same Windows/i5-8400 machine and Rust toolchain. cargo test --locked -p xcl --lib -- --test-threads=2 --nocapture bounded_compute_wait async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect passed all four. The log recorded ExecuteIndirect with pending compute pipeline ... skipped from the exercised branch. Then I reran the same four tests with two test threads in 30 fresh processes: 30/30 passed, 120 test executions, no test skips. No retail title or real driver compile was tested. Codex ran and summarized the checks.

@XaviFortes
XaviFortes force-pushed the pso-async-bounded-compute-wait branch from f849ecc to 359851f Compare November 24, 2026 02:02
@grahamster2

Copy link
Copy Markdown
Collaborator

Test run of f849ecc merged onto main 508a0c7 + #451 + #435, on the retail title that trips #232. Result: bounding the wait alone does not get past the watchdog on NVIDIA. The compile backlog is longer than the title's ~28 s hang watchdog.

Setup: RTX 3080 10 GB, Ryzen (12 threads), 32 GB, Windows 11 26200, release build, XCL_NETWORK=0, A presses at 14–31 s, 240 s runs.

What happens (3 runs, the last with this PR)

  • Presents drop to 0 at ~78 s, when the world load starts. The process then dies at 105–107 s with the title's write to 0 at +0x23cf683. +0x2215c35 is on its stack, so this is the Retail title: null write at +0x2215c35 (#159) still hits on NVIDIA RTX 4070 Ti, with and without XCL_NETWORK=0 #232 watchdog. It is the same with and without this PR.
  • No Wait64BitValueX ... timed out lines in any run.
  • Thread dumps (function names from the PDB):
    • main without this PR, at 90/95 s: 4–5 title render-job threads in pso_async::resolve_wait ← resolve_for_bind ← bind::set_pipeline_state, each building a compute PSO itself: translate, then DXC (compile_cached_in → dxc::compile), then the driver (nvgpucomp64). On a cold cache a 381 KB CS took 11.5 s in the driver and a 309 KB one 8 s.
    • with this PR, at 100 s: the title threads cycle through resolve_compute (4 s bounded waits, one new pipeline after another). One thread is in execute_indirect → resolve_for_indirect → resolve_wait, so it is unbounded. The XboxBvhBuilder thread waits in set_pipeline_state → resolve_compute. 4 xcl-pso workers wait in translated_compute_pso for the BIG_COMPILES slot (most: 1), 2 are inside the driver compiler, and 3 DXC threads are busy.
  • The cache warms from run to run: 104 new DXC compiles in run 2, then 71 in run 3 (this PR). About 115 compute PSOs are built between 75 s and the crash. Each run still dies at the same point.

Question: is the intended direction to raise BIG_COMPILES (commit permitting; this machine had ~30 GB of commit headroom left) or to precompile compute pipelines ahead of time (xcl shaders --precompile --only cs --pipelines)? Bounded waits keep the threads moving, but the title still needs those results before it presents.

#567 (bounded wait_for_commit) does not apply to this stall: no worker was in wait_for_commit in these dumps; the slot holder was compiling in the driver.

Test report written with Claude Code (Claude Opus 5.5) from my own runs.

@XaviFortes

Copy link
Copy Markdown
Contributor Author

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

@XaviFortes
XaviFortes force-pushed the pso-async-bounded-compute-wait branch from 359851f to 5e6aca8 Compare November 24, 2026 02:14
JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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.
@qinrxx

qinrxx commented Nov 24, 2026

Copy link
Copy Markdown

@XaviFortes we've been preparing a change in pso_async.rs that overlaps this PR and #539, so here is how they layer, before any of them lands.

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:

  1. In the compute pool, builds a bind is waiting for go ahead of builds started early.
  2. Possibly skipping pipelines the game has already released, if D3D12.X / XG: async texture upload, detiling, VRAM, XG ABI, and PSO scheduling improvements #539 is split up without it.

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 pso_async.rs, and our branch drops the mpsc import that your pools use. But if (1) goes into #533 or on top of it, our branch isn't needed.

AI use: Claude Code (Claude Opus 5.5) read the three diffs, did the trial merge and wrote this comment.

@XaviFortes

Copy link
Copy Markdown
Contributor Author

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.
Shared per-frame wait budget (@yyc160, @sperm): XCL_COMPUTE_PSO_WAIT_MS (default 4000 ms, 0 = unbounded) is now a shared per-frame budget reset at each PresentX boundary, so binding multiple uncached compute pipelines in one frame (like the 4 back-to-back 4 s waits in the RADV run) queues all of them without multiplying wait time.
Dedicated compute worker pool (@yyc160): compute pipelines now run on their own xcl-pso-compute-* pool ((compile_threads / 2).clamp(2, 4) threads) so graphics PSO backlogs/stalls (#156) cannot starve compute builds indefinitely, and a single slow compute shader won't head-of-line block faster ones on low-core hosts.
sent recovery (@yyc160): enqueue() clears sent if channel send fails instead of leaving future binds wedged.
Scope note (@sperm, @CryingLaughing): updated the PR description with the fresh 60 s smoke run on 5e6aca8 and noted that non-compute stalls (e.g., unbounded graphics waits covered by #267) can still independently trigger +0x23cf683 ("GPU Loc Sig").
Compute queue priority (@qinrxx): makes total sense, especially once #539's eager compute builds layer on top! Since #533 is already ~357 lines and CI is green, let's keep #533 focused and land your jump-to-front priority ordering as a small follow-up PR on top of #533 once it merges.

All CI checks and the full local workspace suite (680 passed, 0 failed, 41 ignored) are green.

JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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.
@qinrxx

qinrxx commented Nov 24, 2026

Copy link
Copy Markdown

@XaviFortes thanks, agreed. Once #533 is merged, we'll send the ordering as a small PR on top of it: inside the xcl-pso-compute pool, a build that a bind is waiting for is taken before builds started early. It will come with its own test (a waited-for build finishing before speculative builds queued ahead of it) and its own main / head regression pair. Our earlier branch won't be opened.

AI use: Claude Code (Claude Opus 5.5) drafted this reply.

@H0UNDZER0

Copy link
Copy Markdown

Tested on an RTX 5080: pass at the current head 5e6aca8, release and debug, 680 passed, 0 failed. The RTX 4080 and RTX 3080 results above are of the earlier head f849ecc; this one covers the current head. f849ecc also passed here before the update (679 / 0 / 41, release twice and debug).

  • Commit 5e6aca8305a3d555437046ecc310988fc32ddfbb, this PR's head as is (on its base 7ebf1b8).
  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; Ryzen 7 9700X (8 cores, 16 threads); Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); D3D12 debug layer installed. No XCL_* variables set.
  • cargo build --release --workspace --locked and cargo build --workspace --locked: OK, the same single fetch_update warning as main.
  • cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with --show-output), and the same in debug: 680 passed, 0 failed, 41 ignored all three times. The base 7ebf1b8 gives 677 / 0 / 41 here (release): the difference is the 3 bounded_compute_wait_* tests.
  • SKIPPED: only the usual 2, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64). The two debug-layer tests run and pass.
  • hle::d3d12x::pso_async::tests alone, 3 runs (release): 3 passed each time. async_compute_pso_success_and_failure_in_dispatch_and_execute_indirect passes, with its new pending-ExecuteIndirect step.
  • The new limit: every still building after … ms – proceeding with stand-in and ExecuteIndirect with pending compute pipeline … skipped line in these runs comes from the tests' own synthetic pipelines. No pipeline the suite builds for real on this GPU reached the 4 s budget, in release or in debug.

Not tested

  • A real compile slower than the budget, and retail titles (the RTX 3080 run above covers one, on f849ecc); scripts/smoke.ps1.
  • This PR merged onto a newer main. At the time of the run that was 9ce2070; git merge-tree showed no conflict.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

@vibryxcx

vibryxcx commented Nov 24, 2026 •

Copy link
Copy Markdown

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 set_pipeline_state but in draws and indirect calls (draw_instanced / execute_indirect → resolve_wait).

Setup: AMD Radeon RX 6800 16 GB (RDNA2, native wave64), driver 32.0.21045.5002; Intel Core i5-10600KF (clwb / monitorx emulated); 32 GB RAM, commit limit 45.4 GB (system-managed page file, peak use 407 MB); Windows 11 build 26200; Rust 1.100.0 MSVC; release builds. cargo clean --release -p xcl before each build.

Builds: main 3db536e (has #435), and this PR's head 5e6aca8 merged onto it (local merge commit f45bb77, no conflicts). Default XCL_COMPUTE_PSO_WAIT_MS.

Run: XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_RUN_SECONDS=600, XCL_PRESS_A_AT=14,17,21,125,131,…,197 (A at 14/17/21 s, then every 6 s from 125 to 197 s). main first, then the PR, back to back.

main 3db536e 3db536e + this PR
ends with +0x23cf683 (write at 0x0), rbx=0x0, at 301.9 s the same, at 306.1 s
frames shown 4,781 5,221
last submit 274.7 s 286.5 s
background_pipelines at the stop [47, 0, 58715] [62, 0, 58702]
still building after … ms – proceeding with stand-in lines – 2
ExecuteIndirect with pending compute pipeline … skipped lines – 4
commit at 301 s 27.7 GB 27.6 GB

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 llvm-symbolizer (the main binary rebuilt from 3db536e with the same toolchain):

  • main: four title threads at the same frames, Condvar::wait ← pso_async::resolve_wait ← pso_async::resolve_for_bind ← bind::set_pipeline_state (title +0x248c734).
  • With this PR, none is in set_pipeline_state. Instead:
    • Condvar::wait ← pso_async::resolve_wait ← bind::graphics_bound ← bind::draw_instanced (title +0xbff06): one thread;
    • Condvar::wait ← pso_async::resolve_wait ← pso_async::resolve_for_indirect ← bind::execute_indirect (title +0x248d690, +0x248d4ef): three threads;
    • sleep ← list_x::wait64_x ← list_x::execute_with_waits ← real::q_execute_command_lists (title +0x24821e3): one thread.

So on this machine the bounded compute wait works as described, and the stall moves to draws and indirect calls that still wait in resolve_wait. The draw_instanced one is a graphics pipeline with no limit, which #267 bounds; I have not run the two together.

Not tested

  • This PR together with D3D12.X: a slow graphics pipeline waits at most 4 s once per build (#232) #267, or with XCL_COMPUTE_PSO_WAIT_MS other than the default.
  • Whether the three execute_indirect waits are for graphics or compute pipelines: the symbolized frames do not say, and resolve_for_indirect is the path this PR changes.
  • One run of each, so I do not count the 4 s difference in the stop time as a change.
  • The unit tests and scripts/smoke.ps1 on this machine.

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 043d1f7 merged onto the local merge of this PR (f45bb77 above); the conflict in bind::execute_indirect resolved to keep both sides (this PR's pending-compute skip, then #267's root-signature bind for a stand-in), and resolve_for_indirect's graphics arm changed from resolve_wait to #267's resolve_for_draw. Local commit 2323f14, not pushed. cargo test -p xcl --lib pso_async: 5 passed, 0 failed. Same run command as above, 600 s limit, one run each.

build page file / commit limit XCL_PSO_WAIT_MS ends with +0x23cf683 at background_pipelines standin_draws
3db536e + this PR + #267 system-managed, 45.4 GB 4 s (default) 299.2 s [86, 0, 58678] 14
3db536e + this PR + #267 system-managed, 45.4 GB 150 ms 294.2 s [119, 0, 58646] 190
3db536e + this PR + #267 32–64 GB, 63.9 GB 150 ms 303.2 s [206, 0, 58558] 134
main 3db536e 32–64 GB, 63.9 GB – 302.0 s [46, 0, 58715] –
  • With both PRs, no title thread is left in an unbounded pipeline wait at the stop: the thread dump has one or two in Condvar::wait_timeout ← pso_async::resolve_for_draw (from bind::draw_instanced / bind::execute_indirect), as D3D12.X: a slow graphics pipeline waits at most 4 s once per build (#232) #267 intends. main with the larger page file still has four in resolve_wait ← resolve_for_bind ← bind::set_pipeline_state.
  • On the 45.4 GB limit, 10 of the 11 xcl-dxc workers were in dxc::wait_for_memory at the stop (as @S1m0ne1997 describes in Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505). With the 63.9 GB limit, 3 of 11 were; 5 were in dxcompiler.dll and 4 xcl-pso workers in amdxc64.dll.
  • In every run with this PR: the bounded compute wait expires (still building after ~3.6–4.0 s), the dispatch / ExecuteIndirect skips follow in the same millisecond, and 2–8 s later Wait64BitValueX timed out after 2000 ms at 0x70417fe… (op 7 …; memory holds Some(0)) three times. @xstraok's run k2 has these timeouts with no skip at all, so I read this as the same loading point, not as caused by the skips.

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 (a966993 for this PR); a warm or precompiled DXIL cache; XCL_COMPUTE_PSO_WAIT_MS other than the default.


Update: merging this PR (a966993) onto current main (f4ce27c, which has #690). It conflicts in pso_async.rs (Pending fields and submit_as). Two things a rebase needs beyond the conflict markers:

With #267 on top I also changed resolve_for_indirect's graphics arm from resolve_wait to #267's resolve_for_draw (the case @claudetools-gh describes above), and gave resolve_within the same note_use(). The tests that call submit_lazy need #690's new key argument (0). cargo test -p xcl --lib pso_async: 7 passed; bind::: 6 passed. Local only (f0e46a4); the runs on that tree are in #505.

@XaviFortes
XaviFortes force-pushed the pso-async-bounded-compute-wait branch from 5e6aca8 to a966993 Compare November 24, 2026 02:51
@XaviFortes

Copy link
Copy Markdown
Contributor Author

Had to make new commit to solve conflicts done by merging other PRs probably. Solved now

@MonkeyPython

Copy link
Copy Markdown

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 f849ecc, release build, XCL_NETWORK=0 + firewall, GTA VI Series 1.0.2.1, 3840×2160. Scripted menu walk (XCL_PRESS_AT) into loading.

Suite at this head: 679 passed / 0 failed / 41 ignored, 2 internal SKIPPED (the wave64 pair on this wave32 adapter) — includes the pso_async bounded-wait unit tests.

Soak (266 s, into the cold-compile wave): the new path fired 16 times: D3D12.X: compute pipeline 0x… still building after 4000 ms – proceeding with stand-in (continues in background). Each time the draw continued with the stand-in and compilation kept going in the background; no device removal, no watchdog-style hang attributable to the waits. fps over the last 300: 15.6 @1200 presents, 16.6 @1500. BCPack refusals reached 2048 and 40 mesh AS-slot refusals as loading progressed (the usual shapes for this title).

Limit, honestly: the run ended at 266 s in the pre-existing #232 null write (game_scarlett_master.exe+0x23cf683, same signature as on plain main) — so a soak past the 578 s point was not reachable on this title/host: #232 kills it at ~266–298 s regardless of this PR. The bounded-wait behavior above was observed during the cold-compile wave before that crash; the PR neither causes nor prevents the 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.

JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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)
gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…tchdog

Integrates upstream PR xcl-dev#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
@XaviFortes
XaviFortes force-pushed the pso-async-bounded-compute-wait branch from a966993 to 001e37d Compare November 24, 2026 07:54
@XaviFortes

Copy link
Copy Markdown
Contributor Author

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.
@gccody & @WarmMilkCodes: added resolve_bounded and wired both resolve_for_indirect and bind::graphics_bound to share the per-frame budget + bounded_wait_covers_graphics_pipelines_too, so graphics pipeline builds no longer stall past the GPU Loc Sig watchdog either.
@xstraok: thanks for the thorough RADV bisect and confirming the Wait64BitValueX timeouts weren't caused by the skips.

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).

JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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)
@CowboyBingus

Copy link
Copy Markdown

Thanks. Confirmed at 001e37d: p.note_use() is in resolve_compute_within, and bounded_compute_wait_records_the_pipeline_for_the_next_run is there.

On the graphics side, our traces support resolve_bounded. RTX 5070 Ti, retail world load, #533 at a966993 + #267, before this change. In every thread dump during the stall, the title thread was in bind::execute_indirect → pso_async::resolve_for_indirect → resolve_for_draw → resolve_within → Condvar::wait_timeout. That was 10 waits of 2.1-2.4 s each back to back, 23.7 s in all. Presents stopped and the watchdog followed. With both caps at 50 / 100 ms (XCL_PSO_WAIT_MS / XCL_COMPUTE_PSO_WAIT_MS), the title got the odd frame out and the watchdog moved from ~104 s to ~159 s, so the waits are one part of that stall but not all of it. I'll run 001e37d on the same setup and post what changes.

AI use: Claude Code (Claude Opus 5.5) read the diff and the thread dumps; I ran the tests.

JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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)
@bstillbstill

Copy link
Copy Markdown

Test report: 001e37d on NVIDIA RTX 3090 Ti (Windows) with the retail title of #505. The bounded waits work and move the "GPU Loc Sig" abort ~12 s later. The next block is a sparse readback in Map that holds the sparse lock while it waits for the GPU.

Builds (merged locally onto main 09940bb):

Build Commit Contents
baseline 6c13c10 main + #899 (bind-wait logging only)
this PR 16ebe79 main + 001e37d, clean merge
this PR + #433 4dc8428 main + 001e37d + #433 19004e1; one conflict in sparse.rs, doc comments only (#433's text for readback_after_execute next to main's new queue()), both kept as they were

Retail title, 300 s per run. Same machine, same warm caches, DXC 1.9.2609.5, scripts/smoke.ps1 (with the crashed-run fix from a local branch, so a crashing run still gets a block). Scripted input XCL_PRESS_A_AT=15,21,…,585 (every 6 s), XCL_THREAD_DUMP_AT for thread dumps, XCL frames resolved against each build's PDB.

Build End Skipped (draws / dispatches) Sparse readback timeouts Peak commit
baseline abort at +0x23cf683, 95.7 s 0 / 0 0 34,288 MB
this PR, run 1 crash at 32.2 s in tiling::Chain::detile_level (see below) 0 / 0 0 18,542 MB
this PR, run 2 abort, write to 0 at +0x2215c35, 107.8 s 1,320 / 5,310 4 (88–103 s) 36,401 MB
this PR + #433, run 2 abort at +0x23cf683, 118.8 s 1,786 / 8,952 5 (93–113 s) 32,097 MB
  • Baseline: D3D12.X: log how long a bind waits for a pipeline still being built #899's log has 11 graphics waits of 1.0–2.6 s back to back on one title thread from 72 s to 95.5 s, each "waited for a worker". The dumps at 75 s and 90 s show that thread in bind::execute_indirect (bind.rs:238) → pso_async::resolve_wait. Only 1 of 31 xcl-pso-* workers was in the driver: the title binds one new graphics pipeline after another and waits for each.
  • This PR, run 2: those waits are gone. The title thread that stalls is now in real::res_map → sparse::readback_now → State::readback_ranges → State::wait_for (sparse.rs:776). Its fence stays 2 short (has not reached fence value 38430 after 5 s (at 38428)), 4 times in a row, until the abort.
  • This PR + D3D12.X: sparse readbacks don't wait for a queue held by a later signal #433, run 2: the same, 5 times (39956 … (at 39951)). The dumps at 90 s and 105 s also show the title's submitting thread in q_execute_command_lists → sparse::before_execute / sparse::queue() → Mutex::lock_contended. readback_now takes STATE and keeps it through readback_ranges and both of its wait_for calls. So while Map waits for the GPU, the title cannot submit, and the work the fence is waiting for may be in that submit. D3D12.X: sparse readbacks don't wait for a queue held by a later signal #433 covers the copy back after ExecuteCommandLists, not this Map path.

Two crashes that are probably not this PR:

I did not see the 0xffffffffffffffff read others reported with skipped dispatches.

Tested

  • NVIDIA GeForce RTX 3090 Ti (driver 32.0.16.2101, 32-lane waves), Intel i9-13900K, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0 MSVC.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4 (debug):
  • Title runs: release builds, one run per row above (two of this PR).

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.

@raylitebull

Copy link
Copy Markdown
Member

Closing as superseded by #891, which has already been merged into main.

JustDownTV added a commit to JustDownTV/xcl that referenced this pull request Nov 24, 2026
…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)
@T0ns1

T0ns1 commented Nov 24, 2026

Copy link
Copy Markdown

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 XCL_COMPUTE_PSO_WAIT_MS.

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 main 077ce40 + #905 + #889 + this PR (cherry-picked; the one conflict, in submit_as, resolved by keeping enqueue(&p) and #889's || compute), plus two local list-slot changes unrelated to pipelines. XCL_NETWORK=0 XCL_ACTIVITY=1, menus walked with XCL_PRESS_A_AT. About 225 compute pipelines were in the driver cache from a partial xcl shaders --precompile --pipelines.

XCL_COMPUTE_PSO_WAIT_MS skipped dispatches / ExecuteIndirect still building after would close a GPU cycle queue.Wait … did not complete within 5000 ms end
4000 (default) yes, from ~100 s 16 2 4 (~141 s) TDR (below)
20000 yes, from ~94 s 3 (one after 11 441 ms) 2 11 (from ~106 s) stopped by hand at ~112 s, before a TDR
0 0 0 0 0 the title's watchdog, +0x23cf683 at 112.6 s
  • 4000: once the first stand-ins were used, the title went on submitting (thousands of dispatches per 2 s until ~138 s) – it got past the stop that main hits. Then GPU waits stopped completing; Wait64BitValueX timed out twice and queue.Wait … did not complete within 5000 ms 4 times. The NVIDIA driver logged six TDRs (System log, nvlddmkm event 153, the screen went black for a moment). The run ended with a command list's Close → 0x8007000e and then 0x80000003 in the title at +0x72ac (rax = 0x8007000e), presumably the device lost after the TDRs (not confirmed).
  • 20000: the per-frame budget still runs out: single compute pipelines took 11 s and more to build, and once a frame's budget is spent its later binds are skipped too. Same pattern of unsatisfied GPU waits ~12 s after the first skip.
  • 0: nothing skipped, no GPU wait timeout, no TDR. The title submitted until ~84 s (6 097 dispatches in that interval), then waited on pipelines with almost no submits, and its watchdog fired ~28 s later – the stop described in Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505.

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 main now has XCL_PSO_WAIT_MS (5fab112, 8cada26), unset meaning "wait until built", which overlaps with this PR's budget; this PR no longer applies cleanly on main.

Together with #889, one of this PR's tests fails: bounded_compute_wait_returns_real_when_build_finishes_in_time requires the build to run on an xcl-pso-compute-* thread, but #889 queues every compute pipeline for the preload workers when it is made, and an xcl-pso-pre-* thread can take the job first (got "xcl-pso-pre-1"). Accepting both prefixes keeps what the test guards (the binding thread does not build):

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, cargo test --release --workspace --no-fail-fast -- --test-threads=4 on this build gave 725 passed, 5 failed, 41 ignored: this test, plus 4 GPU tests (title_textures / vram / readback_routing) that pass with --test-threads=1. With it, cargo test --release -p xcl --lib -- pso_async: 8 passed, 0 failed, in four runs. On the same changes rebased onto main 47efa2e (XCL_PSO_WAIT_MS conflict resolved by keeping both), the full suite: 749 passed, 0 failed, 41 ignored.

No game data, logs only. AI use: Claude Code (Claude Opus 5.5) merged the PRs, ran the builds and the three runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.