Skip to content

D3D12.X: a refused driver blob is recompiled in the big-compile queue - #774

Closed
CuteBooty wants to merge 1 commit into
xcl-dev:mainfrom
CuteBooty:fix/refused-blob-admission
Closed

CuteBooty wants to merge 1 commit into
xcl-dev:mainfrom
CuteBooty:fix/refused-blob-admission

Conversation

@CuteBooty

Copy link
Copy Markdown

A compute program of 256 KB of DXIL or more is compiled on the background workers one at a time (BIG_COMPILES), after a check for 3 GiB of free commit. Since #636 / #634 that slot is taken only when there is no kept driver blob. When the driver refuses the blob, the program is compiled in full without it. A driver update can refuse many kept blobs in one run, and then several workers can compile at once. Found by reading the merged code; it was not seen in a run.

I searched the open PRs: #567 bounds the commit wait, #214 the number of driver compiles, #714 and #744 change the kept files. None of them changes this path. #214 and #744 touch the same function.

What is in it

  • hle/d3d12x/real.rs: build_reusing builds from the blob first and admits the compile if one is needed, now also after a refusal. The refused blob is dropped before the wait. The slot is held to the end of the function, as before; a title thread and a blob the driver takes still skip it.
  • Unit test a_refused_blob_is_compiled_under_the_admission_of_a_compile: the order of the steps with and without a blob, refused or not. It fails with main's order put into the helper and passes with the change.

A title thread that binds a program whose refused blob a worker is waiting to recompile now waits for that worker's turn, as it already does for a program with no blob.

Tested

  • RTX 3070 8 GB (32-lane waves), NVIDIA 621.24; Ryzen 5 3600, 32 GB; Windows 11 Pro 26200; rustc 1.100.0 MSVC; debug for the suite, release for the runs.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 699 passed, 3 failed, 41 ignored on this tree; 702 passed, 0 failed, 41 ignored on the same tree before one comment was reworded.
  • The 3 failures are placed_title_textures_share_vram_and_preserve_pixels ("cubemap extra_pages must be reused at same va", the one Tests: check cubemap tile reuse independently of idle page reclamation #447 is about) and two tests that then find its lock poisoned. It is on main too: cargo test -p xcl --lib -- --test-threads=4 fails there the same way in 4 of 6 runs on 64b3f35, and in 5 of 6 with this change.
  • SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Regression run

Second of two runs of each build, no input. An earlier pair of runs of this change was discarded because a button was pressed during it, so it went on to another scene.

main:

xcl-smoke v1
commit: 64b3f35599bb7102f55d640e1a791e7d6dd3b175
gpu: NVIDIA GeForce RTX 3070
title: game
seconds: 60
exit: 0x0
frames shown: 1490 (PresentX 1490)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15309 MB

this PR:

xcl-smoke v1
commit: b1fe786c4ca350e96e8bcf067861b7bafa0b1093
gpu: NVIDIA GeForce RTX 3070
title: game
seconds: 60
exit: 0x0
frames shown: 1535 (PresentX 1536)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15714 MB

Not tested

  • A driver refusing a blob: no blob was refused in these runs (at least 16 were taken in each), so the changed path is covered by the unit test only. The memory a burst of refusals takes was not measured.
  • AMD and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found it, wrote the change, the test and this description, and made the runs with me present. Codex with GPT-6.2 Astra reviewed the change by reading it.

🤖 Generated with Claude Code

A compute program of 256 KB of DXIL or more is compiled on the background
workers one at a time (BIG_COMPILES), after a check for 3 GiB of free
commit. That slot was taken only when no kept driver blob was found, so a
program whose blob the driver refused (xcl-dev#634, xcl-dev#636) went on to the full
compile without it: after a driver update several of the workers could do
so at once.

build_reusing builds from the blob first and then admits the compile, if
one is needed: a big one on a worker takes the slot, now also after a
refusal. The slot is held to the end, as before.

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

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of b1fe786c4ca350e96e8bcf067861b7bafa0b1093 on AMD RDNA4. I merged it onto current main 6025201 locally (clean merge).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 705 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 664 passed, 0 failed, 21 ignored
  • 0 SKIPPED; a_refused_blob_is_compiled_under_the_admission_of_a_compile and the other build_reusing_tests pass.

Review: build_reusing tries the kept blob first and, only when the driver refuses it, takes the BIG_COMPILES slot and the commit check before the full compile, so a refused blob no longer compiles outside the slot (the gap #636's reuse path left). I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Independent native Windows NVIDIA RTX 5080 build/test run and code review at head b1fe786c4ca350e96e8bcf067861b7bafa0b1093.

Code Review

  • Clean build_reusing abstraction: tries the cached driver blob without blocking on BIG_COMPILES / wait_for_commit(), and if the blob is absent or refused by the driver, acquires the big-compile admission slot before recompiling and holds it until keep_compute_blob completes. Prevents concurrent ~1.5 GB driver compile bursts after driver updates. No issues found.

Tested

  • Environment: NVIDIA GeForce RTX 5080 (16 GB, wave32, driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC from Windows SDK 10.0.26100.0, debug build.
  • Command: cargo build --workspace && cargo test --workspace -- --test-threads=4
  • Result: 702 passed, 0 failed, 41 ignored (0 new warnings, 0 flakes — placed_title_textures_share_vram_and_preserve_pixels passed on the first run).
  • PR-specific test (ok):
    • hle::d3d12x::real::build_reusing_tests::a_refused_blob_is_compiled_under_the_admission_of_a_compile
  • SKIPPED (2):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64)
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested

  • D3D12 debug layer, AMD/wave64 hardware, live refused-blob burst on a retail title, and release build.

AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.

@CuteBooty

Copy link
Copy Markdown
Author

Closing: #1524, merged today, covers this. On main a refused blob's retry goes through driver_compile_identified with gate_compute_driver_compile(false), so it takes a slot as a build without a blob does (gate cold retries after rejected cache blobs, 724b9e2), and that PR has a test of the gate. Thanks @MesshM and @mastrr9 for the test runs here.

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

@CuteBooty CuteBooty closed this Nov 24, 2026
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