Skip to content

D3D12.X: a build the title already draws without waits for half the commit headroom - #2894

Merged
Prime1997 merged 1 commit into
xcl-dev:nvidia-devfrom
Prime1997:contrib/nv-late-build-half-headroom
Nov 26, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:nvidia-devfrom
Prime1997:contrib/nv-late-build-half-headroom

Conversation

@Prime1997

@Prime1997 Prime1997 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Prime · project thread

With a wait budget (XCL_GFX_PSO_WAIT_MS, XCL_CS_PSO_WAIT_MS) a bind gives up on a pipeline after its budget and the build is no longer wanted, so its huge driver compile waits at the gate for the full commit headroom (3 GB). A build of a pipeline the title already draws or dispatches without (late) now waits for half of it: 1.5 GB for the class from 256 KB, what one such compile takes. Builds ahead of first use and builds nobody used wait as before.

Part of #2688.

Why
On a machine with 4.5 GB of commit left (44.6 of 49.1 GB) 33 such builds stood at the gate, one for 129 s, while 44,596 draws of a retail title's world were left out for want of them. With this change, in the same run: 132 driver compiles against 112, 724 s at the gate against 1,130 s (longest 90 s against 129 s), 35,618 draws skipped against 44,596. The frames shown in the world did not change in that run; the change is about how soon late pipelines arrive.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: headroom_for(bytes, late) used by huge_compile_turn; test a_late_build_waits_for_half_the_headroom.
  • crates/xcl/src/hle/d3d12x/pso_async.rs: build_is_late (the worker's build was given up on by a bind).

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 26200, rustc 1.100.0; debug tests, release smoke.
  • cargo test --locked --workspace --no-fail-fast -- --test-threads=4 with XCL_DXC_DIR set to DXC 1.9.2609.5: 1817 passed, 9 failed, 48 ignored. The 9 failures are the same tests that fail on nvidia-dev eae01502 itself (1816 passed, 9 failed, 48 ignored there, same command): async_compute_pso_registers_real_pso_and_not_standin, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, gpu::recomp::tests::gpu_compute_thread_limits_leave_the_lanes_past_them_out, hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays, hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.
  • SKIPPED on this adapter: 28 (no wave64: 21, per-lane f16 form refused: 3, no dxc.exe: 1, no heap windows (opt-in: XCL_HEAP_WINDOWS=1): 1, cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depend: 1, no heap windows: 1).
  • GitHub's Build and test (Windows, no GPU) fails here on hle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view (the WARP device is removed, 0x887a0005). That test passes on the card above, on this branch and on eae01502, and fails the same way on the other open pull requests against nvidia-dev (kernelx: physical page homes in window 0 first, from the top, keeping 64 MB free (#2867) #2905, for one).

Regression run
A commit of main (b49be183, the last one before the shader preparation screen of #2555, which prepares every record before the title and so does not fit a 60 s run):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 363 (PresentX 363)
presents per 2 s (last 3): 16 17 16
device removals: 0
crashes: 0
peak commit: 15320 MB

The base of this PR, nvidia-dev eae01502:

xcl-smoke v1
commit: eae015021c639866ab061cdff2e9daf8ba9daac5
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 459 (PresentX 459)
presents per 2 s (last 3): 16 17 17
device removals: 0
crashes: 0
peak commit: 15366 MB

This PR's head:

xcl-smoke v1
commit: 7716b4cf9198871a7c387f19844d437f1a9f3ced
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 425 (PresentX 425)
presents per 2 s (last 3): 15 16 15
device removals: 0
crashes: 0
peak commit: 15611 MB

Not tested

  • A machine with plenty of commit headroom: the gate does not hold there, so nothing changes.

AI use
Claude Code (Claude Fable 5.2 and Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/gK3y7WRRY

🤖 Generated with Claude Code

…ommit headroom

With a wait budget (XCL_GFX_PSO_WAIT_MS, XCL_CS_PSO_WAIT_MS) a bind gives up
on a pipeline after its budget and the build is no longer wanted, so its
huge driver compile waits at the gate for the full commit headroom (3 GB).
On a machine with 4.5 GB of commit left (44.6 of 49.1 GB) 33 such builds
stood there, one for 129 s, while 44,596 draws of a retail title's world
were left out for want of them and 2 frames were presented in 200 s.

A late build now waits for half the headroom: 1.5 GB for the class from
256 KB, what one such compile takes. Builds ahead of first use and builds
nobody used wait as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Prime1997 Prime1997 self-assigned this Nov 26, 2026
@saintwolf

Copy link
Copy Markdown

Tested and reviewed commit 7716b4cf (merged cleanly onto nvidia-dev eae01502 alongside #2892, #2893, #2895–#2897, zero conflicts).

Tested

  • Hardware: NVIDIA GeForce RTX 4070 SUPER (12 GiB, driver 32.0.16.2140), AMD Ryzen 7 7800X3D, Windows 11 build 26300, rustc 1.100.0, debug test build
  • cargo test -p xcl --lib hle::d3d12x::real::big_compile_tests -- --test-threads=1: 15 passed, 0 failed, 0 ignored, 0 skipped (including a_late_build_waits_for_half_the_headroom)

Review notes

  • pso_async::build_is_late() and headroom_for(bytes, late) are small, clear, and covered by the new unit test. No issues spotted.

Not tested

  • Full workspace test suite or retail-title smoke run on this PR

AI use

  • Antigravity (exact model name not provided to the agent): reviewed the diff, ran the build/test command, and drafted this report (checked before posting).

@Prime1997
Prime1997 marked this pull request as ready for review November 26, 2026 22:59
@Prime1997
Prime1997 merged commit 3eca291 into xcl-dev:nvidia-dev Nov 26, 2026
2 of 4 checks passed
@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Thanks, the numbers for the 3 GB class are convincing. One question about the giant class, by reading at eff3bcab, not run:

headroom_for (crates/xcl/src/hle/d3d12x/real.rs:4691) halves the headroom of every late build, including those above 6 MiB of DXIL. For those, big_compile_headroom (real.rs:4701) is 512 x the DXIL size, and its doc comment (:4698) says the reason: the driver's compile of a 29.8 MB program grew past 14 GB of free commit before it was stopped. With the halving, a late build of that program waits for about 7.6 GB. The PR's reasoning (1.5 GB is what one such compile takes) covers the floor class. The new test asserts the giant case at 32 MiB * 256 (:4720 onward), so it records the choice but can't catch it.

Was halving the giant class intended? If not, could the halving apply only to the floor (for example, full - (3 << 29) for late builds, or halving only below 6 MiB)? Then a late giant compile would not start with less commit free than it was measured to use.

AI-assisted (Claude Code, Claude Opus 5.5): read the code at eff3bcab and wrote this; nothing was run for these points.

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