D3D12.X: enforce hard concurrency cap on wanted >= 256 KB huge PSO compiles #1996
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1996
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1996/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@raylitebull on GitHub · 2026-11-25 00:32 UTC · original
raylitebull:fix/big-compile-hard-cap→main· +127 −68 · 1 files · 1 commits · merged 2026-11-25 10:49 UTCEnforces a hard concurrency cap on concurrent wanted huge (
>= 256 KBDXIL) driver PSO compiles (Slots::wanted_most, configured viaXCL_HUGE_PSO_WANTED_CONCURRENCY, default2, clamped toXCL_HUGE_PSO_CONCURRENCY..=64) while capping>= 4 MiB(GIANT_COMPILES) at1, preventing bursts of lazy compute binds from stacking driver-compiler commit into OOM.Part of #1833.
What is in it
crates/xcl/src/hle/d3d12x/real.rs(+127 / -68):huge_pso_wanted_concurrency()&Slots::wanted_most(): wanted huge builds still bypass the 3 GiB commit headroom wait and can overtake an unwanted background compile (up towanted_most), while bursts abovewanted_mostqueue cleanly without stacking memory.big_compile_turn: checkscommit_free()in the wait loop before acquiringSlotGuard(*n += 1) so an unwanted commit-blocked compile never holds aGIANT_COMPILESslot while sleeping under low free commit.SlotGuard::drop: switches tonotify_all()so waiting wanted compiles wake even behind unwanted waiters.big_compile_tests(11/11pass, includingunwanted_commit_waiter_does_not_starve_wanted_compile,wanted_builds_bypass_commit_and_unwanted_slot_but_respect_hard_cap, andwanted_burst_is_hard_capped_to_wanted_most).Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto656c0e8(ae00ec7).cargo check --workspace --tests: passed.cargo test -p xcl --lib big_compile_tests: 11 passed, 0 failed.scripts/smoke.ps1regression pair on AMD Radeon RX 9070 (@Toons29): passed (0 device removals, 0 crashes).Regression run
60 s
scripts/smoke.ps1pair on exact headae00ec7vsmain(AMD Radeon RX 9070, driver 32.0.32029.2010, Windows 11 26300, release,XCL_NETWORK=0on a retail title), contributed by@Toons29:main:
this PR:
Not tested
scripts/smoke.ps1pair onae00ec7, fullcargo test --workspacesuite, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use
@upipibi on GitHub · 2026-11-25 00:37 UTC · original
Overlap note, from reading the diffs (not run): #1924 (Rednaxeh, opened earlier) changes the same huge-compile gate in
real.rs. Both PRs reworkgate_compute_driver_compileandbig_compile_turn, andgit merge-treeof this head with #1924's reports a conflict there. The approaches differ. #1924 makes a background compile wait for commit in proportion to the program's size. This PR caps how many large compiles run at once (2, or 1 at 4 MiB or more). Settling on one, or rebasing one onto the other, would avoid the gate being rewritten twice.AI-assisted (Claude Code).
@raylitebull on GitHub · 2026-11-25 00:47 UTC · original
Thanks for flagging the overlap, @upipibi! Full credit to #1924 (@Rednaxeh) for the commit-size /
XCL_HUGE_PSO_RAM_SHAREbackground admission gate.#1996 addresses an orthogonal axis in
big_compile_turn: enforcing a hard concurrency cap on bursts of wanted>= 256 KBcompiles (XCL_HUGE_PSO_WANTED_CONCURRENCY,slots.wanted_most()) so concurrent lazy binds cannot spike driver commit into OOM. If #1924 lands first, we will rebase #1996 cleanly on top of it so both protections compose together.@gsucristo on GitHub · 2026-11-25 00:57 UTC · original
Technical review findings:
Blocking
wantedcompiles behind commit-blockedunwantedcompiles (real.rs,big_compile_turn):SlotGuard(*n += 1) before enteringwhile !commit_free() { if wanted() { return Some(slot); } std::thread::sleep(LOOK); }.< 3 GiB), an unwanted compile holds its slot indefinitely while sleeping.GIANT_COMPILES(most: 1, wanted_most: 1), a single commit-blocked unwanted giant compile fills*n == 1 == wanted_most, so anywantedgiant compile blocks forever in*n < cap(1 < 1). The same deadlock happens onBIG_COMPILESwheneverXCL_HUGE_PSO_CONCURRENCY == XCL_HUGE_PSO_WANTED_CONCURRENCY.commit_free()inside the wait loop before incrementing*nfor!wanted()builds so an unwanted compile never holds a slot while waiting for commit headroom.Minor
big_compile_turnnow always returnsSome(SlotGuard), making the(true, true, false) => ", huge, wanted at once (no slot)"arm ingate_noteunreachable.@raylitebull on GitHub · 2026-11-25 01:14 UTC · original
Rebased cleanly onto
656c0e8(ae00ec7, including#1774) and fixed the blocking deadlock caught by@gsucristo:big_compile_turnnow checkscommit_free()inside its wait loop before acquiringSlotGuard(*n += 1), so an unwanted commit-blocked compile never holds aGIANT_COMPILES(1/1) slot while sleeping under low free commit.gate_note.cargo check --workspace --testsandcargo test -p xcl --lib big_compile_tests(11 passed, 0 failed, includingunwanted_commit_waiter_does_not_starve_wanted_compileandwanted_burst_is_hard_capped_to_wanted_most).@futurepro62 on GitHub · 2026-11-25 01:02 UTC · original · edited 2026-11-25 01:23 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
c969032(on its base6567c5f).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 987 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.wanted_burst_is_hard_capped_to_wanted_most.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 997 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@Anon64 on GitHub · 2026-11-25 01:47 UTC · original
Regression run for this PR: head
c969032, based onmain80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
80f4819:this PR:
No device removals or crashes; 95 % of main's frames, 115 % of its peak commit.
Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings:
XCL_DIRECT_DXILandXCL_HEAP_WINDOWSunset).Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@Anon64 on GitHub · 2026-11-25 02:00 UTC · original
A data point on how many huge compiles at once help, from a world-loading run on a 12 GB 32-lane card. RTX 3060 12 GB (581.80), Windows 11 26200, 64 GB RAM, release build of
main3da2abb(not this PR). Retail title, A pressed every 4 s, 420 s.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PSO_PRELOAD=0,XCL_HUGE_PSO_CONCURRENCY=4.driver compile finishlines) per 100 s: 11 (45 s of driver time), 29 (69 s), 18 (98 s), 11 (206 s), then 3 in the last 20 s. So about two overlap in the later windows, and they are still going at 420 s.main80f4819+ #1798 with the same settings and the default of 1 had a single pipelinegated (waited 37588 ms)for the slot.More slots let several of these compiles overlap on this machine, but they did not get the title further: what it waits for is the next pipeline it binds, and there are many of them, each taking seconds. One run.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@JJAutoCompare on GitHub · 2026-11-25 02:49 UTC · original
Empirical verification — PR #1996 (
ae00ec73ed21cc4d266a8f42649eaeae3387ae84)Tested clean detached PR head
ae00ec73ed21cc4d266a8f42649eaeae3387ae84on STOR-WINLAB.Environment
26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver32.0.101.9175, wave range 8–32,DoublePrecisionFloatShaderOps=0,XCL_ADAPTER=A770,d3d12SDKLayers.dllabsent).rustc 1.100.0 (0ef1bc386 2026-11-09)(CARGO_INCREMENTAL=0, debug info 0). Standalone DXC/DXIL1.9.2609.5was onPATH; the suite logged Windows SDK DXC/DXIL1.9.2602.17.Tested
cargo build --workspaceandcargo test --workspace --no-runexited 0 outside the GPU lock.cargo test -p xcl --lib big_compile_tests -- --nocapture: 11 passed, 0 failed, 0 ignored, 0 skipped (also passed in full suite; verified 12 wanted workers peaked at 2 concurrent entrants, a 3rd waited for a slot, and a commit-blocked unwanted compile left the 1-slot lane open to a wanted compile).cargo test --workspace --no-fail-fast -- --test-threads=4(underInvoke-ArcTest.ps1, exited 101): 1,038 passed, 26 failed, 45 ignored across 20 test targets, with 23SKIPPEDlines across 13 tests (excluded from coverage; 18 wave64, 3 refused wave32 f16 lowerings, 1 driver-cache disable unavailable, 1 heap-window fallback; libtest pass counts include captured early returns).xcl --libshader/DXIL tests (21CreateComputePipelineState0x80070057+ 4 shader output assertions) and 1 ine2e(test_title_runs_and_game_folder_is_untouched,RSSetDepthBiasX#94 blue vs green). All unrelated to the big-compile gate (no matchedmainbaseline).Not tested
mainA/B baseline, live driver bursts of large PSOs under low commit, D3D12 debug layer, release profile, and forcing DXC1.9.2609.5.AI use
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1996-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 03:42 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!
@Toons29 on GitHub · 2026-11-25 03:45 UTC · original
Regression run of
ae00ec73on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainoncbc296ab, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 101 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@akimfomin on GitHub · 2026-11-25 03:48 UTC · original
I used PortBridge to check a separate admission case on your exact
ae00ec73head. The wanted cap and the same-lane change are working as intended in the extracted gate. The two size lanes can still independently see the same available commit before either driver call grows memory.With 3,328 MiB reported free, the exact #1996 gate let two background jobs overlap (1,536 + 2,048 MiB in the model). A shared reservation on both PSO paths deferred the second until the first released. Controls kept the wanted cap and bypass, still allowed overlap with enough budget, and verified unwind release.
Source patch, exact gate extraction and CPU results. This is a concurrency reproduction with controlled estimates. I have no driver-memory or startup comparison for the patch. The estimate can count memory already committed by an active job, analogous to the growth-accounting concern in #139. AI-assisted PortBridge research (OpenAI Codex).
@raylitebull on GitHub · 2026-11-25 10:38 UTC · original
Thanks @Toons29 for running and sharing the exact-head 60 s
scripts/smoke.ps1pair onae00ec7(0 device removals, 0 crashes) — added to the PR description!