Repository navigation
D3D12.X: with XCL_PSO_WAIT_MS set, a put-off dispatch waits for its pipeline at the submit instead of being dropped - #2547
grahamster2 wants to merge 2 commits into
Conversation
With XCL_PSO_WAIT_MS set, a Dispatch or dispatching ExecuteIndirect put off to the submit (xcl-dev#2118) was recorded through resolve_wait, with the same budget a bind has as the title records. A pipeline a bind had already found late got the stand-in at once, one still building got it after the budget, and the dispatch was counted as skipped and left out. Its segment lies between the list's other work, so the list's Write64 labels, EOP writes and fence signals still fired: the title saw the work as done while its UAV outputs, counters and indirect argument buffers were never written. record_deferred now waits for the segment's compute pipeline (pso_async::wait_for_submit) before it records the call, whether a bind found it late or not. Without the budget this is the wait the submit already made. With it, the submit leaves the build to the workers for the budget first, as a bind does, so big compiles keep their turns on the workers; one no worker has started by then is built on the submitting thread, so a submit never waits for a free worker. One a worker builds is waited for at most 30 s (SUBMIT_WAIT_MOST, the time a retail title's watchdog lets its main thread stand still, xcl-dev#891): title_held stops kernelx::Sleep and the GPU-wait watchdog, not every clock a title reads. Past that the call goes on with the stand-in as before, with a WARN ("deferred dispatch skipped after waiting 30 s for its pipeline") and a count of its own. A worker's build that panics now ends as a failed build (catch_unwind around the job), so whoever waits for it goes on instead of waiting for a done flag nobody sets. Tests: a put-off dispatch of a translated console program whose build ends 400 ms into the submit, with a 50 ms budget and the pipeline already late, has its store and the Write64 after it in the list reach memory (without the change the label is written and the store is not); a submit's wait for a late pipeline no worker can start builds it itself; a submit waits for a worker's build no longer than its bound and counts it; a panicking build ends as failed.
|
Update for head AMD run on RDNA4, a GPU with native 64-lane waves (listed as untested), plus an RTX 3060: the new tests pass on both cards, with no skips. Head
The put-off dispatch test passed its Which wave width the runtime picked for the test's 64-thread program on the RX 9070 XT is not checked by the test or by this run. Not tested: |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) verification of exact PR head Tested
(Compare against Not tested
AI use
|
|
Rerun on the new head
First run, on Tested:
So the runtime change looks fine: without the new test, the PR's Not tested: a world run with AI use: Claude Code (Claude Opus 5.5) ran the suite, the repeats and the scratch change, and wrote this report. |
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
The put-off dispatch test forgets its allocator, and the two older tests that reset an allocator at a reused address (mid_list_write64_wait64_split, cross_queue_cycle) forget theirs before use, so a stale type left by another test no longer makes them reset a compute list on a direct allocator.
|
Thanks for the runs. I reproduced it: on
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this. |
…MS set, a put-off dispatch waits for its pipeline at the submit instead of being dropped From xcl-dev#2547: pso_async::wait_for_submit, called by record_deferred (bind::wait_for_bound) before each put-off call is recorded; the SUBMIT_WAIT_MOST bound with its WARN and SUBMIT_GAVE_UP count; the test switches for the wait budget and the submit bound; catch_unwind around a worker's build; the four tests. Kept from the fork: Demand's waiters/by_submit/ahead counting (the submit counts once among the waiters through `ahead`, also for a late pipeline, and leaves with unwant_ahead when it gives up), waits_for/need_by_submit, the split LISTS locks (no lock held across the wait), the own allocator on the primary list, run_job (the panic catch wraps it and clears its thread-locals), the Wait struct (submit wait counters, 1 s logs, title held), BUILT_HERE/BUILT_AT_SUBMIT for a build the submit runs itself, the dred pipeline mark (now after the wait, so it names the built pipeline) and bound_pso. XCL_CS_PSO_WAIT_MS keeps its precedence: with it set, wait_for_submit leaves the wait to the call's resolve_wait as before. Without XCL_PSO_WAIT_MS and XCL_CS_PSO_WAIT_MS the submit's wait is the unbounded resolve_wait_for it already made. The list_x GPU test makes the pipeline late after the dispatch is put off, since the fork does not put off a late pipeline. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… fork's put-off dispatches) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
luckyteagirl
left a comment
There was a problem hiding this comment.
wait_for_submit can take an unstarted job after the wait budget and call complete(&p, job()) on the submitting thread. A build closure that panics there bypasses the new catch_unwind in the worker's build() path, so the submit unwinds before complete publishes the failed result. This path is new when XCL_PSO_WAIT_MS is set and workers are busy; the existing panic regression runs only on a worker.
Could this submit-owned job use the same panic-to-failure handling as build()? Combining the saturated-worker fixture with a panicking target would verify that wait_for_submit returns and the pending entry becomes failed. This is an exact-head source review of 60349e51011d8fd4295c00776b2617b229b32d27; I did not run that interleaving on a GPU. AI-assisted review with Codex.
|
Ran the deferred-dispatch submit tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. Results
The author's four new tests pass here: What this adds: the author tested on an Ampere RTX 3080; this is a Blackwell wave32 part with a different driver and DXC version. The thread has no report from another machine. Not tested: a retail world run (the author's still stalls), a paired 60 s smoke run, the whole workspace suite, AMD and Intel GPUs, native wave64, Wine, release profile, title data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
…+ xcl-dev#2548 + xcl-dev#2579 + xcl-dev#2581 + xcl-dev#2598 + xcl-dev#2611 + xcl-dev#2615 + xcl-dev#2622) (cherry picked from commit 57e5c216e924452b59cd64862d2941006e24c28c)
Prime1997
left a comment
There was a problem hiding this comment.
Needs changes — keep the useful work. Checked head 60349e51011d8fd4295c00776b2617b229b32d27.
When the worker pool is saturated and a submit takes ownership of a queued pipeline build, the direct job() call bypasses the worker's panic handling. A panic escapes before complete(0) marks that pipeline failed. The local repair catches the panic on this ownership path and completes the entry as failed. The added fixture forces submit ownership using synthetic blocked workers and a panicking job; it does not call a driver.
Local validation: head plus an uncommitted repair and regression fixtures: 4 passed, 0 failed, 0 ignored, 0 skipped. These are CPU checks of the local repair, not a claim that the unmodified PR passed them. Separate negative-control checks produced 3 passes and 1 expected failures.
Build command: cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated target> (only the private absolute target path is replaced here). Each selected test executable was then run separately as <test-exe> <exact-name> --exact --test-threads=1 --nocapture.
Selected exact tests
hle::d3d12x::pso_async::used_tests::a_build_that_panics_on_the_submitting_thread_ends_as_failedhle::d3d12x::pso_async::used_tests::a_build_that_panics_on_a_worker_ends_as_failedhle::d3d12x::pso_async::used_tests::a_submit_builds_a_late_pipeline_no_worker_has_startedhle::d3d12x::pso_async::used_tests::a_submit_waits_for_a_build_on_a_worker_no_longer_than_its_bound
Latest-main source comparison: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7; full-head merge-tree result: clean. This is a source compatibility check, not a tested integration build. Local repair patch SHA-256: 04db079e12cde4f0834b68cf5a06d8b8bdd7fe48c84b438a17a67516e3562980.
Windows 11 Pro build 26200, i5-10400, 32 GiB RAM, Rust 1.100.0 MSVC debug tests. RTX 3060 Ti / driver 32.0.16.1714 is present but was not exercised. No full-suite, GPU or title result is claimed; installed builds and game data were untouched.
AI use: Codex (GPT-6) reviewed the source, prepared the local repair/fixtures, ran the checks and drafted this report.
Optional temporary Discord for coordinating this contributor work, helping test and comparing results.
|
Two contributors checked independently and found that #2581 solves the same problem in a different way: #1607, group D131. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
|
Independent test report under Wine/Proton (not native Windows) for head Tested
Retail title, release builds, 300 s per run (
(Put-off counts are the last power of two the log reported; dispatch counts are the last
What the change does in the title: with it, no dispatch was skipped in any of the 3 runs ( Not tested
AI use
|
With
XCL_PSO_WAIT_MSset, a dispatch put off to the submit (#2118) can be left out for good while the list's labels still fire. This makes the submit wait for the put-off call's pipeline, with a long bound and a logged fallback. Part of #505 and #1452. It does not get the retail title past its world start: in the one world run below the title still stops presenting, at about 72 s.A
Dispatch, or anExecuteIndirectthat dispatches, whose pipeline is still being built gets a segment of its own and is recorded atExecuteCommandLists/KickoffX(list_x::record_deferred). That recording went throughresolve_wait, with the same budget a bind has while the title records. A pipeline that a bind had already foundlategot the stand-in at once, and one still building got it after the budget. Either way the dispatch was counted as skipped and dropped, and nothing said so beyond the skip count. Its segment sits between the list's other segments, so theWrite64labels, EOP writes and fence signals after it still ran: the title read the work as done, but the dispatch's UAV outputs, counters and indirect argument buffers were never written. #891 made skipping opt-in for binds as the title records ("skipped dispatches leave their outputs unwritten") because the title's watchdog ends it when its main thread stands still for about 30 s.At the submit the waiting thread counts as held (
title_held). That stops two clocks:kernelx::Sleepdoes not count the time, and the GPU-wait watchdog does not release waits meanwhile. It does not stop every clock a title can read, so a long wait at the submit can still reach the title's own watchdog. The change therefore bounds the wait, and the bound is the escape.What the submit does now (
pso_async::wait_for_submit, called byrecord_deferredbefore it records each put-off call)XCL_PSO_WAIT_MSunset: it waits until the pipeline is built, as the submit already did.XCL_PSO_WAIT_MSset:SUBMIT_WAIT_MOST, the time D3D12.X: XCL_PSO_WAIT_MS bounds how long a bind waits for a pipeline being built (retail world renders) #891 measured the title's watchdog allowing). Past that the call goes on with the stand-in as before, with a WARNdeferred dispatch skipped after waiting 30 s for its pipeline (N so far)and a count of its own.lateno longer matters at the submit.XCL_PSO_WAIT_MSstill bounds binds while the title records.resolve_for_bindwaits only for those.catch_unwindaround the job). Before, it leftdoneunset and whoever waited for it waited for good. A lock the job held when it panicked can still be left poisoned.From reading the code, not from a test: a build that fails still gets the stand-in and its dispatch is skipped, and a program binds do not wait for (
XCL_PSO_IMAGE_SKIP=1) is still left out. A call that cannot be put off (deferfails: bundle, predication, segments used up, no allocator) still binds with the budget where it is.dispatch_droppedinrecord_deferredis not changed. It counts the two cases where the put-off call cannot be recorded at all: the list's own allocator is gone, or the segment'sResetfailed. Waiting does not help there, because the call has already been taken out of the title's list and there is no PC list to record it on.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:wait_for_submit,SUBMIT_WAIT_MOSTand its counter,catch_unwindin a worker's build, and test-only per-thread overrides of the budget and the bound. Testsa_submit_builds_a_late_pipeline_no_worker_has_started,a_submit_waits_for_a_build_on_a_worker_no_longer_than_its_bound,a_build_that_panics_on_a_worker_ends_as_failed.crates/xcl/src/hle/d3d12x/bind.rs:wait_for_bound(the pipeline a segment has bound); test helperset_args_for_test.crates/xcl/src/hle/d3d12x/list_x.rs:record_deferredwaits throughwait_for_boundbefore it records the call; testa_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget.Tested
cargo test -p xcl --lib -- --test-threads=4on the head commit: 1302 passed, 0 failed, 26 ignored. 24 SKIPPED lines, allno wave64(or wave32 per-lane forms refused) on this card; the four new tests ran.alloc_pool, andmid_list_write64_wait64_split_avoids_cycle_and_reuses_sparesandcross_queue_cycle_and_same_queue_fifo_do_not_deadlockforget theirs before use, because another test's stale allocator type at a reused address made them fail in a whole-module run.cargo test -p xcl --lib hle::d3d12x::list_x::tests:: -- --test-threads=4, 3 sets of 100 runs on the head: 7, 2 and 6 failed runs, none in those two tests (maine1d84b7, 2 sets: 2 and 3 failed runs,mid_list_...1 time andcross_queue_cycle_...2 times). The other failures are the module's flaky tests:a_dispatch_with_a_pipeline_still_building_waits_at_the_submit(also on main), and a cluster ofcpu_watchdog_...,cpu_cycle_break_...anda_reset_while_the_last_submit_runs_...failing together in one run (6 of the 300 runs on the head; on main the same cluster, withouta_reset_while_..., came up once in 200). Not looked into. Fullcargo test -p xcl --libon the head: 1302 passed, 0 failed, 26 ignored, with and without--test-threads=4.a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget(GPU): a translated console compute program stores a constant through a pointer in its argument table. Its stand-in's build ends 400 ms into the submit, the budget is 50 ms, and a bind has already found it late. The dispatch is put off, aWrite64BitValueBottomOfPipeXfollows it in the same list, and the list runs on a queue. With the change both the store and the label reach memory. With thewait_for_boundcall removed it fails:the put-off dispatch was left out (the submit waited 487.1µs), while the label was written.a_submit_builds_a_late_pipeline_no_worker_has_started: with every worker busy and a 30 ms budget, the submit's wait for a late pipeline builds it on the waiting thread. Withwait_for_submitdoing what the submit did before (resolve_wait), it fails:the submit's wait ended without the pipeline(it got the stand-in).a_submit_waits_for_a_build_on_a_worker_no_longer_than_its_bound: a worker's build that does not end, a 20 ms budget and a 300 ms bound. The submit returns after the bound, counts it and logs the WARN. With the bound raised to 8 s it fails on the time it waited.a_build_that_panics_on_a_worker_ends_as_failed: without thecatch_unwindthe build never ends (the test fails after 10 s).89a8267. That head had the same change without the 30 s bound, the compute check and thecatch_unwind. It used the world start settings of the earlier runs (XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_DRED=1 XCL_PSO_WAIT_MS=50 XCL_NETWORK=0, A pressed at 14, 17, 21, 25, 31 s, cold driver cache and a seeded DXIL cache). It is compared with one earlier run ofmain6d12f58with the same settings (e1d84b7, this branch's base, differs from it only inREADME.md). One run each. The thread dumps show no title thread inrecord_deferredor in a bind, so this run is context for where the title stands, not evidence for the change.6d12f5889a826789a8267, from 2 s to 72 s: 0 16 60 54 39 43 60 56 59 60 60 61 60 60 57 46 46 60 60 60 60 45 58 33 1 4 3 0 2 6 23 42 56 23 11 11; then 0 to the end of the run. Onmain: 0 15 61 54 40 41 60 56 60 60 60 60 60 60 56 45 43 60 60 61 60 44 59 32 6 4 6 0 7 50 48 31 11 13; then 0.xcl-psoworker was building at 100 or 185 s (2 of 11 at 269 s). From 79 s on, XCL loggedWait64BitValueXwaits bridged toqueue.Waitwith no producing queue (prod=qNone), the pattern of Retail game (retail title, Series X build): GPU device removal after Wait64BitValueX waits with no producer; also watchdog stalls on slow compute pipeline builds #1452.Dispatch with a pipeline that has no translated console shaderwarnings. The log does not say which caller they came from, and no failed or rejected pipeline was logged. Binds of late pipelines that could not be put off fit the timing; this change leaves those as they were.Regression run
Default settings (
XCL_PSO_WAIT_MSunset), so these runs check that nothing else changed. They do not exercise the budget or the bound.main:
PR:
Not tested
cargo test --workspace); only thexcllib tests ran.XCL_PSO_WAIT_MSunset. No world run enteredrecord_deferredwith a pipeline still building.ExecuteIndirectandKickoffXat the submit with a pipeline built after the budget (the tests useDispatchthroughrecord_deferred).XCL_PSO_IMAGE_SKIPcases at the submit (read from the code, not tested).AI use
AI-assisted (Claude Code).