Skip to content

D3D12.X: with bounded pipeline waits, dispatches are not put off to the submit - #2581

Open
brothernog wants to merge 1 commit into
xcl-dev:mainfrom
brothernog:bounded-wait-no-putoff
Open

brothernog wants to merge 1 commit into
xcl-dev:mainfrom
brothernog:bounded-wait-no-putoff

Conversation

@brothernog

@brothernog brothernog commented Nov 26, 2026 •

Copy link
Copy Markdown

With XCL_PSO_WAIT_MS set, a dispatch whose pipeline is still being built is recorded at once instead of being put off to the submit (#2118). On an RTX 3050 with XCL_PSO_WAIT_MS=1, main lost the device in 2 of 2 runs right after the retail title's world start; with this change the title presented to the end of every 240 s run (4 runs, 0 device removals). The runs that led here and what they show about the stop after the world start are in a comment on #2088: #2088 (comment)

What changes

  • list_x::defer returns false when pso_async::waits_bounded(), so Dispatch and a dispatching ExecuteIndirect with an unbuilt pipeline take the path they took before D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118: the bind waits at most XCL_PSO_WAIT_MS, then the call is skipped as a stand-in's.
  • Why: the submit's wait for a put-off call is bounded by the same XCL_PSO_WAIT_MS, so with a bound the put-off only moves the wait, and it costs a segment (a PC command list) per call. With XCL_PSO_WAIT_MS=1 the title's world start put off thousands of calls (the log's counter passed 8,192 in one run; up to 1,024 extra segments per list), the lists' Close returned E_OUTOFMEMORY (then E_FAIL), and the device was removed (0x887a0001, "invalid call").
  • The cost: with a large budget the title's thread waits again, which D3D12.X: a dispatch waits for its pipeline at the submit, not in the bind #2118 moved off it. Measured only with XCL_PSO_WAIT_MS=1.
  • Unset (the default): nothing changes. A default run put off over 1,024 calls with no Close failure.

Files

  • hle/d3d12x/pso_async.rs: waits_bounded().
  • hle/d3d12x/list_x.rs: the check at the top of defer.

Tested

  • RTX 3050 8 GB (desktop, Ryzen 7 5800XT, 32 GB), NVIDIA 610.88, Windows 11 build 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17.
  • On main 08db802 + this PR (d5d694b):
    • cargo test --release -p xcl --lib -- --test-threads=4: 1304 passed, 0 failed, 27 ignored.
    • cargo clippy --release -p xcl --all-targets: 838 warnings on 08db802 and on this branch.
  • In the title (A pressed at 25 s, 240 s per run, XCL_NETWORK=0 XCL_PAGE_BUDGET_MB=4096; XCL and NVIDIA caches warm from earlier runs):
tree XCL_PSO_WAIT_MS runs last present device removals
main e1d84b7 unset 1 136 s (0 presents after) 0
main e1d84b7 1 2 132 / 138 s 2 (0x887a0001, after Close → E_OUTOFMEMORY)
this change on e1d84b7 (0a3d310, with a second change switched off by XCL_SKIPPED_COMPUTE_GUARD=0) 1 2 238 / 238 s (end of run) 0
this change on e1d84b7 (0a3d310), unset, after all the runs above unset 1 112 s (0 presents after) 0
this PR (d5d694b) 1 2 238 / 236 s (end of run) 0 (no put-offs, no Close failure)

The default control was repeated last because driver blobs kept piling up over the runs: the title still stops with warm caches. Past that point, with XCL_PSO_WAIT_MS=1, the title records 1,000–10,000 dispatches per 2 s but presents only about every 2 s; that slow phase is not explained here.

Regression run
Default settings (XCL_PSO_WAIT_MS unset, where this PR changes nothing), back to back, main first, one run each; frame counts vary from run to run:

main 08db802:

xcl-smoke v1
commit: 08db8020d323bf478964fcc586152cce54959cfc
gpu: NVIDIA GeForce RTX 3050
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1544 (PresentX 1545)

This PR (d5d694b):

xcl-smoke v1
commit: d5d694b04b3e26abdef656af21c03d30a5027d9b
gpu: NVIDIA GeForce RTX 3050
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1559 (PresentX 1559)

Overlap

Not tested

  • XCL_PSO_WAIT_MS values other than 1; what the title draws with skipped dispatches; runs longer than 240 s.
  • AMD, Intel; Linux/Proton; cold caches.

AI use

  • Claude Code (Claude Opus 5.5): the runs, the change, the tests and this description. I checked the diff and the runs.

AI-assisted.

…he submit

With XCL_PSO_WAIT_MS set, a dispatch whose pipeline is still being built
is recorded at once instead of being put off to the submit (xcl-dev#2118): its
bind waits at most XCL_PSO_WAIT_MS on the title's thread, as before. The
submit's wait has the same bound, so the put-off only moved it. With
XCL_PSO_WAIT_MS=1 a retail title's world start put off thousands of
calls, a segment each; its command lists ran out of memory (Close:
E_OUTOFMEMORY) and the device was removed (0x887a0001). Unset (the
default), nothing changes.
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

raylitebull added a commit that referenced this pull request Nov 26, 2026
…ts, and keep split whole builds async

Eliminate the remaining multi-second stalls observed past the 12 s per-frame pipeline wait window on cold/warm world frames:
- Track in-flight wall-clock waits (`active_waiters` / `active_since`) in `pso_async::FrameWaitBudget` so staggered concurrent title threads share one hard wall-clock ceiling per kind per frame instead of each getting a fresh 12 s window (applied to both `FRAME_BUDGET_GFX`/`FRAME_BUDGET_CS` and `FRAME_WAIT`).
- Skip deferring pending compute dispatches to submit in `list_x::defer` when `XCL_PSO_WAIT_MS` is set (#2581), when the current frame's compute wait window is already spent, or once 16 deferred segments have already been allocated on the current frame (prevents 512+ deferred segments and command-allocator/RAM churn).
- Never compile `Chain::whole()` synchronously on a title/submit thread inside `dispatch_chain::dispatch` when scratch allocation fails under memory pressure or missing backing allocator: kick off `start_whole_async()` and return an error so the dispatch is skipped cleanly until the background whole build finishes, matching `whole_nonblocking`.

Assisted-by: Antigravity (Gemini 4 Neon High)
@itsSio

itsSio commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent dual-PC NVIDIA full-workspace test report on clean head d5d694b04b3e26abdef656af21c03d30a5027d9b.

Tested

  • Machine 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1429 passed, 0 failed, 47 ignored (all 14 existing pso_async/defer tests pass)
    • SKIPPED: 26 (wave64-only GPU tests, #1426 wave32 f16/cvt refusals, heap_window_out_of_memory_falls_back_to_the_switch_form, pso_measurement_compiles_an_exact_synthetic_record)
  • Machine 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)
    • cargo build --workspace: exit 0
    • cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1429 passed, 0 failed, 47 ignored (all 14 existing pso_async/defer tests pass)
    • SKIPPED: 29 (same 26 as Machine 1 plus 3 requiring d3d12SDKLayers.dll)

Not tested

  • Retail title / scripts/smoke.ps1 runs (including bounded-wait behavior under XCL_PSO_WAIT_MS)
  • Release builds (--release)
  • AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Claude Opus 5.5 (High)): built the branch and ran the workspace test suite on both NVIDIA machines.
  • Google Antigravity CLI (Gemini 4 Neon (High)): coordinated the runs and wrote this test report.

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.

3 participants