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

Closed
github-bot wants to merge 1 commit from github-bot/gh-2832 into main AGit
Owner

@⁠NWProgramming00 on GitHub · 2026-11-26 16:31 UTC · original
NWProgramming00:pso/submit-wanted → main · +34 −1 · 1 files · 1 commits · closed without merging

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 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.

  • The retail title of #505, world-load runs (600 s, XCL_NETWORK=0 XCL_ACTIVITY=1, RTX 5070 Ti). These were made with the same change behind a local switch, on b49be18 + #2611 + #2613, from the same cache copy. Details: #2611
    • Without it: 78 graphics driver builds after world entry, 260.9 s in the driver over 263 s, i.e. one at a time. Their gate waits add up to 3,731 s. A thread dump showed 13 of 15 workers in big_compile_turn and the title's submit in record_deferred → resolve_wait.
    • With it: 97 cold graphics builds after world entry, 426.5 s in the driver over 212 s, i.e. about 2 at a time (the wanted cap).
    • Neither run got frames back after world entry. The run with it ended at 427 s in D3D12 device removed: 0x887a0005, with no DRED or shader-code count. I cannot tell whether that is #2403's shader-code heap, reached sooner because pipelines are made faster, so I do not claim either way.
    • On main alone the change reaches #2118's put-off dispatches. I have no run that isolates their gate waits.

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

  • A card with more free commit, where the gate's commit wait rarely engages. @⁠KDenKC offered an RTX 5090 run as a contrast.
  • AMD on the title, more world-load runs, and whether builds two at a time bring the #2403 heap limit closer on NVIDIA.

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

**@⁠NWProgramming00** on GitHub · 2026-11-26 16:31 UTC · [original](https://github.com/xcl-dev/xcl/pull/2832) `NWProgramming00:pso/submit-wanted` → `main` · +34 −1 · 1 files · 1 commits · closed without merging 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 `ExecuteIndirect`s) 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 (https://git.gtahub.st/github/xcl-dev--xcl/pulls/2611 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. - **The retail title of #505**, world-load runs (600 s, `XCL_NETWORK=0 XCL_ACTIVITY=1`, RTX 5070 Ti). These were made with the same change behind a local switch, on `b49be18` + #2611 + #2613, from the same cache copy. Details: https://git.gtahub.st/github/xcl-dev--xcl/pulls/2611 - Without it: 78 graphics driver builds after world entry, 260.9 s in the driver over 263 s, i.e. one at a time. Their gate waits add up to 3,731 s. A thread dump showed 13 of 15 workers in `big_compile_turn` and the title's submit in `record_deferred → resolve_wait`. - With it: 97 cold graphics builds after world entry, 426.5 s in the driver over 212 s, i.e. about 2 at a time (the wanted cap). - Neither run got frames back after world entry. The run with it ended at 427 s in `D3D12 device removed: 0x887a0005`, with no DRED or shader-code count. I cannot tell whether that is #2403's shader-code heap, reached sooner because pipelines are made faster, so I do not claim either way. - On `main` alone the change reaches #2118's put-off dispatches. I have no run that isolates their gate waits. **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** - A card with more free commit, where the gate's commit wait rarely engages. @⁠KDenKC offered an RTX 5090 run as a contrast. - AMD on the title, more world-load runs, and whether builds two at a time bring the #2403 heap limit closer on NVIDIA. **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](https://claude.com/claude-code)
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 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:32:55 +00:00
Author
Owner

@⁠KDenKC on GitHub · 2026-11-26 16:47 UTC · original

@⁠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.

**@⁠KDenKC** on GitHub · 2026-11-26 16:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2832#issuecomment-7198090044) @⁠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.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-26 16:55 UTC · original

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.

**@⁠thehollowedone** on GitHub · 2026-11-26 16:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/2832#issuecomment-7198269647) Independent Windows/NVIDIA check of current [#2832 head `e2ecdfa9`](https://github.com/xcl-dev/xcl/commit/e2ecdfa9fad074dfdb015d81659f4c7183fd1bdb). 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`](https://github.com/xcl-dev/xcl/commit/b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7): **0 passed, 1 failed**, same error. It reproduces without this change on this machine. I checked the overlap already raised with [#2579](https://git.gtahub.st/github/xcl-dev--xcl/pulls/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.
github-bot closed this pull request 2026-11-26 17:02:14 +00:00
Author
Owner

@⁠NWProgramming00 on GitHub · 2026-11-26 16:57 UTC · original

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.

**@⁠NWProgramming00** on GitHub · 2026-11-26 16:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/2832#issuecomment-7198305883) 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.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.