Skip to content

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

Open
Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:huge-compile-wait-bound
Open

Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:huge-compile-wait-bound

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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:
  • 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

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

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 (xcl-dev#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
(xcl-dev#2098), so a smaller headroom would not be safe there.

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

Copy link
Copy Markdown

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

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@thehollowedone

Copy link
Copy Markdown

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.

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.

5 participants