Skip to content

D3D12.X: a build a submit will wait for is wanted from the put-off call on - #2832

Closed
NWProgramming00 wants to merge 1 commit into
xcl-dev:mainfrom
NWProgramming00:pso/submit-wanted
Closed

NWProgramming00 wants to merge 1 commit into
xcl-dev:mainfrom
NWProgramming00:pso/submit-wanted

Conversation

@NWProgramming00

Copy link
Copy Markdown
Contributor

Part of #2088. It also bears on the world-start stalls in #505, a step on the #1833 roadmap.

A call put off to the submit (need_by_submit, from #2118's dispatches and #2611's graphics ExecuteIndirects) moves its pipeline's build before the workers' queue, but the build stays unwanted until the submit itself waits for it. A huge unwanted build waits in big_compile_turn for both the unwanted slot and 3 GB of commit headroom. While a title loads its world on a machine with little free commit, that headroom does not come. Put-off builds then go through the gate one at a time, each only once its submit waits for it, while the other workers sit in the gate.

This makes the build wanted from the put-off call on. A submit is going to wait for it anyway. A huge one then takes a slot of the wanted cap (XCL_HUGE_PSO_WANTED_CONCURRENCY, default 2) without the commit wait, as the build a submit already waits for does today. The cap still bounds how many huge builds the driver runs at once.

@KDenKC suggested this go in its own PR (#2611 (comment) and the reply below it).

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs: need_by_submit calls want() the first time a pipeline is needed by a submit. The rest is unchanged: the NEEDED queue, the wanted cap, and the commit wait for builds nothing needs yet (preloads and plain background builds).
  • Test a_pipeline_a_submit_needs_is_wanted_before_the_submit_waits: a worker's build sees build_is_wanted() turn true after need_by_submit, with nobody waiting. It fails on b49be18: the build never became wanted.

Tested

  • Windows 11 26300, NVIDIA GeForce RTX 5070 Ti 16 GB (driver 32.0.16.2124) and AMD Radeon RDNA2 iGPU (XCL_ADAPTER=radeon), AMD Ryzen 7 9700X, 31 GB RAM (commit limit 41.7 GB), Rust 1.100 MSVC, release.
  • Failing-first: the new test fails on b49be18 ("a call put off to the submit did not make its build wanted") and passes with the change. All 15 pso_async tests and the 11 big_compile gate tests pass.
  • The whole suite: cargo build --release --workspace, then cargo test --release --workspace --no-fail-fast -- --test-threads=4, with and without XCL_DIRECT_DXIL=all, against base b49be18 on the same machine:
Adapter Mode base b49be18 this PR (e2ecdfa)
RTX 5070 Ti default 1431 passed, 4 failed, 47 ignored 1432 passed, 4 failed, 47 ignored
RTX 5070 Ti XCL_DIRECT_DXIL=all 1431 passed, 4 failed, 47 ignored 1432 passed, 4 failed, 47 ignored
Radeon iGPU default 1434 passed, 1 failed, 47 ignored 1435 passed, 1 failed, 47 ignored
Radeon iGPU XCL_DIRECT_DXIL=all 1434 passed, 1 failed, 47 ignored 1435 passed, 1 failed, 47 ignored

The +1 is the new test. The failing tests are the same on base and PR in every row: fuzz_validate_and_gpu_0..3 on NVIDIA (#1905) and fuzz_validate_and_gpu_1 on the Radeon (#2115). SKIPPED lines: 46 on NVIDIA, 28 on the Radeon, the same on base and PR.

Regression run
Base (main), NVIDIA GeForce RTX 5070 Ti:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5070 Ti
title: title-a
seconds: 60
exit: 0x0
frames shown: 926 (PresentX 926)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17786 MB

This PR, same card:

xcl-smoke v1
commit: e2ecdfa9fad074dfdb015d81659f4c7183fd1bdb
gpu: NVIDIA GeForce RTX 5070 Ti
title: title-a
seconds: 60
exit: 0x0
frames shown: 962 (PresentX 962)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16231 MB

These 60 s runs end in the title's menus, before the world load where put-off builds pile up, so they check that nothing else changed.

Not tested

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, the test and this description, and ran the builds, tests and runs on my machine.

🤖 Generated with Claude Code

…ll on

A call put off to the submit (`need_by_submit`) moved its build before
the workers' queue, but the build stayed unwanted until the submit
itself waited for it. A huge unwanted build waits for commit headroom
in `big_compile_turn`, and while a title loads its world on a machine
with little free commit that headroom does not come: put-off builds
then went through the gate one at a time, each only once its submit
waited for it. The build is now wanted from the put-off call on, so it
takes a slot of the wanted cap (`XCL_HUGE_PSO_WANTED_CONCURRENCY`,
default 2) without the commit wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown

@NWProgramming00 heads-up before reviewers find it: #2579 (@Royalflamejlh, open) makes the same one-line change, p.want() in pso_async::need_by_submit the first time a call is put off. It also removes WANTED_AT_ONCE / the bound in list_x.rs and bind.rs. Yours only touches pso_async.rs and doesn't conflict with #2611, so it may still be the easier one to merge, but the two threads should probably link each other. Our RTX 5090 contrast (base = main + #2611 + #2613, arm = base + this PR, your recipe from 7193653105) is queued, and it applies to the line both PRs share.

AI use: Claude Code (Claude Opus 5.5) compared the two diffs and wrote this.

@thehollowedone

Copy link
Copy Markdown

Independent Windows/NVIDIA check of current #2832 head e2ecdfa9. Clean tracked tree; RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11. XCL_ADAPTER=NVIDIA was set.

  • cargo test --offline --locked -p xcl --lib hle::d3d12x::pso_async::used_tests::a_pipeline_a_submit_needs_is_wanted_before_the_submit_waits -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored on the head. With only the new p.want() call removed locally, the same test failed, 0 passed / 1 failed after its three-second wait (a call put off to the submit did not make its build wanted). I restored the line and confirmed a clean tree before the suite.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,435 passed, 1 failed, 47 ignored across 37 test targets; 25 GPU SKIPPED notices, excluded from coverage. The sole failure was console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk (DXIL not compiled yet). I also ran that test alone on the PR's exact parent b49be183: 0 passed, 1 failed, same error. It reproduces without this change on this machine.

I checked the overlap already raised with #2579: both add p.want() in need_by_submit; #2579 additionally removes the older lookahead calls. This report tests #2832's smaller current head, not the combined variants.

Not tested: a cold world-load timing comparison, retail smoke, AMD/Intel, or Linux/Wine. The focused result verifies demand propagation, not faster first-frame time.

AI use: Codex (GPT-6.2 Sol) reviewed the diff and overlap, ran the tests and local control, checked the baseline failure, and drafted this report.

@NWProgramming00

Copy link
Copy Markdown
Contributor Author

Closing in favour of #2579, which makes the same need_by_submit → want() change. It was opened first and also removes the look-ahead window that the change makes unnecessary. I put my world-load measurements and the caveat about the device removal on #2579. Thanks @KDenKC for linking the two.

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