Recompiler: prioritize wanted DXC compiles and reserve worker headroom #2423
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!2423
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2423"
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?
@ChalanaGimhanaX on GitHub · 2026-11-25 18:26 UTC · original
ChalanaGimhanaX:recomp/dxc-priority-queue→main· +377 −31 · 2 files · 1 commits · openPart of #1164
Part of #1452
Part of #1833
What is in it
Replaces the single FIFO
mpsc::channelindxc::pool()(crates/xcl/src/gpu/recomp/dxc.rs) with a priority queue (Queue<J>) so DXC compiles that a title thread is actively waiting on (wanted) are never stuck behind queued or long-running background compiles:crates/xcl/src/gpu/recomp/dxc.rs): Workers always pop the oldest currently-wantedjob ahead of background jobs, even on a single-worker pool (XCL_DXC_THREADS=1).state::boot().is_some()andtotal_workers >= 2, background compiles are capped attotal_workers - wanted_reserve(total_workers)(reserving(total / 3).clamp(1, 4).min(total - 1)workers for wanted compiles, while wanted compiles may use any free worker). When no title is running (xcl shaders --precompile),reserveis0so offline precompilation still uses every worker.crates/xcl/src/hle/d3d12x/pso_async.rs): WhenPending::want()flipsdemand.wantedfromfalsetotrue, it drops thedemandlock first (preserving strictqueue -> demandlock order) and callsdxc::notify_wanted()(a no-op if the DXC pool has not been started yet) so any idle reserved worker immediately picks up an already-queued compile.BgSlotguard always decrementsbg_activeand wakes waiting workers on drop, andQueueState::total_workerstracks the actual spawned worker count (closing cleanly if0spawned).dxc::Jobalready carriedwanted: Wantedsowait_for_memorylets title-waited compiles bypass low-commit throttling, butpool()still queued every compile into one FIFOmpsc::channelacross all workers. During retail world load, title threads waiting on compute pipelines can queue behind background DXC compiles for 13–25 s (#1164), contributing to 30 s watchdog terminations (#1452).Tested
32.0.16.1714), Intel Core i5-10400F (12 threads), 16 GB RAM + 43 GB pagefile, Windows 11 Pro Build 26200,rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.8.2502.11(Windows SDK10.0.26100.0), release for focused tests and smoke runs.origin/main2898511(which includes#2420fixing the pre-existinga_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barriertest failure that tripped CI on68a284a).63ea17f(cargo test --release -p xcl --lib -- gpu::recomp::dxc::pool_tests gpu::recomp::dxc::cache_tests hle::d3d12x::pso_async::used_tests a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier --test-threads=1): 31 passed, 0 failed, 0 ignored:gpu::recomp::dxc::pool_tests: 6 passed, 0 failed (wanted_reserve_scales_with_worker_count,wanted_job_jumps_ahead_of_queued_background_jobs,wanted_job_runs_immediately_while_background_workers_are_saturated,queued_background_job_promoted_to_wanted_wakes_reserved_worker,offline_mode_uses_all_workers_for_background_jobs,bg_slot_recovers_after_worker_panic).gpu::recomp::dxc::cache_tests: 11 passed, 0 failed.hle::d3d12x::pso_async::used_tests: 13 passed, 0 failed.gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier: 1 passed, 0 failed.4ac4637(cargo test --workspace --no-fail-fast -- --test-threads=4): 1,295 passed, 1 failed (the pre-existing68a284atest now fixed on2898511), 46 ignored (37SKIPPEDlines on wave32 RTX 3060 / no Windows Developer Mode).Regression run
Paired 60 s retail smoke runs (
.\scripts\smoke.ps1 -Game <retail> -Seconds 60, release build, same title and caches):PR head (
63ea17f):main(2898511):Not tested
dxc::pool_tests).4ac4637to63ea17f(only the 31 targeted tests above + paired 60 s smoke runs were rerun on63ea17f).AI use
Google Antigravity (Gemini 4 Neon) wrote the implementation, unit tests, and this description, rebased cleanly onto
origin/main2898511, and ran the tests and paired smoke runs on this machine; I reviewed and approved before updating.@emirduran707 on GitHub · 2026-11-25 19:00 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
4ac4637ad27d0ed3b731a2e8377f5abab0dd4dd3(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1293 passed, 3 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). Alldxcandpso_asynctests passed.main68a284a:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722) andfuzz_validate_and_gpu_3(seed 1599) on this GPU, plusgpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(from50a9fde/ #2074).Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 19:47 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1 real failure, deterministic (also fails--test-threads=1, 1219/1):The lowered program is missing an expected group barrier (or emits one where none is expected). Needs a fix before merge.
— Devin
@ChalanaGimhanaX on GitHub · 2026-11-25 19:54 UTC · original
Thanks for running verification! That failure is from a stale base before
#2420(c828d8c): the assertion"group barriers in the program"atlower_dxil.rs:1155was replaced by#2420("group barriers after entry branch"at line 1156) to fix the pre-existing50a9fde/#2074failure onmain.This PR only touches
dxc.rsandpso_async.rs, and head63ea17fis already rebased onto2898511(which includesc828d8c), withCIgreen anda_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrierpassing. Could you re-run against63ea17f+ currentmain?@thehollowedone on GitHub · 2026-11-25 21:28 UTC · original
Independent Windows/RTX 3080 Ti check of #2423 head
63ea17f, following the request for a current-head rerun. Clean detached checkout; no source changes.Tested — Windows 11 Pro build 26300, RTX 3080 Ti 12 GB / driver 621.35, Ryzen 7 9800X3D, 32 GB RAM, Rust 1.99.1 MSVC, DXC 1.8.2502.11.
cargo build --offline --locked --release --workspacepassed.cargo test --offline --locked --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1,369 passed, 0 failed, 46 ignored; 25 explicit SKIPPED (21 no wave64, 3 unsupported per-lane forms, 1 no heap windows). All sixgpu::recomp::dxc::pool_testspassed, including queued-job promotion and reserved-worker wakeup.cargo test --offline --locked -p xcl --lib shaders::tests::pso_measurement_compiles_an_exact_synthetic_record -- --exact --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 skipped.ShaderCacheControlaccepted the cache-off run; the small synthetic compute PSO reported 3,640 B DXIL, 14 ms DXC and 0.005 s driver creation. This is tool qualification, not a measurement of this scheduling change.Not tested — a cold multi-minute retail world-load pair, the actual
pool()→Pending::want()promotion glue under a saturated title workload, or first-playable-frame timing. The existing queue tests use synthetic workers; this suite result does not close that reviewer’s integration-test gap.AI-assisted: Codex (GPT-6, exact variant unavailable) reviewed the paths, ran these tests, and drafted this report.
@oni-swr on GitHub · 2026-11-25 22:09 UTC · original
Independent AMD report for
63ea17f3cf85fc0b1c4f4ef3973f1e479df7b530.Tested
XCL_ADAPTER=radeon. Exact PR head (not a local merge ontomain); main at the time was6d12f58a.cargo test --workspace --no-fail-fast -j 4 -- --test-threads=4: 1368 passed, 1 failed, 46 ignored. The one failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722:res[30] = 0x1, CPU 0x7fffffff); it fails identically onmain6d12f58aon this adapter (cargo test -p xcl --lib fuzz_validate_and_gpu_1), so it is not caused by this PR.f16_programs_on_the_gpu/f32_programs_on_the_gpuper-lane cases refused forV_MUL_F16,V_PK_MUL_F16orV_CVT_F16_F32, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).gpu::recomp::dxc::pool_tests(6 tests) all passed.Not tested
scripts/smoke.ps1/ a retail title (no regression run), other adapters, NVIDIA. No game data was used.AI use
Claude Code (Claude Sonnet 5.5) ran the tests and wrote this report. No game files, dumps or shader names are included.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.