Repository navigation
d3d12-gpu: stabilize global stall routing test under parallel diagnostics runs - #2884
Conversation
|
Independent parallel diagnostics runs at I also ran the full GPU crate selection on RTX 4070 SUPER three times per tree and three more with #2854 applied. No MEASURED with synthetic tests, no game files. AI-assisted (Codex). |
KelboLive
left a comment
There was a problem hiding this comment.
Verified empirically, and the fix works: the target test fails 18/20 full-suite diagnostics runs on base b3910e5e3 and 0/20 with this branch, and the merged tree passes. CI green, merge clean, and record.rs has not moved between the branch base and current main.
But the stated root cause does not match the failure. Instrumenting base shows the span is in ROLLING right after emit_global_without_contention returns (present=true, overwritten=0), and it only vanishes by freeze with overwritten=339,176 and the ring full at 65,536 — so it is eviction by other tests' events, not a push that never landed. The new has_event check (record.rs:674-676) is a real improvement (silent give-up becomes a panic), but it proves presence only at emit time; the same eviction can still wipe the event between the last check and freeze(). The underlying shared-ring flooding is not addressed.
Two suggestions that would keep this class visible instead of latent:
- assert on
data.meta.overwritten == 0(or gate the foreign producers) so a future flood fails loudly rather than relying on the timing window; - make the wait predicate object-specific —
Kind::Wait && e.b == 0(record.rs:2282) matches any concurrent non-card wait, so the test can be satisfied by someone else's wait.
Mutation note: replacing the retention guard with if true passes the stock test 8/8, so the new guard is only covered when contention actually hits — the temporary 2 ms ring hold I used is the only way I got it red. That is acceptable for a flake fix, but it means the guard is not a regression test on its own.
Nit: the over-long assert! at record.rs:2283 adds a 15th rustfmt diff to a file that already has 14; fmt is report-only here, so cosmetic.
Verdict: approve with the root-cause correction — no runtime risk, and the flake is gone empirically — but the narrative should say "evicted by other tests", not "the push was lost".
|
Verified on Windows 11, Rust 1.98.1, no GPU and no game files. The change is right in shape, and the flake it fixes did not reproduce on this machine. The whole
One failure was seen, in a different test, and it belongs to #2854. On run 8 of the head: That is the pool race #2854 fixes ( What the change does, and it matches the report. One note on the helper's shape. Not checked: the GPU crates' behaviour under a real adapter (no GPU device here); the |
|
@KelboLive Thanks for instrumenting the base and catching the actual failure mechanism -- eviction from @Neutron-0 Thanks for running the 10+10 parallel check as well (and confirming the separate |
|
Merging (added to the merge queue). Head 4b52062 merges cleanly with main c4ca576. Claim: D3D12-TIMELINE-STALL-TEST-PARALLEL (#2570 (comment)). Red/green: KelboLive (the test fails 18/20 diagnostics runs on base, 0/20 with this), Neutron-0 (Windows 11, 10 runs each side). I ran: #2858, #2882, #2788, #2876 and #2884 merged together onto main c4ca576: cargo tests leonida-shader 420 passed / 0 failed, leonida-loader 85/0, leonida-gpu 644/0. In-game run: RTX 4070 Laptop 8 GB, NVIDIA 621.40, -SeriesS -NoDlss -NoFrameGen, a cold start to the world (135 s) then a 330 s warm walking run: median 35.4 ms (28.2 fps), private memory max 24.4 GB, 0 device lost. CI: green on head and main; the queue runs the full CI on the group before merging. AI-assisted: Claude Code (oreofr-agent), merge approved in writing by OreoFR. |
VERIFY-2884 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game filesVerdict: PASS on what I could check. The change makes a test that was flaky under parallel runs deterministic, and nothing that passed before fails now. The flakiness itself does not reproduce on this machine, so I could not watch the test go from red to green. Head 1. What it changes
The change replaces "retry when the contention counter advances" with "retry until the producer call actually took": fn emit_global_until(pred: impl Fn(&Event) -> bool, mut emit: impl FnMut()) { ... }and the assertion it guards becomes "the synthetic wake/wait events were not retained in 2. What the tests do here
The test count is the same on both sides because the change modifies an existing test ( 3. Why there is no red→green to seeThe modified test passes on the merge base as well: the contention the retry answers to needs another test thread to hold That is the opposite of a defect: the change removes a flake that the upstream's 16-core Windows CI sees. I could not reproduce the flake to measure how often it fires. 4. What I did not check
AI-assisted: MiniMax M3.1 Flash. |
Claim:
D3D12-TIMELINE-STALL-TEST-PARALLEL(#2570 (comment))Fixes the
--features diagnosticsparallel test flake ind3d12/crates/leonida-gpu/src/timeline/record.rs(global_stall_routing_retains_spans_waits_wakes_and_sent_fences_without_stacks, reported by@enlight3din #2854).Root cause
Under parallel
cargo test -p leonida-gpu --lib --features diagnostics,global_stall_routing_retains_spans_waits_wakes_and_sent_fences_without_stacksshares the process-wide 65,536-entryROLLINGring buffer with all other test threads. Previously, it emitted"synthetic stall span"first and then spawned a worker thread and synchronized aCondvar+Barrierwait/wake before callingfinalize_stall. While the thread-spawn + condvar step ran, concurrent tests floodedROLLINGand evicted the earlier"synthetic stall span"from the ring before freeze (as@KelboLiveconfirmed by instrumenting the base: the span landed inROLLINGwithpresent=true, then vanished by freeze withoverwritten=339,176).Separately,
emit_global_without_contentionpolled the process-wideROLLING.dropped_contentioncounter and silently gave up after 64 retries instead of checking that the test's own event was actually retained inROLLING.Change
global_stall_routing_retains_spans_waits_wakes_and_sent_fences_without_stacksso the thread-spawn + condvar wait/wake runs before emitting"synthetic stall span",Sent, and the fence-linkedWait, shrinking the window during which concurrent tests can evict those events before freeze.#[cfg(test)] RollingBuffer::has_event(&self, pred)ind3d12/crates/leonida-gpu/src/timeline/record.rs.emit_global_without_contentionwithemit_global_until(pred, emit), which verifies the specific synthetic event is present inROLLING(panicking loudly after 64 attempts rather than silently giving up). Applied to bothglobal_stall_routing_retains_spans_waits_wakes_and_sent_fences_without_stacksandstep_stall_present_writes_on_background_thread_and_preserves_reentrancy_safety.Note: this does not eliminate concurrent test traffic into the shared
ROLLINGring itself; it removes the thread-spawn eviction gap and turns any emit-time drop into an explicit failure.Verification
mainb3910e5e3, 10 parallel runs ofcargo test --locked -p leonida-gpu --lib --features diagnostics -- --skip depth_bounds_pipeline_loads_and_filters_draws):global_stall_routing_retains_spans_waits_wakes_and_sent_fences_without_stackspanicked atrecord.rs:2325:9(1/10runs here;7/10--8/10on@enlight3d's machine;18/20on@KelboLive's machine).timeline::(timeline::record::tests::*passed 20/20;0/20on@KelboLive's machine as well).GPUs tested: NVIDIA GeForce RTX 5070 12 GB (driver 621.40, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T)
AI-assisted: Antigravity