Skip to content

D3D12.X: a draw does not wait for a graphics pipeline still being built - #1798

Open
isaacwingate wants to merge 1 commit into
xcl-dev:mainfrom
isaacwingate:draws-dont-wait-pr
Open

isaacwingate wants to merge 1 commit into
xcl-dev:mainfrom
isaacwingate:draws-dont-wait-pr

Conversation

@isaacwingate

@isaacwingate isaacwingate commented Nov 24, 2026 •

Copy link
Copy Markdown

pso_async means a graphics pipeline still being built to go on with its stand-in, which draws nothing, while a worker builds it; only compute pipelines are waited for (a skipped dispatch would leave its outputs unwritten). But graphics_bound and ExecuteIndirect called resolve_wait, which waits for the build – and builds it on the title's thread when no worker has started it. With lazy pipelines that is every graphics pipeline's first draw. They now take their pipeline with resolve_for_bind, which waits for compute pipelines only. Part of #505.

Related: #1652 (stacked on #1274, 10 files) also stops draws waiting, among other changes; #267 bounds the draw wait to 4 s. This is the small change on its own.

What is in it

  • crates/xcl/src/hle/d3d12x/bind.rs: pso_for_draw (= pso_async::resolve_for_bind) for draws (graphics_bound) and ExecuteIndirect; a pending graphics pipeline's draw uses its stand-in, a pending one's ExecuteIndirect is skipped as before; compute is waited for as before. The XCL_TRACE_FRAME lookup no longer waits either. Test: a_draw_does_not_wait_for_a_graphics_pipeline_still_being_built – fails without the change (the draw waited the build's 1.5 s and got the real pipeline).
  • Rebased onto main c4d37be: the only conflict was this test landing next to execute_indirect_reads_the_arguments_written_before_it (both kept); execute_indirect's fresh_indirect_arguments is unaffected, both tests pass.

Tested

Regression run
Both with XCL_COHERENT_MB=4095 (without it the window is 512 MB or 4 GB depending on the commit free at the start, #284), one after the other.

main:

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 5080
title: 8a66b2b2
seconds: 90
exit: 0x0
frames shown: 2520 (PresentX 2520)
presents per 2 s (last 3): 60 61 59
device removals: 0
crashes: 0
peak commit: 16007 MB

PR:

xcl-smoke v1
commit: 55e7beb6de9fcc8817d40d0a663857e3553c3632
gpu: NVIDIA GeForce RTX 5080
title: 8a66b2b2
seconds: 90
exit: 0x0
frames shown: 2527 (PresentX 2527)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16041 MB

Not tested

  • AMD and Intel GPUs; other titles
  • A world load end to end: on this machine the title's compute builds still hold it past the world load (cold caches), with or without this change
  • Pictures: a graphics pipeline still being built draws nothing for those frames; I did not compare frames

AI use

🤖 Generated with Claude Code

pso_async means a graphics pipeline still being built to go on with its
stand-in, which draws nothing, while a worker builds it; only compute
pipelines are waited for (a skipped dispatch would leave its outputs
unwritten). But graphics_bound and ExecuteIndirect called resolve_wait,
which waits for the build - and builds it on the title's thread when no
worker has started it. With lazy pipelines that is every graphics
pipeline's first draw.

On an NVIDIA GPU the retail title of xcl-dev#505 had its threads held 1 - 5 s
per draw in the driver's compiler as its world loaded: 25 graphics binds,
33.2 s in all within 25 s (counted with xcl-dev#899's log), and its hang
watchdog ended the run. A test report on xcl-dev#889 (RTX 4080) found a title
thread held in bind::execute_indirect -> resolve_wait at the abort.

Draws and ExecuteIndirect now take their pipeline with resolve_for_bind:
a graphics one still being built goes to the workers and the draw uses
its stand-in (ExecuteIndirect skips, as it already did for a pending
one); a compute one is waited for as before. With this, the same world
load logged no graphics wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@isaacwingate
isaacwingate marked this pull request as ready for review November 24, 2026 21:31
@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
@freemanovec

Copy link
Copy Markdown

Test report for #1798 on Linux / Wine / RADV, with the retail title of #505. Tested at head 141df97; the rebased head 55e7beb has the same patch.

Without #1798, our longest earlier run (main + the local picks below, without #1798) ended with the title thread in bind::execute_indirect -> pso_async::resolve_wait behind pixel-shader DXC. No present came after 160.6 s. With #1798 on main e9e94ce, no thread dump shows a title thread in execute_indirect or graphics_bound, so the graphics wait is gone here too. The title still does not present after ~150 s or leave the loading screen in 1200 s. The title threads now wait on compute pipelines: real::cl_set_pipeline_state -> resolve_for_bind -> resolve_wait, and dxc::compile called from translated_compute_pso_once on the title thread, ~13 s per 3.7–4.6 MB HLSL compute program.

Tested

Not tested

Written by Claude Code (Claude Opus 5.5) from the runs above.

@vitor127wt

Copy link
Copy Markdown

Instrumented retail comparison — RTX 5070 Ti / Proton

The last logged wait snapshots show 20 graphics bind waits, 5,037 ms total on the base, and zero on the PR. The PR continued to log compute waits. The base completed the 150 s window, and the PR incurred a write access violation in xg::copy_from at 136.517 s.

Tested

Last #899 snapshot Graphics waits Compute waits
Base at 108.056 s 20 / 5,037 ms total / 2,293 ms longest 8 / 13,292 ms total / 8,268 ms longest
PR at 98.462 s 0 / 0 ms 8 / 9,568 ms total / 6,295 ms longest

The base exited 0x0 with 1,999 presents. On the PR the last nonzero two-second bin ended at 136.029 s. At 136.517 s the log recorded 0xc0000005 in ucrtbase.dll+0x171d9. llvm-addr2line mapped xcl-pr1798.exe+0x268225 to core::ptr::copy_nonoverlapping in xcl::hle::xg::copy_from, crates/xcl/src/hle/xg.rs:713. The process ended at 141.294 s with 2,290 PresentX calls in its report. #684 changes that copy routine. This pair locates the fault and leaves its cause open.

Linux scope peaks were 15.17 and 16.00 GiB, with zero OOM kills. The runs are a locally instrumented comparison, and the early exit left the PR run without a completed smoke block.

AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the logs, and drafted this report.

@vitor127wt

Copy link
Copy Markdown

I repeated the retail loading run from my earlier report with and without the #684 fix. The control reproduced the same xg::copy_from crash. With #684 applied, the title reached the 150 s timer and exited with code 0. It had stopped presenting new frames toward the end.

Build Result Last sampled PSO bind waits
#1798 + #899 instrumentation 0xc0000005 at 122.140 s, process end logged at 126.507 s. llvm-addr2line mapped the XCL frame to xg::copy_from at xg.rs:713. 0 graphics, 8 compute (10,133 ms total)
#1798 + same #899 instrumentation + #684 150.000 s, exit 0, 1,701 PresentX calls, 0 crashes, 0 device removals. The activity interval ending at 118.129 s and each later interval recorded zero presents. 0 graphics, 34 compute (94,506 ms total)

The compute times are cumulative across threads and the runs reached different points. Neither scope recorded an OOM kill. Peak scope memory was 15.71 GiB without #684 and 15.07 GiB with it.

Both builds used 55e7beb6de9fcc8817d40d0a663857e3553c3632 with the wait counter from #899 at b2936198896a. The second build also applied the #684 diff 91f9a5e9f031..e56dbc3f4313. The Windows binaries were built with cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl. Each used Linux kit #257's scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 150 with my local retail 1.0.2.1 extraction, XCL_COHERENT_MB=4095, HLSL + DXC, lazy PSOs, A every 3 s, fresh prefixes and private caches, and a 16 GiB cgroup with swap disabled.

RTX 5070 Ti (16 GB, driver 620.73.04), Ryzen 7 9700X, 32 GB DDR5, CachyOS 7.3.5-2-cachyos, Proton Experimental experimental-11.0-20261112-x86_64, vkd3d-proton ec20719452e9, dxil-spirv 7c048638ab59, Rust 1.100.0, LLVM-MinGW 20261117, DXC 1.9.2609.5.

AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, symbolized the crash, and drafted this report.

@Royalflamejlh

Royalflamejlh commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Linux (Wine + vkd3d-proton) + NVIDIA test of 55e7beb on main c4d37be + #684, 2 runs each way into a retail title's world load: with it at least 40 draws went on with their stand-in (the first within 6 s) and at least 128 ExecuteIndirect calls were skipped (the first at 76.6 and 92.9 s), where without it none were. Presents stopped at the end of loading in all four runs, as in part 2 of #662, at 78.1 to 78.2 s with it and 74.3 to 74.9 s without; 2 runs each way do not show that the difference is the pull request's, and no run reached #662's null write.

Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, VKD3D_CONFIG=ignore_shared_fence. RTX 4070 12 GB (driver 615.71.09, 32-lane waves), Ryzen 9 9950X3D, 62 GB RAM. Release, cross-compiled to x86_64-pc-windows-gnu (rustc 1.98.0), DXC 1.9.2609.5, XCL_NETWORK=0, XCL_PSO_PRELOAD=0. Caches as earlier runs left them: about a third of the compute pipelines came from the driver's blob (57 and 58 with it, 68 and 93 without). Retail title 1.0.2.1, the first-run screens completed once and no story progress, A pressed on the account screen at 16.4 to 16.5 s in the four runs of the table. The run with it went first in every pair, and the first of them alone was started with a rebuild. 55e7beb merged onto main c4d37be + #684 (e56dbc3) without conflicts; main is 20cf130 now, with bind.rs unchanged since c4d37be.

Tested

  • cargo test --release -p xcl --lib for a_draw_does_not_wait and execute_indirect_reads under Wine, on the merge: 2 passed, 0 failed.
c4d37be + #684: 100 s / 130 s the same + 55e7beb: 100 s / 130 s
draws with a stand-in (logged as "with PC pipelines"), at the last count line 0 / 0 40 / 40 (33 / 22 at the last count line before presents stopped)
ExecuteIndirect skipped, pipeline still being built (logged as "skipped"), at the last count line 0 / 0 128 / 128; first at 76.6 / 92.9 s
last 2 s with a present 74.3 s / 74.9 s 78.2 s / 78.1 s
dispatches by the last activity line 9676 / 10065 9560 / 9508
compute pipelines made by the end 208 / 303 175 / 168
frames presented 1325 / 1314 1362 / 1404

The count line is printed when one of its counters reaches a power of two, so 40 and 128 are floors (128 means 128 to 255), and the warning for a skipped ExecuteIndirect is printed for the first four only.

In the 100 s run with it the loading pictures at 40, 60, 66 and 74 s were whole (frames kept), the last of them after 23 draws had used a stand-in. I kept no frames of the runs without it. The skipped ExecuteIndirect calls all came after the last kept frame (73.9 s).

A third pair of 100 s runs was slower from the start (A at 22.2 and 18.4 s): presents stopped at 90.2 s with it and 92.2 s without, and neither run had the burst of dispatches or a skipped ExecuteIndirect before it ended.

Read

  • bind.rs:497 (pso_for_draw) is resolve_for_bind, used at :256 for ExecuteIndirect and at :508 for draws (graphics_bound), as the description says; compute still waits. The runs agree: what went on with a stand-in or was skipped is graphics.
  • With it the title made fewer compute pipelines by the end of both runs (175 and 168 against 208 and 303) and slightly fewer dispatches. I do not know why, and 2 runs may not separate it from the spread between runs: by 90 s the 130 s run with it had made 24 compute pipelines, the other three 141, 195 and 219.

Not tested: past the point where presents stop, where a skipped call would show; frames of the runs without it; the preload of #690 on; #1652 and #267, which change the same wait; the rest of the suite; AMD and Intel.

AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the tests and the six runs, compared the logs and frames and wrote this report.

Posted without review by a person: the account owner was away and reads replies later.

@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, ~23 ignored.

Thanks!

@Anon64

Anon64 commented Nov 25, 2026 •

Copy link
Copy Markdown

World-loading run of this PR on a 12 GB 32-lane NVIDIA card, where main's world load now waits on graphics pipelines.

Setup: RTX 3060 12 GB (581.80), Windows 11 26200, 64 GB RAM, release, retail title. A pressed every 4 s from 20 s. XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_PRELOAD=0 XCL_NETWORK=0.

main 80f4819 alone: presents stop at ~72 s and stay 0 to the end of a 420 s run, with no crash.

  • Thread dumps at 150 / 200 / 240 s (from a build with xcl run: thread dumps unwind a copy of each stopped thread's stack #253 for safe dumps) show one title thread in bind… → pso_async::resolve_wait each time.
  • In each dump one xcl-pso-* worker is inside nvgpucomp64.dll, and the rest are idle.
  • The log has driver compile start/finish … graphics PSO … huge, wanted at once (no slot) builds of 1.7–3 s, one after another.
  • No compute PSO is built after ~200 s.

This PR's head 55e7beb merged onto main 80f4819 (clean merge), same settings:

  • presents stop at ~72 s as before, and one frame is presented at 117 s;
  • at 144.9 s the device is removed, 0x887a0006 (DXGI_ERROR_DEVICE_HUNG), logged as D3D12 device removed just before the exception. Then the title ends itself with 0x80000003 at its +0x2474606, the int3 that ends its crash report (Crash 0x80000003 at game_scarlett_master.exe+0x2474606 #1508; @gigabyteZ390's comment there). (smoke.ps1: device removals: 1, crashes: 2);
  • peak commit 32.0 GB.

So on this card the draws no longer wait, and the title gets past the point where main sits. Then the GPU hangs. Whether that comes from draws being dropped while their pipelines build, or from something later that main never reaches, I can't tell from one run.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

@raylitebull

Copy link
Copy Markdown
Member

Code review on 55e7beb:

  • Routing graphics_bound and execute_indirect through pso_for_draw -> pso_async::resolve_for_bind cleanly avoids blocking draws on in-flight graphics PSO builds while keeping compute pipelines synchronous, and a_draw_does_not_wait_for_a_graphics_pipeline_still_being_built covers both paths.
  • This already has cross-vendor test coverage (RADV + NVIDIA + Wine) and PR description is green, but Build and test (Windows, no GPU) has not run on 55e7beb.

Next step to unblock merge: Please rebase onto current main (or re-push) so Build and test (Windows, no GPU) runs on the current head.

@raylitebull

Copy link
Copy Markdown
Member

Update: \Build and test (Windows, no GPU)\ is now green on \55e7beb\ (\CLEAN). One quick AMD confirmation on exact head \55e7beb\ (the prior RADV run was on \141df97) is all that remains before merge.

@JJAutoCompare

Copy link
Copy Markdown

Empirical verification on the Intel Arc A770 for the draw path with pending graphics pipelines.

  • PR head tested from a clean checkout 55e7beb6de9fcc8817d40d0a663857e3553c3632
  • Fetched origin/main 8f5fca5bb9ad6e695093d75294ad2cec023bba60. git merge-tree --write-tree origin/main HEAD completed with exit 0 and no conflicts.

Tested

  • Windows 11 Enterprise Evaluation x64 build 26200.9974 on an AMD Ryzen 7 3800X and Intel Arc A770 (driver 32.0.101.9175). The test log confirmed the A770 backend.
  • Rust 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5 (01b62ad47), unoptimized debug/test profiles with CARGO_INCREMENTAL=0, CARGO_PROFILE_DEV_DEBUG=0, and CARGO_PROFILE_TEST_DEBUG=0.
  • cargo test --workspace --no-run and cargo build --workspace succeeded. The workspace build supplied the end-to-end test title and DLL.
  • cargo test -p xcl --lib hle::d3d12x::bind::tests::a_draw_does_not_wait_for_a_graphics_pipeline_still_being_built -- --exact --show-output ran on the CPU. 1 passed, 0 failed, 0 ignored, with no skip messages. It completed in 1.51 seconds.
  • & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test --workspace -- --test-threads=4 --show-output } stopped after the library binary with exit 101. 893 passed, 18 failed, 23 ignored and 22 GPU skip messages.
  • & 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output } completed all 19 test binaries plus doctests with exit 101. 941 passed, 19 failed, 43 ignored from Cargo. The 25 GPU skip messages below are excluded from coverage. Both the new draw test and the existing pending-pipeline ExecuteIndirect test passed in both workspace runs.
  • The 18 library failures reproduced on the rerun. The most common error was CreateComputePipelineState returning 0x80070057. The additional end-to-end failure was the RSSetDepthBiasX test-title check, which read a blue pixel where it expected green.
19 failing tests
gpu::dxil::ops_tests::doubles_match_cpu
gpu::dxil::ops_tests::groupshared_barrier_and_atomics_run
gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu
gpu::recomp::tests::gpu_clamp_and_omod_per_instruction
gpu::recomp::tests::gpu_f64_class_compare
gpu::recomp::tests::gpu_f64_literal_high_word
gpu::recomp::tests::gpu_f64_compares_with_nan
gpu::recomp::tests::gpu_f64_roots
gpu::recomp::tests::gpu_f64_rounding_and_conversions
gpu::recomp::tests::gpu_f64_math_random
gpu::recomp::tests::gpu_frexp_f64_exp_and_mant
gpu::recomp::tests::gpu_ldexp_f64
gpu::recomp::tests::gpu_float_compares_random
gpu::recomp::tests::gpu_nonfused_mad_and_mac_prevent_fma_contraction
gpu::recomp::tests::gpu_ps_image_sample_offset_implicit_lod_between_mips
gpu::recomp::tests::gpu_rndne_f64
gpu::recomp::tests::gpu_valu_16_and_64_bit
gpu::recomp::tests::gpu_wave64_ps_whole_wave_reductions
test_title_runs_and_game_folder_is_untouched
25 SKIPPED messages from the full workspace run
SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Not tested

  • Baseline execution on origin/main, tests on the merged tree, and retail-title smoke or world-load timing. The run does not establish whether the observed failures reproduce on main.
  • AMD or NVIDIA GPUs, non-Windows hosts, and retail samples gated by unset XCL_SAMPLE_* variables.

AI use

  • T3 Code / Codex (gpt-6.2-sol) fetched and verified the commits, ran the builds and tests, parsed the logs, and prepared this empirical report.

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants