D3D12.X: build masked pipelines for partial DispatchX groups on workers #3066
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3066"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-27T19:30:16Z.
Stacked on #3015 (itself stacked on #2610); review only the last commit,
d8a1f5f1.What is in it
A partial thread-dimension
DispatchXselects the masked direct-DXIL compute pipeline. Whole groups keep the original pipeline. A 200-second diagnostic run counted 2,999 partial-group calls out of 3,009 thread-dimensionDispatchXcalls in the last logged sample, across four pipelines. The first appeared at world load.Only the first partial dispatch queues the variant. If the list can defer the dispatch, it replays with the same dimensions at submit. Title and submit threads wait for the variant without doing the driver build themselves. A build worker can take an unstarted dependency inline to avoid deadlock when the worker pool is full. For a split variant, the worker prepares the pieces and the whole-program scratch fallback. If the variant fails or exceeds the wait budget, the call is skipped.
Related #1751 / #1833.
Tested
At this head,
d8a1f5f1, release,XCL_NETWORK=0, RTX 5090 (621.24) and the Ryzen 7 9800X3D's AMD Radeon iGPU (RDNA2), Windows 11:cargo test --workspace --no-fail-fast -- --test-threads=4(RTX 5090): 1,438 passed, 4 failed, 47 ignored, 27 SKIPPED. The 4 failures are the knownfuzz_validate_and_gpu_0..3(#1905). The SKIPPED includedispatchx_native_wave64_masks_excess_lanes(no native wave64 on this GPU).gpu::dxil::dispatchx_tests::: 7 passed on both adapters. The native-wave64 case ran and passed on the iGPU.hle::d3d12x::pso_async::(the worker queue): 19 passed on both adapters.224706a6: bypassing the selection returned the original PSO for a partial group and failed the regression test. With selection, a GPU readback had 100 expected writes and 28 untouched elements.DispatchXflag kinds the title used were both partial groups and took this path (0x8020, a 1×1×1 group with thread limits[1,0,0];0x20, 45 threads launched as 1 group with limits[45,0,0]). There were 0 masked-pipeline-unavailable errors and 0 skippedDispatchX. The code logs the flags line once per kind and nothing per variant selection, so the number of masked dispatches isn't in the log.Tested by others (thank you):
d8a1f5f1: the targeted CPU tests and the Arc runtime selection with a live partial-group readback passed (11 passed, 0 failed). https://github.com/xcl-dev/xcl/pull/3066#issuecomment-7227281769maindoesn't build (compute_containernow takes aComputeBuild). https://github.com/xcl-dev/xcl/pull/3066#issuecomment-7227453530main2c717a04: 0 removals and 0 crashes on both, but 1,722 frames against 2,234. This head is on an older base withoutmain's startup preparation, so it isn't like-for-like. https://github.com/xcl-dev/xcl/pull/3066#issuecomment-7230410066DispatchXcalls selected the worker-built masked direct-DXIL PSO. The last-group EXEC words written at the masked entry were00000000_01ffffff(2,841 threads, 25 of 64 active) and00000000_7fffffff(927 threads, 31 of 64), with full EXEC in the groups before. Reproduced at a second frame. The skinning input kept its value through both, and the vertex stores read back bit for bit. https://github.com/xcl-dev/xcl/pull/2610#issuecomment-7227859589 https://github.com/xcl-dev/xcl/pull/2610#issuecomment-7228084962Not tested
Full wrapped-list replay; the in-title first-use wait and the rendered result of the masked dispatches (the frames are grey on this tree); a count of masked dispatches in the title; runtime selection on AMD in the title. The HLSL and per-lane paths are outside this change.
Regression run
main(08db8020, the base under #2610, #3015 and this change; the same block as in #2610 and #3015):This PR (
d8a1f5f1):Both: the retail title,
-Seconds 200, RTX 5090, a copy of the same precompiled cache, the same scripted input, full-size frame dumps. Themainrun used a never-used exe name; this head's run reused a warm one.AMD testing requested
Run from this source checkout in PowerShell with DXC available. Report the adapter, driver, and whether any focused case printed
SKIPPED.AI use
Codex (GPT-6.2-Sol) wrote the change, tests and description. Claude Code (Claude Opus 5.5) independently reviewed and validated the change at this head on both adapters, ran the smoke and in-title check, and finalised this description.
🤖 Generated with Claude Code
https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T20:12:39Z.
Tested
Clean detached
d8a1f5f1fc30b8640afb76266d24d4a7b79896c5on Windows 11 build 26200.9974, Ryzen 7 3800X, Arc A770 (8086:56a0, driver 32.0.101.9175), Rust 1.100.0 MSVC debug, and DXC/DXIL 1.9.2602.17. I reran the pinned stock libtest executable with--test-threads=1 --nocapture, an isolated DXIL cache, and PSO disk caching disabled.hle::d3d12x::pso_async::used_tests::worker_only_,dispatchx_failed_variant_is_built_once_and_never_selects_its_token,dispatchx_pending_variant_can_defer_and_replay_reports_failure, anddispatch_x_with_thread_dimensions_launches_whole_groups.hle::d3d12x::real::shaders_key_tests::dispatchx_runtime_selects_and_reuses_a_masked_pipeline_only_for_partial_groups. Partial groups selected and reused a worker-built, unsplit wave32 masked direct-DXIL PSO. Whole groups kept the base token. The partial-group readback checked all 128 words: 100 expected writes and 28 untouched zeros.masks_excess_lanespassed its wave32 and split-wave64 readbacks. The native wave64 case logged a skip for unavailable wave size. Libtest included the early return in its pass count.11 exercised passes, 0 failures, 0 ignores, 1 explicit skip. The Arc probe confirmed the actual adapter and an 8–32 wave-lane range. Both native GPU children and the shared lock wrapper exited 0. The executable hash matched before, under, and after the lock.
Not tested
Full wrapped command-list recording, submission and replay, runtime selection of a split PSO, retail smoke, and the full workspace suite.
AI use
T3 Code / Codex (
gpt-6.2-sol) independently reran the stock tests and wrote this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-27T20:23:21Z.
AMD run (runtime selection on AMD was untested), with an RTX 3060 in the same PC. The 13 new tests pass on both, and the native wave64 one ran on the RX 9070 XT. One thing first: applied on today's
mainthe PR doesn't build.Doesn't build on current
main: the diff applies cleanly onmain6089122(GitHub also shows no conflict), butcargo test -p xcl --lib --no-runfails:mainhas 34 commits since this PR's base08db802, and a call there still passesfalsewhere the PR changes the parameter toComputeBuild. At the PR head it builds, so the results below are from the head.Tested: at the PR head
d8a1f5fagainst its merge-base withmain,08db802. Debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER.cargo test -p xcl --lib -- dispatchx dispatch_x gpu::dxil::kernel hle::d3d12x::bind pso_async --test-threads=4 --nocapture, 3 runs each:dispatchx_native_wave64_masks_excess_lanesran and passed (no SKIPPED line for it).SKIPPED ...dispatchx_native_wave64_masks_excess_lanes: required wave size unavailableandSKIPPED ...dispatch_chain_native_wave64_builds_whole: no wave64(libtest still lists both as ok).New and ok on both:
dispatchx_wave32_masks_excess_lanes,dispatchx_split_wave64_masks_excess_lanes,dispatchx_native_wave64_masks_excess_lanes(RX 9070 XT),dispatchx_base_translation_stays_byte_identical,dispatchx_runtime_selects_and_reuses_a_masked_pipeline_only_for_partial_groups,dispatch_x_with_thread_dimensions_launches_whole_groupsand theworker_only_*tests.dispatch_x_with_thread_dimensions_launches_whole_groups(rarely flaky at 4 threads on #2817) passed in all 6 runs.Not tested: the masked dispatches in a title, release, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-27T23:47:24Z.
RTX 3060 12 GB, retail title, 300 s: clean, but 1 722 frames against 2 234 on
main(77 %), from one run that stopped presenting earlier. This PR's headd8a1f5f1againstmain2c717a04, release,XCL_ACTIVITY=1 XCL_NETWORK=0, 8 preparation threads, A pressed every 4 s from 20 s.Both exit 0x0 with no device removals or crashes. Peak commit is 34 649 MB against 38 242 MB, and peak local video memory 15 762 MB against 18 893 MB. Both are lower because this run stopped earlier.
Presenting stops at ~92 s here, against ~338 s on
main. The stop looks like the one described in #2595 on this card: one 2 s window with ~14 000 dispatches, then no submits while driver compiles of huge pipelines run withdriver blob absent(1.4 MB compute, 0.3–0.6 MB graphics) to the timer. This PR branches from an oldermainthan2c717a04, so some pipelines may have compiled cold that themainbuild found in the blob cache. I can't separate that from the change with one run each, and I haven't rerun it.Regression run
main:
this PR:
Edit: one more run of each, same setup, warm caches. This PR's second run stops at ~94 s again (1 766 frames, exit 0x0, no device removals or crashes, peak commit 34 597 MB). But
main's second run doesn't repeat its first either: its device is removed at ~187 s (0x887a0006, device hung; 2 device removals and 2 crashes in the smoke block), like the base runs on this card on #3025. Somainvaries here from presenting to ~338 s to a device hang at ~187 s. The PR's two runs both stop at ~93 s, but against that spread I can't say whether the change causes it. Neither PR run had a device removal.RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200.
AI use: Claude Code (Claude Opus 5.5) built both commits, ran the title, read the logs and wrote this report.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T01:49:21Z.
Thank you @JJAutoCompare, @DarkPanda69 and @Anon64. Added to the description. The native-wave64 run on the RX 9070 XT and the Arc readback were the coverage this needed.
@DarkPanda69, you're right about the build:
mainchangedcompute_container's last argument frombooltoComputeBuild, sobuild_masked_computeneedsComputeBuild::Wholethere. The branch needs a rebase onto currentmain. That fixes the build and also makes a smoke againstmainlike-for-like (@Anon64's point: this head predatesmain's startup preparation).AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by akimfomin on 2026-11-28T02:00:18Z.
AnyPS5 #26196 shows why it matters that a first visit does not compile on the caller before the deferred path takes it. For your partial DispatchX variant, use a fresh cache and then one warm-cache run. Record worker and caller build counts and the number of partial calls skipped. That separates a faster preparation path from silently dropping work, without assuming the graphics and compute mechanisms are interchangeable.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T02:27:31Z.
@akimfomin, thanks. By construction, the masked variant never builds on the caller: it's queued with
pso_async::submit_worker_only(the worker-only path from this series), and a waiting title or submit thread doesn't take an unstarted worker-only job. That's covered byworker_only_wait_does_not_take_an_unstarted_jobandworker_only_submission_keeps_the_budget_and_used_key. If the variant isn't ready within the budget, or fails, the call returns an error ("DispatchX masked pipeline unavailable") and that dispatch is skipped rather than run with the extra lanes.So the numbers that separate faster preparation from dropped work are the count of skipped partial calls on a fresh cache against a warm one. That's a fair ask. We'll add it with the next in-title run on the rebased head, rather than hold the rebase for it.
AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T02:45:43Z.
Source review of head
d8a1f5f: there is a partial-DispatchXpath where excess lanes can still execute whenXCL_DIRECT_DXIL=1 XCL_PER_LANE=1.The compute translator tries per-lane first and, on refusal, can successfully make the base pipeline with the per-instruction direct translator. But
remember_masked_sourcereturns wheneverlower_dxil::enabled()is true, even when that translator refused the shader. A later partialDispatchXrounds up its group count, finds no registered source, andmasked_dispatch_psoreturns the unmasked base. The PR's GPU fixture establishes that the base ignores thread limits; a request for 100 threads in 32-thread groups can therefore run 28 extra lanes.Please make registration follow the actual compiled translation, including its cached form, rather than the per-lane preference flag. For partial limits with no masked implementation available,
masked_dispatch_psomust not silently return the unmasked base. A discriminating regression is to prependV_MOV_B32 v9, exec_loto the existing wave32 store fixture: that scalar-mask read refuses the per-lane lowering but is supported by the per-instruction path. Assert those two translation outcomes, then create the PSO through the normal production hook and dispatch 100 threads with 28 canary words beyond them. Check the canaries with both cold and warm translation caches. The current runtime selection test inserts the source intoMASKED_COMPUTEitself, so it cannot detect the missing-registration path.This is a source-traced finding; I did not run that regression or a GPU test. AI use: Codex (GPT-6.2 Sol) checked the call path and drafted this review; Codex (GPT-6.2 Astra) independently audited the translator and fixture.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T02:52:09Z.
@thehollowedone, confirmed, thank you. The same path is in the rebase onto current
mainthat's ready locally.remember_masked_sourcereturns wheneverlower_dxil::enabled()is true, not when per-lane actually translated the shader. Andmasked_dispatch_psotreats "no source registered" as "use the base", so a per-lane refusal that falls back to the per-instruction translator runs the extra lanes underXCL_DIRECT_DXIL=1 XCL_PER_LANE=1.The fix will go in with the rebase, along the lines you describe:
DispatchXwhose base can't honour thread limits and has no masked variant returns an error and is skipped, never the unmasked base;V_MOV_B32 v9, exec_loahead of the wave32 store fixture. It asserts that per-lane refuses and per-instruction accepts, creates the pipeline through the production hook, and dispatches 100 threads with 28 canary words, on cold and warm translation caches.AI use: Claude Code (Claude Opus 5.5) checked the path at the rebased head and wrote this reply.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T16:16:33Z.
Closing this: with bmjask's
d9403543and #3157 onmain, DispatchX thread limits are handled inline, so no masked pipelines are needed, on workers or anywhere else. It's a different design that gets there with less. Thank you @bmjask.Thank you to those who tested and reviewed it:
The gap that remains on
main: the opt-in per-lane path still ignores the thread limits.AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon.
Pull request closed