Skip to content

D3D12.X: compute programs of 4 MB DXIL or more build in their own queue - #1278

Draft
bstillbstill wants to merge 1 commit into
xcl-dev:mainfrom
bstillbstill:d3d12x/giant-compile-lane
Draft

bstillbstill wants to merge 1 commit into
xcl-dev:mainfrom
bstillbstill:d3d12x/giant-compile-lane

Conversation

@bstillbstill

Copy link
Copy Markdown

A compute program of 4 MB of DXIL or more no longer holds BIG_COMPILES, the one slot for big background driver compiles. It waits in a queue of its own (also one at a time), so the 0.3 – 1 MB programs a title binds keep being built beside it. Part of #505.

The newer retail title (1.0.2.1) has three screen-probe compute programs whose console code is unrolled (88 863 instructions for the biggest): records 22 616 – 22 618 of shaders.rpf, indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes_9083c094_Wrapped, …ActivateProbesTarget_534f271f… and …ActivateRays_d60186e6…. Translated they are 29 052, 28 940 and 13 774 KB of DXIL (3 – 6 % less with #680's heap windows; ActivateProbes 22 815 KB without the wave64 split). The NVIDIA driver alone (one thread, no title running) had not built ActivateRays after 14 minutes, at 4.6 GB and growing. A preload starts it 4.4 – 6.5 s into every run of the title here; in BIG_COMPILES it then holds the only slot to the end of the run, and the title's binds of other big programs run out of time behind it.

What is in it

  • D3D12.X: compute programs of 4 MB DXIL or more build in their own queue – crates/xcl/src/hle/d3d12x/real.rs: GIANT_DRIVER_COMPILE (4 MB), GIANT_COMPILES (one at a time), compile_slots(len) picks the queue; test a_giant_driver_compile_does_not_hold_the_big_compile_slot.

Tested

  • NVIDIA GeForce RTX 3090 Ti (driver 32.0.16.2101, 32-lane waves), Intel Core i9-13900K, 32 GB RAM, Windows 11 Pro 10.0.26300, Rust 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.9.2609.5; debug for the tests, release for the title runs.

  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on eb03e7f: 742 passed, 0 failed, 41 ignored. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).

  • The new test fails when compile_slots sends every compile to BIG_COMPILES, and passes with the change.

  • Title runs, newer retail title 1.0.2.1, 300 s each, the same scripted A presses, the two settings in turn, three runs each. Local test build: main 6bac4b4 + D3D12.X: bound compute pipeline waits so slow compiles do not trip wa… #533 + D3D12.X: sparse readbacks don't wait for a queue held by a later signal #433 + local diagnostic logging + this change behind a local switch (XCL_GIANT_LANE=0 turns it off). In every run the only driver compile of 2 MB or more was ActivateRays, from a preload.

    big compiles finished after 60 s (not from a blob) last compute pipeline finished last frame shown
    with the change 892 KB at 99 s; 1 001 KB at 146 s; none 99 / 67 / 146 s 136 / 144 / 149 s
    without none in all three 67 / 67 / 65 s 128 / 123 / 167 s

    The title shows only subtitles over a black screen in its first cutscene in all of these runs (as reported above on Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505).

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: NVIDIA GeForce RTX 3090 Ti
title: My1stGame
seconds: 60
exit: 0x0
frames shown: 1649 (PresentX 1649)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16569 MB

This PR:

xcl-smoke v1
commit: eb03e7f3b55d28907def47b1e91627a07fa9806b
gpu: NVIDIA GeForce RTX 3090 Ti
title: My1stGame
seconds: 60
exit: 0x0
frames shown: 1651 (PresentX 1651)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17427 MB

No input in either run (intro and menus). The preload of ActivateRays starts about 4.5 s in, so the new queue is used in both 60 s of this PR's run. Made with smoke.ps1 plus a local fix that reads the log of a run that does not exit by itself (an earlier main run hung in end_title after its 60 s); these runs exited by themselves, so main's script gives the same blocks.

Not tested

AI use

  • Claude Code (Claude Opus 5.5): found and measured the programs, wrote the change, the test and this description, ran the tests and the title runs on the hardware above.

🤖 Generated with Claude Code

A retail title binds three screen-probe compute programs whose console
code is unrolled (88 863 instructions for the biggest); translated they
are 13 - 29 MB of DXIL. The NVIDIA driver alone had not built the
smallest of them (13 774 KB) after 14 minutes on an RTX 3090 Ti. A
preload starts it about 4.5 s into a run and, as a big compile, it holds
BIG_COMPILES (one slot) to the end of the run: in three runs no other
compute pipeline of 256 KB or more was built after 67 s, and the
title's binds of 0.3 - 1 MB programs ran out of time behind it.

Programs from GIANT_DRIVER_COMPILE (4 MB) on now wait in GIANT_COMPILES,
one at a time, beside BIG_COMPILES. In three runs of a local test build
with the same change, big compiles finished after 60 s in two (892 KB
at 99 s, 1 001 KB at 146 s), against none in three runs without it.

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

Copy link
Copy Markdown
Contributor

Heads-up: conflicts with current main in crates/xcl/src/hle/d3d12x/real.rs — needs a rebase before merge.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…all#1248, ivall#1250, ivall#1265, ivall#1273, ivall#1277, ivall#1278

Fix sudden RAM OOM during world loading under XCL_PSO_WAIT_MS and integrate 6 new upstream PRs:
- pso_async.rs: track active waiters via WantGuard so build_is_wanted() drops back to false once resolve_within times out, preventing all background workers from bypassing BIG_COMPILES and commit-memory guards simultaneously (adds unit test a_timed_out_bind_clears_wanted_demand).
- ivall#1248: pack <= 4 KiB sampled textures into 4 KiB heap slots instead of 64 KiB tiles (~768 MiB VRAM saved).
- ivall#1250: late_release seals/waits only when nothing is in flight.
- ivall#1265: default SRVs of multisampled depth buffers use Texture2DMS/Texture2DMSArray.
- ivall#1273: skip budgeted bind waits when all workers are busy / build is queued behind others.
- ivall#1277: exit sparse::upload_dirty cleanly if staging ring fence wait times out.
- ivall#1278: isolate >= 4 MiB DXIL compute driver compiles in a dedicated GIANT_COMPILES queue.

Assisted-by: Antigravity (Google DeepMind)
@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
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.

3 participants