Repository navigation
Conversation
wait_for_memory previously checked WORKING against commit headroom and WANTED_AT_ONCE with an unlocked load before calling fetch_add(1), allowing concurrent worker wakeups to admit an unbounded burst past both limits. Wrap the admission check and working-slot increment in a MemoryGate mutex while keeping MemorySlot::drop lock-free and sleeping outside the mutex, and add multi-threaded unit tests verifying tight-headroom, WANTED_AT_ONCE, low-commit single-slot, and timeout behavior. Part of xcl-dev#2463 Part of xcl-dev#1566 Part of xcl-dev#1269 Assisted-by: Antigravity (Gemini 4 Hydrogen)
|
Tested: exact clean head
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: |
|
Tested: current PR head merged onto current
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. |
Fixes 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.