D3D12.X: bound the huge-compile gate's commit wait #2130

Closed
github-bot wants to merge 1 commit from gh-pr/2130/head into gh-pr/2130/base
Owner

@⁠Kalmarv on GitHub · 2026-11-25 05:35 UTC · original
Kalmarv:huge-compile-wait-bound → main · +86 −1 · 1 files · 1 commits · closed without merging

Part of #505. A background driver compile of a huge pipeline (256 KiB of DXIL and up, on an xcl-pso* worker) takes its slot first and then sleeps until its commit headroom is free: 3 GiB, or 512× the DXIL above 6 MiB. Nothing but a title thread asking for that pipeline ends the sleep.

@⁠Royalflamejlh's measurement on #505 found this on a 32 GB machine at 27.7–31.5 GiB of process commit:

  • the three preload workers stood in big_compile_turn through the world-load stop in 26 of 27 samples: one in the commit wait, two waiting for its slot;
  • no gated build finished after the last present.

Free commit only fell during the run, so the holder would never have gone on. This PR bounds that wait; the headroom stays as it is. It is independent of #2098, which changes the default number of huge-compile slots in the same file.

What is in it

All of it is in crates/xcl/src/hle/d3d12x/real.rs, one commit.

  • Wait bound: the commit wait in big_compile_turn now ends in two more cases, and the build then goes on with its slot.
    • It has lasted 10 s while no huge driver compile was in flight on any thread. Then nothing XCL builds would give commit back.
    • It has lasted 30 s, whatever is in flight.
    • A warning says which of the two ended it.
    • A new counter, HUGE_IN_DRIVER, counts huge compiles inside the driver. It is a guard around build() in driver_compile_identified.
  • The headroom (big_compile_headroom) is unchanged. Per build it costs far more commit on AMD than on NVIDIA:
    • In #2098's measurement on an RTX 5070 Ti, each extra concurrent cold build of 520–990 KB added ~0.34 GiB of process commit.
    • @⁠bielfreedom's RDNA4 measurement on #2098 found ~2.3 GB of private bytes per extra build for 0.7–1 MB programs, and ~4.1 GB for a single build.
    • So a headroom sized from the NVIDIA figure would not be safe on AMD. The 3 GiB stays.
  • Test: the_commit_wait_ends_alone_or_after_the_longest_wait injects the free-commit reading and the in-flight count. It checks that:
    • with enough free commit, a build goes at once;
    • short of commit with a compile in flight, it keeps waiting;
    • once nothing is in flight, it goes after the time alone;
    • with compiles in flight throughout, it goes after the longest wait.
    • big_compile_turn keeps its signature and calls big_compile_turn_alone, which takes the counter and both times, so the test can inject them.

Tested

  • Ryzen 9 9950X, RTX 5070 Ti 16 GB (NVIDIA 610.74), 31 GiB RAM, 85 GiB commit limit, Windows 11 build 26200, Rust 1.99.0.
  • cargo test -p xcl --lib big_compile_tests (debug): 10 passed, 0 failed, 0 ignored.
  • cargo test --workspace -- --test-threads=4 (debug): 1155 passed, 0 failed, 46 ignored. SKIPPED notices: no native wave64, three unsupported per-lane FP forms, no heap windows, and validation steps the SDK's DXC 1.7 validator can't run. The new test ran and passed.
  • The new test against main's gate (the old wait behind the same signature): it doesn't finish and was killed by a 20 s timeout.

Regression run

scripts/smoke.ps1 -Seconds 120, the same retail title, default settings, on the machine above, release builds from clean trees. main ran at 04:51 UTC and this PR at 05:32 UTC, with the same settings.

main cbc296a (this PR's base):

xcl-smoke v1
commit: cbc296ab65a2661a61e3e2da109134bcd5319f60
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1326 (PresentX 1326)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 29946 MB

this PR, a72af1a:

xcl-smoke v1
commit: a72af1a4c9dfff94d3d4fa95a66b3674647f981f
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 120
exit: 0x0
frames shown: 1324 (PresentX 1324)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 30097 MB

1324 against 1326 frames shown, and 30097 against 29946 MB of peak commit, so no regression. Both runs, main included, presented no frames in their last 6 s, so that stall does not come from this change. The new warning appears in neither runtime log.

Not tested

  • A machine where free commit stays below the headroom, as in #505. This machine has 85 GiB of commit, so the gate's commit wait never ran in the smoke pair. The pair checks only that nothing regresses.
  • Whether a build that goes on short of commit then finishes, or fails in the driver for lack of memory.
  • AMD, Linux.

AI use

Claude Code (Claude Opus 5.5) wrote the change, the test and this description, and ran the tests and the smoke pair.

🤖 Generated with Claude Code

**@⁠Kalmarv** on GitHub · 2026-11-25 05:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2130) `Kalmarv:huge-compile-wait-bound` → `main` · +86 −1 · 1 files · 1 commits · closed without merging Part of #505. A background driver compile of a huge pipeline (256 KiB of DXIL and up, on an `xcl-pso*` worker) takes its slot first and then sleeps until its commit headroom is free: 3 GiB, or 512× the DXIL above 6 MiB. Nothing but a title thread asking for that pipeline ends the sleep. [@⁠Royalflamejlh's measurement on #505](https://git.gtahub.st/github/xcl-dev--xcl/issues/505) found this on a 32 GB machine at 27.7–31.5 GiB of process commit: - the three preload workers stood in `big_compile_turn` through the world-load stop in 26 of 27 samples: one in the commit wait, two waiting for its slot; - no gated build finished after the last present. Free commit only fell during the run, so the holder would never have gone on. This PR bounds that wait; the headroom stays as it is. It is independent of #2098, which changes the default number of huge-compile slots in the same file. **What is in it** All of it is in `crates/xcl/src/hle/d3d12x/real.rs`, one commit. - **Wait bound:** the commit wait in `big_compile_turn` now ends in two more cases, and the build then goes on with its slot. - It has lasted 10 s while no huge driver compile was in flight on any thread. Then nothing XCL builds would give commit back. - It has lasted 30 s, whatever is in flight. - A warning says which of the two ended it. - A new counter, `HUGE_IN_DRIVER`, counts huge compiles inside the driver. It is a guard around `build()` in `driver_compile_identified`. - **The headroom (`big_compile_headroom`) is unchanged.** Per build it costs far more commit on AMD than on NVIDIA: - In #2098's measurement on an RTX 5070 Ti, each extra concurrent cold build of 520–990 KB added ~0.34 GiB of process commit. - [@⁠bielfreedom's RDNA4 measurement on #2098](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2098) found ~2.3 GB of private bytes per extra build for 0.7–1 MB programs, and ~4.1 GB for a single build. - So a headroom sized from the NVIDIA figure would not be safe on AMD. The 3 GiB stays. - **Test:** `the_commit_wait_ends_alone_or_after_the_longest_wait` injects the free-commit reading and the in-flight count. It checks that: - with enough free commit, a build goes at once; - short of commit with a compile in flight, it keeps waiting; - once nothing is in flight, it goes after the time alone; - with compiles in flight throughout, it goes after the longest wait. - `big_compile_turn` keeps its signature and calls `big_compile_turn_alone`, which takes the counter and both times, so the test can inject them. **Tested** - Ryzen 9 9950X, RTX 5070 Ti 16 GB (NVIDIA 610.74), 31 GiB RAM, 85 GiB commit limit, Windows 11 build 26200, Rust 1.99.0. - `cargo test -p xcl --lib big_compile_tests` (debug): 10 passed, 0 failed, 0 ignored. - `cargo test --workspace -- --test-threads=4` (debug): 1155 passed, 0 failed, 46 ignored. SKIPPED notices: no native wave64, three unsupported per-lane FP forms, no heap windows, and validation steps the SDK's DXC 1.7 validator can't run. The new test ran and passed. - The new test against `main`'s gate (the old wait behind the same signature): it doesn't finish and was killed by a 20 s timeout. **Regression run** `scripts/smoke.ps1 -Seconds 120`, the same retail title, default settings, on the machine above, release builds from clean trees. `main` ran at 04:51 UTC and this PR at 05:32 UTC, with the same settings. `main` `cbc296a` (this PR's base): ``` xcl-smoke v1 commit: cbc296ab65a2661a61e3e2da109134bcd5319f60 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 120 exit: 0x0 frames shown: 1326 (PresentX 1326) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 29946 MB ``` this PR, `a72af1a`: ``` xcl-smoke v1 commit: a72af1a4c9dfff94d3d4fa95a66b3674647f981f gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 120 exit: 0x0 frames shown: 1324 (PresentX 1324) presents per 2 s (last 3): 0 0 0 device removals: 0 crashes: 0 peak commit: 30097 MB ``` 1324 against 1326 frames shown, and 30097 against 29946 MB of peak commit, so no regression. Both runs, `main` included, presented no frames in their last 6 s, so that stall does not come from this change. The new warning appears in neither runtime log. **Not tested** - A machine where free commit stays below the headroom, as in #505. This machine has 85 GiB of commit, so the gate's commit wait never ran in the smoke pair. The pair checks only that nothing regresses. - Whether a build that goes on short of commit then finishes, or fails in the driver for lack of memory. - AMD, Linux. **AI use** Claude Code (Claude Opus 5.5) wrote the change, the test and this description, and ran the tests and the smoke pair. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A background huge driver compile took its slot and then slept until
its commit headroom (3 GB, or 512x the DXIL above 6 MiB) was free. The
only way out was a title thread asking for that pipeline. On a 32 GB
machine at ~28 GiB process commit, the holder never went on, and the
other preload workers queued behind it for the rest of the run (#505).

The commit wait now also ends in two cases, and the build goes on with
its slot:
- after 10 s with no huge driver compile in flight on any thread
  (nothing XCL builds would give commit back then);
- after 30 s in any case.
A warning names which of the two ended it.

The headroom itself is unchanged. On RDNA4 each extra concurrent huge
build added ~2.3 GB of private bytes, against ~0.34 GiB on NVIDIA
(#2098), so a smaller headroom would not be safe there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:01 +00:00
github-bot closed this pull request 2026-11-26 05:20:01 +00:00
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-25 06:12 UTC · original

A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with main (1401 here; 1368 and 1370 on the two main runs). No driver compile start / finish or huge driver compile line appears in the log, so no huge compile came up in this run; this is a regression run only.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. a72af1a as it is (based on cbc296a) and main 6e1e2be, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main.

Regression run

main (first run):

xcl-smoke v1
commit: 6e1e2befc7430126b1e7b98b5c3fe93813c866b6
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1368 (PresentX 1368)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: a72af1a4c9dfff94d3d4fa95a66b3674647f981f
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1401 (PresentX 1401)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The second main run: 1370 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the whole test suite on this head, huge driver compiles, low free commit, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-25 06:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/2130#issuecomment-7154549443) A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with `main` (1401 here; 1368 and 1370 on the two `main` runs). No `driver compile start` / `finish` or `huge driver compile` line appears in the log, so no huge compile came up in this run; this is a regression run only. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `a72af1a` as it is (based on `cbc296a`) and `main` `6e1e2be`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Runs in order: main, this PR (with other PRs in between), main. **Regression run** main (first run): ``` xcl-smoke v1 commit: 6e1e2befc7430126b1e7b98b5c3fe93813c866b6 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1368 (PresentX 1368) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: a72af1a4c9dfff94d3d4fa95a66b3674647f981f gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1401 (PresentX 1401) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The second `main` run: 1370 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the whole test suite on this head, huge driver compiles, low free commit, native Windows. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 06: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. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 06:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/2130#issuecomment-7154898791) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-25 09:05 UTC · original

Independent Windows check on a72af1a. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11.

  • Clean cargo build --workspace --offline --locked -j 4 passed.
  • cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4 finished with 1155 passed, 0 failed, 46 ignored, including the stock compile-wait test. Cargo's pass count includes 25 runtime skip notices (20 no native wave64, three unsupported per-lane forms, one unavailable driver-cache control, and one no heap windows).
  • A separate scratch test called the PR's unchanged gate with simulated low commit and idle → busy → idle driver activity. With a 400 ms idle threshold, admission waited 402 ms after idle resumed, 653 ms total, then returned the slot. Dropping the guard released it. Removing only the idle timer reset in a scratch control admitted at 401 ms total and failed the new assertion. The focused filter was local_compile_wait_requires_a_new_idle_interval_after_driver_activity.

The timer probe used shortened thresholds, simulated memory and no native driver compile. No retail smoke was run. AI use: Codex (GPT-6, exact variant unspecified) wrote and ran the scratch test, ran the workspace suite and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-25 09:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2130#issuecomment-7157861615) Independent Windows check on [a72af1a](https://github.com/xcl-dev/xcl/commit/a72af1a4c9dfff94d3d4fa95a66b3674647f981f). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11. - Clean `cargo build --workspace --offline --locked -j 4` passed. - `cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4` finished with **1155 passed, 0 failed, 46 ignored**, including the stock compile-wait test. Cargo's pass count includes 25 runtime skip notices (20 no native wave64, three unsupported per-lane forms, one unavailable driver-cache control, and one no heap windows). - A separate scratch test called the PR's unchanged gate with simulated low commit and idle → busy → idle driver activity. With a 400 ms idle threshold, admission waited 402 ms after idle resumed, 653 ms total, then returned the slot. Dropping the guard released it. Removing only the idle timer reset in a scratch control admitted at 401 ms total and failed the new assertion. The focused filter was `local_compile_wait_requires_a_new_idle_interval_after_driver_activity`. The timer probe used shortened thresholds, simulated memory and no native driver compile. No retail smoke was run. AI use: Codex (GPT-6, exact variant unspecified) wrote and ran the scratch test, ran the workspace suite and drafted this report.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-25 14:19 UTC · original

Closing: #1996 (merged) reworked the huge-build gate this PR changed. Builds that nobody is waiting for now wait for commit before they take a slot, and wanted builds have their own cap. That covers the stall this PR was for. The 10 s / 30 s bound on the commit wait isn't worth carrying alone against the new gate. If a run on a machine short of commit shows the wait hanging again, I'll reopen it against main.

AI use: Claude Code (Claude Opus 5.5) wrote this note.

**@⁠Kalmarv** on GitHub · 2026-11-25 14:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/2130#issuecomment-7165099399) Closing: #1996 (merged) reworked the huge-build gate this PR changed. Builds that nobody is waiting for now wait for commit before they take a slot, and wanted builds have their own cap. That covers the stall this PR was for. The 10 s / 30 s bound on the commit wait isn't worth carrying alone against the new gate. If a run on a machine short of commit shows the wait hanging again, I'll reopen it against `main`. AI use: Claude Code (Claude Opus 5.5) wrote this note.

Pull request closed

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