Recompiler: serialize dxc::wait_for_memory slot admission (#2463) #2652
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!2652
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2652"
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?
@fixgep on GitHub · 2026-11-26 05:05 UTC · original
fixgep:fix/dxc-wait-for-memory-race→main· +168 −19 · 1 files · 1 commits · openFixes the TOCTOU admission race in
dxc::wait_for_memory(crates/xcl/src/gpu/recomp/dxc.rs) where concurrent DXC worker wakeups readWORKINGwithout synchronization before callingfetch_add(1), admitting bursts past both the commit headroom check andWANTED_AT_ONCE. Part of #2463, Part of #1566, Part of #1269.What is in it
crates/xcl/src/gpu/recomp/dxc.rs: wrapWORKINGadmission checks (plenty,timed_out,cur == 0, andcur < WANTED_AT_ONCE && wanted()) andfetch_add(1)in aMemoryGatemutex while keepingMemorySlot::droplock-free and sleeping outside the mutex; add synthetic multi-threaded unit tests inmemory_gate_tests.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), debug & release builds on commit88d7b0a1.cargo test -p xcl --lib gpu::recomp::dxc:: -- --test-threads=4: 24 passed, 0 failed, 0 ignored (0 SKIPPED); also 24 passed, 0 failed underXCL_ADAPTER=warp.cargo test -p xcl --lib -- --test-threads=4: 1312 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instruction,v_pk_add_i16clamp mismatch on RTX 3060), 27 ignored (25 SKIPPED: 21no wave64, 3wave32 per-lane refused, 1cannot disable the driver cache).XCL_ADAPTER=warp cargo test -p xcl --lib -- --test-threads=4: 1312 passed, 1 failed (hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_sparesunder parallel adapter/UMA init; passed on default GPU), 27 ignored.cargo test -p xcl --test '*' -- --test-threads=4: 126 passed, 0 failed, 20 ignored across 33 integration test suites (1 SKIPPED:no heap windows).Regression run
Not tested
AI use
MemoryGateandmemory_gate_tests, test/smoke execution, and PR description drafting.@pickles976 on GitHub · 2026-11-26 05:06 UTC · original
Tested: exact clean head
88d7b0a19a276f81491e8430acb5d7dd501ebb1e, Windows MSVC target under Wine 11.0 on Linux, 16 GiB RAM / RTX 4060 Laptop GPU host. FreshCompiling xcl .../xcl-pr2652/crates/xclprovenance confirmed.cargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib memory_gate_tests -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored, 0.14 s. This covers tight synthetic commit headroom, the wanted burst limit, draining concurrent waiters, and the single unwanted progress slot. Tests internally spawn concurrent callers despite the serial test harness. Run through the local Wine wrapper in a scope with MemoryMax=9G / MemorySwapMax=512M.Not tested: real compiler-memory peaks, Windows-native execution, GPU dispatch, retail title, or matched-parent regression. These are CPU synchronization tests with supplied memory values, not proof of Wine's commit telemetry or a hard memory budget. The existing 60-second escape remains; this addresses #2463 item 2, not its separate title-thread driver-compile bypass. No title-safety or FPS claim.
Local log:
.compat-xcl/logs/verify-pr2652-wine-memory-gate.log. AI use: omp / OpenAI Codex GPT-6 Astra, test execution and report; no source changes.@SlopTart on GitHub · 2026-11-26 05:29 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. This PR does not change the mad/mac red on RADV.Targeted run of
low_commit_unwanted_admits_only_one_progress_slot,tight_commit_headroom_bounds_concurrent_admissions,wait_for_memory_drains_concurrent_waiters_within_cap,wanted_burst_never_exceeds_wanted_at_once: 4 passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@oni-swr on GitHub · 2026-11-26 08:31 UTC · original
Independent native AMD test report for #2652 (issue #2463, item 2) on exact head
88d7b0a19a276f81491e8430acb5d7dd501ebb1e, against its exact parentb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7(main, also the merge base). Both were clean detached checkouts with no local changes; PR head and comments were rechecked before posting. This is a test report only, not a source review.Tested
stable-x86_64-pc-windows-msvc), debug build. The suite log namesAMD Radeon RX 7800 XTas the adapter (D3D12.X: backend 'real'). No other xcl process was using the GPU.cargo --locked -j 4. Workspace binaries were built before the tests (cargo build --workspace, thencargo test --workspace --no-run).cargo test -p xcl --lib memory_gate -- --test-threads=1: 4 passed, 0 failed, 0 ignored (low_commit_unwanted_admits_only_one_progress_slot,tight_commit_headroom_bounds_concurrent_admissions,wait_for_memory_drains_concurrent_waiters_within_cap,wanted_burst_never_exceeds_wanted_at_once). I ran them 10 more times with--test-threads=4: 4 passed each time. The tests use supplied memory values, not real compiler memory peaks.cargo test -p xcl --lib dxc -- --test-threads=4: head 48 passed, 0 failed, 3 ignored. Parent 44 passed, 0 failed, 3 ignored. The difference is the 4 new tests, which do not exist on the parent (memory_gateon the parent runs 0 tests).cargo test --workspace --no-fail-fast -- --test-threads=4: 1438 passed, 1 failed, 47 ignored (lib: 1312 passed, 1 failed, 27 ignored).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,seed 722: res[30] = 0x1, CPU 0x7fffffff. It is a baseline failure on this adapter, not caused by the PR.f16_programs_on_the_gpu/f32_programs_on_the_gpucases (refused ... its #1426 semantics differ) andheap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows. None of them touchesdxc.rs. I do not count skips as coverage.memory_gatetests, discarded it, rebuilt the parent from its own path (Compiling xcl ... xcl-2652-src-parent) and reran. The parent counts above come from that rerun.Regression run
scripts/smoke.ps1and used no title or game data.Not tested
AI use
🤖 Generated with Claude Code
@thehollowedone on GitHub · 2026-11-26 08:59 UTC · original · edited 2026-11-26 09:05 UTC
Independent native Windows/NVIDIA test of PR #2652 head
88d7b0a, based on mainb49be18. Clean exact-head checkout; RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC/DXIL 1.8.2502.11. DXIL cache was isolated under this checkout'stargetdirectory.Tested
cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib memory_gate_tests -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored, 0 skips. The tests internally spawn concurrent callers for commit headroom, wanted-burst admission, draining, and the one-progress-slot rule.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,439 passed, 0 failed, 47 ignored across 37 test targets, with 25 explicit GPU skip notices. Skips are not counted as GPU coverage.Not tested: a measured DXC memory peak under retail world load, deliberate system commit exhaustion, AMD/Intel hardware, or my own paired title smoke. These results verify the synthetic admission tests and workspace behavior on this machine; they do not establish a title-level memory or frame-rate improvement.
AI-assisted: Codex (GPT-6.2 Sol) ran the tests and drafted this report.
@throny on GitHub · 2026-11-26 13:08 UTC · original
Two contributors checked independently and found that #1417 solves the same problem (for #2463) in a different way: #1607, group D126. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@fixgep on GitHub · 2026-11-26 14:19 UTC · original
Thanks for flagging #1417, @throny
I checked #1417 (
9a3230fa) against this PR (88d7b0a1) and think it makes sense to keep #2652 open unless maintainers prefer rebasing #1417:README.md(mergeable: false, flagged on Nov 24 and not yet rebased), whereas #2652 touches onlycrates/xcl/src/gpu/recomp/dxc.rsand merges cleanly ontomain.try_admit_compileCAS loop prevents theWORKINGrace forrunning == 0andWANTED_AT_ONCE, but readsGlobalMemoryStatusExoutside the CAS loop and re-evaluateswanted()(lockingPending::demandinpso_async) on every retry. #2652'sMemoryGateevaluatesavail_page_file(),wanted(), and theworkingincrement together while keepingMemorySlot::droplock-free and sleeping outside the mutex.memory_testscoverWANTED_AT_ONCEandrunning == 0; #2652'smemory_gate_testsalso cover tight commit headroom (avail >= need), timeout fallback, and concurrent waiter draining.Happy to defer to whichever approach maintainers prefer.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.