Recompiler: fix the race for the last wanted DXC slot #1364
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!1364
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1364"
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?
@Gevroska on GitHub · 2026-11-24 15:16 UTC · original
Gevroska:xcl-local/dxc-wanted-slot-race→main· +46 −2 · 1 files · 1 commits · openWhat is in it
With five DXC compiles running, two workers could both see the sixth slot available and start a wanted compile. The reservation now uses an atomic compare-and-exchange so only one worker takes that slot. The six-slot rule applies to wanted compiles admitted under memory pressure. Workers can still enter when commit headroom is sufficient or after the one-minute timeout.
The out-of-memory regression reported in #534 remains open. Whether a lower concurrency limit helps that workload needs a separate comparison.
Tested
RTX 3080, driver 616.92, Ryzen 7 5700X, Windows 11 25H2, Rust MSVC 1.100.0. scripts/test.ps1 --nocapture: 752 passed, 0 failed, 41 ignored; four runtime skips (wave64 and debug layers). The contention regression failed before and passed after the fix.
An independent contributor ran the workspace suite on this head with an RTX 5070 Ti and an RDNA2 iGPU. Each run reported 752 passed, 0 failed and 41 ignored. Hardware and test details
Regression run
Matched offline release startup runs, separate cold DXIL caches, shared driver cache.
Not tested
Retail contention, the one-minute timeout in isolation, and the effect on the reported out-of-memory failure or gameplay.
AI use
Codex GPT-6.2 Sol authored and tested the change. GPT-6.1 Terra medium checked overlap and reproduced the baseline failure. GPT-6.2 Sol high independently reviewed the patch and evidence.
I reviewed the change manually.
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@pickles976 on GitHub · 2026-11-24 15:20 UTC · original
Review: this correctly closes the count race — the old code could admit more than
WANTED_AT_ONCEwanted compiles because the fast path (WORKING.load < WANTED_AT_ONCE && wanted()) and theplenty || 60 sbranch eachfetch_addindependently, and the CAS(0,1) fallback could stack on top; thetry_reserve_wanted_slotCAS loop makes six a real ceiling, and the barrier test pins exactly the double-check race. But it does not close the reported regression on its own axis: the wanted branch still admits up to six compiles of 0.1–0.7 GB when memory is not plenty — six by design is what the 30.9 GB reporter OOMed on (memory allocation of 5,636,096 bytes failedat ~92 s, and again warm at 43.65 GB private; his table is in #534 from 13:49Z). The cheap completion, using the value this loop already computes one line above: passplentyintotry_reserve_wanted_slotand cap the wanted branch at 2 when it is false — one parameter, one constant, testable with your existing barrier harness by flipping thewanted()/plenty pair. @remembering7896 has been offering exactly this A/B in #534 and would have a headroom-gated constant to test against. Suggest title/description say "race" rather than "low commit", so nobody closes the OOM from the changelog.@futurepro62 on GitHub · 2026-11-24 15:25 UTC · original · edited 2026-11-24 15:29 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
0da4c35(on its base930e8b4).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.wanted_compiles_contend_for_the_last_slot_under_memory_pressure.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 16:28 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
@Gevroska on GitHub · 2026-11-24 16:56 UTC · original
I updated the title and description to make the race fix explicit. The OOM in #534 remains open. A six-versus-two comparison under matched memory and cache conditions would help determine whether to change the admission policy separately.
@xpatfussy69x on GitHub · 2026-11-25 11:25 UTC · original
Test report for head
0da4c35as pushed (not merged onto currentmain) – NVIDIA, wave32.Tested
.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignoredwanted_compiles_contend_for_the_last_slot_under_memory_pressureran and passedXCL_SAMPLE_*data set (game-data tests not run)Not tested
mainAI use
@4usphs on GitHub · 2026-11-25 11:52 UTC · original
AMD run on the exact head
0da4c35(0da4c35890), as pushed on its base930e8b4(not merged onto currentmain), on two AMD adapters with native 64-lane waves: RDNA4 and the console's generation, RDNA2.Tested
XCL_TRANSLATED_CACHE=0; adapter picked withXCL_ADAPTER.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:gfx1036), driver 32.0.21045.29003: 752 passed, 0 failed, 41 ignoredSKIPPEDtests on either adapter.wanted_compiles_contend_for_the_last_slot_under_memory_pressureruns and passes on both adapters.Not tested
AI use
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.