D3D12.X: a bind never builds a cold pipeline on the title's thread #2615
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2615
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2615"
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?
@iggyvilla on GitHub · 2026-11-26 02:07 UTC · original
iggyvilla:no-inline-cold-bind-r3→main· +179 −86 · 7 files · 2 commits · openWith
XCL_PSO_WAIT_MSunset (the default), a bind of a pipeline that is not built yet took the build from the queue, ran it on the title's own thread (DXC and the driver's compile), and waited until it was done. On a retail title that put one title thread into the AMD driver's compile of a 2.4 MB compute program at 124.0 s (itsdriver compile start), where it stayed to the end of a 600 s run: the compile never finished, the last frame was shown at about 125–126 s and none after it, while all thexcl-pso-*workers were idle. A title thread's build also passes the big-compile gate ungated, so several title threads could each run a huge driver compile at once.Now a bind with no budget gets the stand-in at once (its dispatches are skipped, its draws draw nothing, exactly as for a pipeline that is
lateafterXCL_PSO_WAIT_MStoday), and the build is sent to the workers. The build is markedwantedbefore it is sent, which is new (the inline build ran ungated on the title's thread and was marked only after it finished): it goes before the builds made ahead and takes the wanted slots ofbig_compile_turn(at mostXCL_HUGE_PSO_WANTED_CONCURRENCY).XCL_PSO_WAIT_MS=<ms>still waits up to that long, unchanged.XCL_ASYNC_PSO=0still builds every pipeline in the create call.Since #2118, a
Dispatch(or a dispatchingExecuteIndirect) whose pipeline is still being built is put off to the list's submit, in a segment (a PC command list) of its own, andExecuteCommandLists/KickoffXrecord it there through the sameresolve_wait. With no budget, the submitting title thread built the pipeline itself if no worker had started it, and waited for it without end. So the wait moved from the bind to the submit, but it was still unbounded and still on a title thread:main08db802stops presenting at 144–150 s on this title (2 runs), and at 136 s on NVIDIA (#2581).With this PR no bind or submit waits for a pipeline until it is built, so nothing is put off:
list_x::deferreturns false whilepso_async::waits_until_built()is false, which it always is with this change. A dispatch whose pipeline is still being built is recorded at once and skipped as a stand-in's, as before #2118. A put-off would only move a wait the submit no longer makes, and it costs a segment per call. With the put-off kept, on top of no wait, 3 walks of this title went past 8 000 put-off calls and lost the device (0x887a0007) at 175 s, 218 s and 222 s; in two of them a GPU fence wait had timed out just before (2 s), in the third no wait had timed out before it.main08db802without this PR, withXCL_PSO_WAIT_MS=1(the put-off and a bounded wait), hung the GPU the same way at 200.6 s (1 walk), as #2581 saw on NVIDIA. So the hang is in that path and not in this change; its exact cause (DRED: a page fault at GPU VA 0) is not found. Without the put-off, 3 of 3 walks ran to 355–361 s with no device removal.What this gives up: a put-off dispatch whose pipeline was built between the recording and the submit ran; it is now skipped. #2118's put-off stays in the code for a mode that waits until a pipeline is built; with this PR there is none. The cases where #2118 waited at the call itself (a list that cannot be split, predication), console-list replay and draws (
graphics_bound) go throughresolve_waittoo, and no longer wait either.Every bind path already handles a stand-in:
Dispatchand console-list replay skip it (is_translated_computeis false for a stand-in and for the shared stand-in driver pipeline),ExecuteIndirectskips it (is_pending), a draw binds the title's root signature and draws nothing (graphics_bound), andSetPipelineState/ClearState/Reset/CreateCommandListbind the stand-in's driver pipeline.This also changes draws:
graphics_boundcalledresolve_waittoo, so a draw of a cold graphics pipeline used to wait for it. Now it draws nothing until the pipeline is built, asSetPipelineStatealready did for graphics pipelines.Sequencing: #2364's
submit_aheaddoc ("a bind that reaches one not started takes the job itself") is no longer true after this; whichever of the two lands second fixes that line.ExecuteIndirectreadsis_pendingafterresolve_wait, so a build that ends between the two sends the stand-in to the PC call. Until now onlyXCL_PSO_WAIT_MS/XCL_PSO_IMAGE_SKIPopened that window; with this PR the default path does too. #2598 fixes that on its own (bound_unbuilt, one lookup), and #1652 fixes it too.#2581 makes
deferreturn false whileXCL_PSO_WAIT_MSis set, for the same reason (a bounded wait makes the put-off only move the wait), afterClose→E_OUTOFMEMORYand a device removal on NVIDIA withXCL_PSO_WAIT_MS=1. With this PR it holds for the default too. Both add an early return at the top ofdefer, so whichever lands second has a small conflict there, and #2581's check becomes part of this one.amd-dev(6a0bb5b4) bounds this wait differently. A draw or dispatch, and a submit's put-off dispatch, waits for its pipeline within a per-frame window of 12 s for each kind (XCL_PSO_FRAME_BUDGET_MS), and the build stays on the workers. This PR is formainand goes further: with no budget there is no wait at all. Whenmainis merged intoamd-dev, it conflicts inpso_async.rs(resolve_wait_for, the module doc, the worker loop) and inbind.rs, andamd-dev's window should be kept there. The whole form of a split program thatExecuteIndirectcompiles on the title's thread (#2404) is not changed here;amd-devalready builds it off that thread.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:resolve_wait_forwith no budget calls the newresolve_unwaitedinstead of building and waiting;wait_built(wait until a stand-in's build is over, for tests); module and field docs that said compute pipelines are waited for at their first bind.pso_async.rs): newa_bind_with_no_budget_neither_builds_nor_waits_for_the_pipeline(compute and graphics: the bind returns the stand-in while the build is blocked, the build runs on anxcl-pso*worker and is wanted, then the bind gets the real pipeline). Tests that used a no-budget bind to wait for a build now use a budget (they test the waiting bind:title_held,wanted) orwait_built.bind.rstests,tests/gpu_compute_e2e.rs,tests/gpu_pso_e2e.rs:resolve_waitused to wait for a build →wait_built.execute_indirect_skips_failed_shared_console_compute_standinbuilds its second shell withwait_builtbefore binding it.bind.rs,console_list.rs: two comments that said the bind waits.list_x.rs:deferreturns false whilepso_async::waits_until_built()is false (new,pso_async.rs). #2118's testa_dispatch_with_a_pipeline_still_building_waits_at_the_submitis now..._is_recorded_at_once_and_skipped: no segment is added, each dispatch returns at once and is skipped at the bind, the submit records nothing and does not wait; then the build is let finish and the list runs.real.rs: one comment from #2118 ("compute: waited for at its use") now adds "up toXCL_PSO_WAIT_MS".pso_async.rs,bind.rs):lazy(), theusedmodule,resolve_for_bindand abind_abicomment no longer say a compute bind waits for its build;wait_builtsays it returns at once for a pipeline that is no stand-in.Not in this PR
XCL_PSO_WAIT_MS>0). After this change the bounded wait is opt-in only. Deciding on "a big-compile slot is taken" alone would also skip the wait for pipelines that build in milliseconds and are never gated; the console shader's size is known when the pipeline is created (#2364 routes on it) but is not kept inPending, so doing it precisely means recording that size at submit. Deferred for its own measurement, not ruled out.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4ona0734c9f: 1429 passed, 1 failed, 47 ignored. The failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 783,res[64] = 0xc, CPU 0x7fffffff), which fails the same way onmain. The e2e tests pass. SKIPPED: 6×lower_dxilf16/f32 per-lane programs (refused, #1426 semantics),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(the driver cache cannot be disabled without Developer Mode).cargo test -p xcl --no-fail-fast -- --test-threads=4ona0734c9f(a3, debug, aftercargo build --workspace): 1428 passed, 2 failed (fuzz_validate_and_gpu_1, and e2etest_title_runs_and_game_folder_is_untouchedwith no desktop session), 47 ignored. Thelist_xtest fails without thedefercheck (0 passed, 1 failed: "a dispatch was put off to the submit").59f8e7c) merged locally, on this tree (built as6336dce1, the same tree asa0734c9f):XCL_PSO_WAIT_MSunset, 2 runs: no put-off, no device removal. Last present at 361 s in run 1. Run 2 was ended at 357 s by the title's int3 afterClose→E_OUTOFMEMORY, when the system had 1.2 GB of physical memory left (73.8 of 95.9 GB committed); that is not a device removal. 12–14 % of dispatches skipped (32 768 of 263 370, 45 789 of 337 045). On average 11.2 and 10.6 presents per 10 s over 120–350 s, unevenly spread.XCL_PSO_WAIT_MS=200, 1 run: no device removal, last present at 356 s, 8 192 of 186 604 dispatches skipped, 6.2 presents per 10 s.60371139(base08db802: this change without thedefercheck, so with #2118's put-off), + #751, 3 walks: device removed (0x887a0007) at 217.98 s, 174.85 s and 222.23 s, each after more than 8 000 put-off calls; 701 of 33 056, 1 604 of 28 086 and 659 of 35 326 dispatches skipped. The third ran withXCL_DRED=1: a page fault at GPU VA 0, no allocation there.main08db802(2 walks): stops presenting at 144–150 s, no removal.8184b43(base8a3f912): suite 1402 passed, 1 failed (fuzz_validate_and_gpu_1, seed 783, the same onmain), 46 ignored. Walk with #751, 2 runs: presented to the end, 0 crashes, 0 device removals, 9.0 and 8.2 presents per 10 s after 120 s.55d64c2(PR at7d38980), 2 runs each:mainstopped presenting at ~126 s and ~142 s. This PR presented to the end, at 3–13 presents per 10 s after ~130 s; one run crashed in the texture detile, which #751 fixes.Regression run
(
scripts/smoke.ps1, same title, 60 s, adjacent runs in the order main, PR, main)main
08db802(run 1):this PR,
a0734c9f:main
08db802(run 2):Not tested
ExecuteIndirector dispatch reads. TheXCL_PSO_WAIT_MSpath skips them the same way, and once hung the GPU like that (see the doc ofimage_skip). No device removal was seen in the 7 walks with this PR, but all of them end in the intro / credits. Later gameplay was not reached.55d64c2(and in a second run in a reproduction) is in XCL's texture detile, not in code this PR changes.title_textures::subresources→gpu::tiling::Chain::detile_levelcopied from title memory thattitle_byteshad borrowed after a singlereadable()check, and a page of it was no longer mapped by then. #751 fixes that read (0 crashes in 5 walks with it).mainhas the same code but does not reach it in this walk, because it stops presenting at 126–142 s. The walks on8184b43all ran with #751. This PR alone was not walked on8a3f912, and neither wasmain.Docs
HANDOFF.mdbecomes wrong in two places: line 1051 ("compute is waited for at its first bind / replay (resolve_wait…)") and lines 1420–1421 ("draws wait for pipelines still being built (resolve_waitinbind::graphics_bound…)"). With this PR neither waits unlessXCL_PSO_WAIT_MSis set. Not edited here.AI use
@DarkPanda69 on GitHub · 2026-11-26 02:27 UTC · original
NVIDIA and RDNA4 run (both listed as untested): the new and changed tests pass on an RTX 3060 and an RX 9070 XT. One flaky
list_xtest fails on the RTX 3060 at the same rate onmain.Head
a0734c9applied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER, integration tests run with--nocapture:--test gpu_compute_e2eheap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows, same onmain)--test gpu_pso_e2e--lib -- d3d12x::On the RTX 3060,
hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_sparessometimes fails in the paralleld3d12x::run:list_x.rs:7146, left -2147024809 (0x80070057), right 0. It is not from this PR. Over 8 runs each, it failed 1/8 onmainand 1/8 with this PR. It passes alone 5/5 on both, and 0/8 on the RX 9070 XT either way.Not tested: a world run on RDNA4 or NVIDIA (no title here), wave32-only performance, Intel.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 02:32 UTC · original
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
@Royalflamejlh on GitHub · 2026-11-26 04:36 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA, the title, 3 runs with #2615 and 3 without: without it the title stopped presenting 1.1 to 3.1 s after its first call of
ID3D12GraphicsCommandList10::#101(72.5 to 74.5 s), in 3 of 3; with it, 2 of 3 runs went on submitting and dispatching to the 120 s end, but from 76 s presented about once a second (35 and 42 presents), and the frames kept then showed no picture. The third run with it lost the device at 58 s, before the world load.Setup:
08db8020(the commit it is based on) + #684e56dbc3, against the same + #2615's two commits (dee610f,a0734c9), in turn. RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-protonv3.1-90-g30b0eb9bwith the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, the first-run screens completed once and no story progress, 120 s, A pressed when ready (16.0 to 16.5 s),XCL_PSO_PRELOAD=0,XCL_PSO_WAIT_MSunset.#101212355-b, 1430 and 1460 (79.9 and 106.6 s) were all black; in204741-b, 1400 and 1430 (76.0 and 108.7 s) were the loading screens' dark background colour, the second with some black and grey. The frames kept before 72 s were loading pictures, in212355-balso for 19 s after its first#101at 52.9 s.203603-b): presents and submits stopped at 46.0 s, andD3D12 device removed: 0x80004005 Call failed.came at 58.28 s with vkd3d-proton'sFailed to submit semaphore waits, vr -4; no NVIDIA kernel message. One removal in 3 runs does not tie it to #2615.Not tested: today's
mainb49be18;XCL_PSO_WAIT_MSset; runs past 120 s; the suite; Windows; AMD and Intel.AI use: Claude Code (Claude Opus 5.5) ran the title and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
@itsSio on GitHub · 2026-11-26 04:45 UTC · original
Independent dual-PC NVIDIA full-workspace test report on clean head
a0734c9f0931b3e4d122a4de3fd6b310236af1fc.Tested
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), DXC1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1430 passed, 0 failed, 47 ignored (list_x::tests::a_dispatch_with_a_pipeline_still_building_is_recorded_at_once_and_skippedandpso_async::used_tests::a_bind_with_no_budget_neither_builds_nor_waits_for_the_pipelineboth pass)SKIPPED: 26 (wave64-only GPU tests,#1426wave32 f16/cvt refusals,heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record)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 DXC1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA)cargo build --workspace: exit 0cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1430 passed, 0 failed, 47 ignored (both new tests pass)SKIPPED: 29 (same 26 as Machine 1 plus 3 requiringd3d12SDKLayers.dll)Not tested
scripts/smoke.ps1runs--release)AI use
Ran via Samaritan:
@SlopTart on GitHub · 2026-11-26 05:29 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV.Targeted run of
a_bind_with_no_budget_neither_builds_nor_waits_for_the_pipeline,a_dispatch_with_a_pipeline_still_building_is_recorded_at_once_and_skipped: 2 passed.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.
@GreemSC on GitHub · 2026-11-26 07:14 UTC · original · edited 2026-11-26 07:28 UTC
Linux (Wine + vkd3d-proton) + AMD RDNA3, the retail title, 2 runs with #2615 + #2598 + #751 and 2 without, alternated: without them the title stopped presenting at 120.2 / 122.2 s; with them it presented to 349.6 / 358.4 s of 360 s, 0 crashes, 0 device removals.
Tested
xcl.exerelease, cross-built forx86_64-pc-windows-msvc.mainb49be18+ the Wine stack this machine needs (#1732 with #867/#871/#877, #684, #1860, #2097, #240497a70a7, thesparse.rspart of #203, diagnostics #2244/#1734/#1656, #2527, #2475, #2551). Head: the same + #2615a0734c9+ #25981e28011+ #75159f8e7c. Only #751 conflicted (with #1732's Wine reads intitle_textures.rs: under Wine the coherent window is still copied, as #1732 wants).XCL_DIRECT_DXIL=1, A pressed every 4 s from 22 s; order base, head, base, head.ListX #101bind::dispatchon a condvar (the cold-pipeline wait this PR removes). The driver compile of record95cc13288a27a96e(2,456,668 B DXIL, the record iggyvilla names) starts at 122.1 / 130.7 s and does not finish in any of the 4 runs.xcllib suite under Wine (Windows MSVC test binary),--test-threads=4: base 1335 passed / 7 failed / 27 ignored, head 1339 / 7 / 27; 6 of the head's 7 also fail on plainmainunder Wine. The other one is #751'stitle_bytes_leave_guard_pages_alone.Not tested
main+ these three PRs without the Wine stack (plainmainstops at ~2.5 s under Wine); NVIDIA; runs longer than 360 s; more than 2 runs per side.AI use: Claude Code (Claude Opus 5.5) built the trees, ran the runs and wrote this report.
@Royalflamejlh on GitHub · 2026-11-26 07:41 UTC · original · edited 2026-11-26 07:47 UTC
Edited (07:47 UTC): a fourth run of the tree without this PR (with a logging-only count line) lost the device at 199.7 s, Xid 13 then Xid 32, the same form as with it. So these runs do not tie the loss to this PR; with it the title reached the same point sooner (106–234 s, against 199.7 s in 1 run).
On Linux + NVIDIA (RTX 4060 Ti 16 GB),
mainb49be18with #2404 and this PR together lost the device in 18 of 18 runs, at 106 to 234 s: 2 of the tree as merged and 16 with one diagnostic change each. With #2404 alone, 3 runs had no loss: from about 76 s the title was held by pipeline builds until 130–156 s, then drew until our low-memory stop at 213.7 and 272.6 s, and to the 300 s end. Our review above (RTX 4070, without #2404) had one removal, before the world load; GreemSC's RADV runs above, with #2404, this PR, #2598 and #751, had none.Setup:
mainb49be18+ #684, #751, #1599, #1860, #2082, #240497a70a7, ± this PRa0734c9(#25981e28011in 17 of the 18, in none of the runs without this PR); NVIDIA 615.71.09, Wine 11.21 Staging, vkd3d-protonv3.1-90-g30b0eb9bwith the relaxed-vtable patch from #175 and a local dxil-spirv patch (11 of the 18 and thebreadcrumbs_syncrow: the same on dxil-spirv694cc674);XCL_DIRECT_DXIL=1 XCL_HUGE_PSO_WANTED_CONCURRENCY=6 XCL_DXC_THREADS=4 XCL_PSO_DISK_CACHE=0; first-run screens done once, no story progress; copies of the same warmed caches; 300 s asked; local video memory peaked at 15,434–15,542 MB in every run, with a loss or without.XCL_PSO_WAIT_MS=60000breadcrumbs_sync(a full barrier after every command; one run with a cold NVIDIA cache)XCL_PSO_WAIT_MS=60000nothing was skipped and the title was held until 130–134 s, as with #2404 alone; 2 of those 3 runs still lost the device, at 229 and 234 s (one with #2118's put-off restored), and the third reached our stop at 264 s.XCL_PSO_WAIT_MS=60000(nothing skipped), no #2598, UAV barriers around every chained piece, an inert scout patch with the translation cache off, a count of early reuse of released memory (0 to the loss). vkd3d-proton, each on a newer dxil-spirv: that alone, plain breadcrumbs, a full barrier between lists, every barrier made full (5 runs), no hoisted preprocess, resource releases held (2 runs, one also heap releases).cs 520a7d5cb893a9f7, in the chainmainrecords for a title'sDispatch.pso.rs,record_dispatch_chain). Here it changes two things: a bind of an unbuilt pipeline gets the stand-in, not a build on the title's thread (pso_async.rs:1119), and no dispatch is put off to the submit (list_x.rs:2657).Not tested: Windows; AMD; this PR without #2404 past the burst (1 run on this card drew nothing after it).
AI use: Claude Code (Claude Opus 5.5) merged the trees, made and read the runs, and wrote this.
Posted without review by a person: the account owner was away and reads replies later.
@DavidM1911 on GitHub · 2026-11-26 08:29 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175github-bot referenced this pull request2026-11-26 12:40:17 +00:00
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.