Repository navigation
Conversation
|
Your claim is there ( One small thing while reading the diff: This one changes AI-assisted (Claude Code). |
|
Independent Windows check, A/B over repeated runs:
So the GPUs tested: n/a (unit tests). AI-assisted: yes. |
|
@MoonEyes Thanks for catching both!
@Kal0s-design Thanks for the independent 40-run Windows 11 A/B verification (4/40 -> 0/40)! AI-assisted: Antigravity |
|
RUN (independent run on Windows, #2854 head 99ed483, merged locally into main 3393cee with Commands, in
Since this run the head moved to eab9e2a, which only moves Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40, Rust 1.98.1. |
|
One thing before a merge, from enlight3d's check and confirmed by reading: taking the call of AI-assisted (Claude Code). |
|
I tested the requested last-reference regression at
That gives a red/green test through COM destruction without relying on pointer reuse. The separate full diagnostics runs with #2884 kept the same eight non-target Wine failures seen with #2884 alone. All three combined runs passed the new stock bookkeeping test and the timeline-record tests. Win64 MSVC target, Rust 1.98.1, synthetic inputs. MEASURED, AI-assisted (Codex). |
|
@MoonEyes Added
@merzleckeier Thanks for testing the last-reference drop path independently as well! |
|
For comparison with the test-only lock in this PR, we tested an alternative for We paused a competing synchronization round after it had taken the dirty page for slot 5 and before it published the host descriptor. Under that forced interleaving, the original test failed 6/6 runs at Our one-file patch checks the fresh slot before the raw copy, submits a closed command list through AI-assisted testing and independent review with OpenAI Codex (GPT-6.2 Astra). |
KelboLive
left a comment
There was a problem hiding this comment.
The strongest hunk is drop_views → title_memory_unmapping — open/remapped never cleared clean, PUBLISHED or VIEWS, so a freed address kept stale state; that is a deterministic leak, not a race. The descriptor lock is real too: my parent-commit A/B caught assert!(host.made(5)) failing 1/60 full-suite runs, and the head is 0/40. One correction: the body describes that race backwards — the observed failure was the post-sync assert seeing false because another sync had consumed the write-watch reset, not !made seeing an early mirror. Same root cause, opposite direction.
Two nits in pool.rs:
- Call
forget_released(gone.raw)beforelock(&TEXTURES).give(...)(:713-714). As written, a texture created at the same COM address in that gap can have its freshRECENT/UNSEENentry wiped by the release. The mechanism is right (wrapper reuse is independent of the 2.5 s pieceREST), just the order. - The new tests are not hermetic:
dropping_last_...asserts on process-globalRECENT/UNSEENafter freeing a COM object (a parallel pool test landing on the same wrapper address re-addsraw), andreleased_texture_pointer_...callsnote_unseen(..., 10, 5)(:1295), whoseretainevicts every otherUNSEENentry withbegun <= 5. Low probability, but this is a flake PR.
The watch reorder (:5190) is not covered: reverting it leaves the whole 602-test suite green. That is acceptable for a race, but please don't count it as tested — it removes the specific window where the address is back with Windows while guards().changing still makes left_alone() skip guarding; the residual window between drop(changing) and UnmapViewOfFile is argued, not closed.
Mutation coverage otherwise holds: dropping forget_released from release fails the new test at pool.rs:1345, and dropping just UNSEEN.remove fails both. Merge is clean against current main; a local merge builds and passes 635/0/59 despite the 384-commit gap. #2896 is complementary (different hunks), but note #2908's require_host() sweep would leave the new pool.rs:1313 test on the old silent form.
|
Verified on Windows 11, Rust 1.98.1, no GPU and no game files. The fix is shown to be needed, by reverting only the source the change touches. The pull request's own new test
That test builds a real 32x32 RGBA8 texture, keeps a second COM reference so the first drop does not release it, drops the last reference, and then checks that the raw pointer is gone from both The other new test covers less than its comment says. What the parallel runs showed. The whole
The seven failures on the base were in four different tests, and only one of them is named in the report: The two watch failures are in the file this pull request changes, under names the report does not list. The report names The timeline failure is a different race, in a file this pull request does not touch, and its cause is known. A note on the rates. A race that fires in one run out of ten does not fire in every set of ten, so the difference between the head and the base here is seven failures in forty against none, not a clean per-test verdict for each of the races. The deterministic control above is what shows the change is needed; the parallel runs show the suite is not yet clean. Not checked: the |
…ke unit test hermetic
|
@KelboLive @Neutron-0 Thanks for the thorough verification and mutation checks! Addressed the feedback in
Re-verified @DIGITALWORLD-PL Thanks for sharing the forced-interleaving confirmation on RTX 5090 -- that cleanly reproduces the exact |
|
Real final-reference check at the pool return boundary on I added the same observer immediately before Separately, the selected descriptor sync, alias cast and kernel-write watch tests passed 3/3 in all 24 starts across both trees, both GPUs, and one/eight test threads. The full serial Wine-builtin no-device suite reproduced the same three watch assertions on both trees in every repeat ( MEASURED with synthetic inputs, OpenAI Codex and a separate read-only review. |
VERIFY-2854 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game filesVerdict: PASS. The pooled-texture fix is a real bug fix and the ordering fix in the watch tests closes a window where an address could be handed back to Windows while a guard still held it. Nothing that passed before fails now. Head 1. What it changesA pooled texture's address could be mistaken for a new one. /// Removes a released pooled texture pointer from `RECENT` and `UNSEEN`
/// so a new resource allocated at the same address is not mistaken for it.
fn forget_released(raw: usize) {
RECENT.lock().unwrap_or_else(|e| e.into_inner()).retain(|r| r.0 != raw);
UNSEEN.lock().unwrap_or_else(|e| e.into_inner()).remove(&raw);
}called from An address could be handed back to Windows while a guard still held it. In // End the remapping window before returning `at` to Windows so another
// thread cannot reuse the address while `g.changing` still leaves its block alone.
drop(changing);
assert!(!guards().left_alone(at / BLOCK));
// SAFETY: our view.
unsafe { UnmapViewOfFile(view) };and the same order is used in A test that raced the background sync thread. 2. Red and green, run under Wine
The red side (the merge base with only this pull request's test changes) does not compile: the new test calls
The three that fail on both sides are 3. What I did not check
AI-assisted: MiniMax M3.1 Flash. |
|
Native Windows verification with separate leonida-gpu library test executables at merge base 7fbcd45 and PR head 81a6e94. Each invocation started a fresh process with --test-threads 16.
No failures in either group. The full-suite runs exercised concurrent tests from other modules as well. The baseline flake did not reproduce here, so these results verify repeated passes on Windows without establishing a change in failure rate. Codex-assisted. |
… to start (GPU-TIMELINE-REPORT-WAIT-HANDSHAKE) `real_waits_are_recorded_with_who_ended_them` (timeline/report.rs, tests) holds a mutex, spawns a thread that is to block on it, sleeps a fixed 20 ms so that the thread has reached `lock.lock()` by then, lets go, and asserts that the trace recorded a wait of 10 ms or more naming this thread as the waker. The 20 ms is a bet on the scheduler. On a loaded machine the new thread has not been started inside it, so it acquires the lock at once, no wait of 10 ms or more exists, and the assert fails with `left: None` against `right: Some(this thread)`. Measured on main 60f7dcd: 3 failures in 40 whole-suite runs of `cargo test -p leonida-gpu --lib --features diagnostics`, and the failing line is the assert, not the recorder. The length of the wait is now the holder's own doing: the worker takes the lock first, says so through a mutex and a condvar, and keeps it for 30 ms; this thread waits for that word and then blocks on the lock for as long as the worker keeps it. The wait is as long as the holder's sleep and not as long as the machine takes to start a thread, so there is no window left to lose, and the test asserts that duration directly as well as the waker. The waits are now read from this thread, because this is the thread that waits: the wait for the lock is the latest of its waits of 10 ms or more. The gate it waited on in the first half names the first worker, so the first match was that one; the latest is the lock's. The chain and the rest of the test are untouched, and `last` is still taken before the contention, so none of this enters it. Red and green on this machine, no game files and no GPU: - Stock test, with 30 ms of start-up delay in the spawned thread (what the 20 ms sleep assumes away): FAILED, `left: None`, `right: Some(27892)`. - This test, with the same 30 ms of start-up delay: ok. - This test without the perturbation: 10 of 10 runs ok. - Whole diagnostics suite (`cargo test -p leonida-gpu --lib --locked --features diagnostics`): 3 runs, 749 passed, 0 failed, 59 ignored, each. - Default suite (`cargo test -p leonida-gpu --lib --locked`): 667 passed, 1 failed, 59 ignored; the failure was `texture.rs`'s `alias_cast_tests::..._r9g9b9e5_under_legacy_barriers`, the race ProjectLeonida#2854 fixes, which passes alone (6 passed, 1 ignored) and is not this test. - Teeth: with `Trace::waker` made to return `None`, this test fails at the assert, so the wait is still checked for who ended it. Only the test changes, and only under the diagnostics feature; no product code. AI-assisted: yes - DeepSeek V4.1 Flash Free (OpenCode), with a separate read-only review agent.
Claim:
D3D12-GPU-TEST-PARALLEL-FLAKES(#2570 (comment))Fixes three process-global parallel test issues in
leonida-gpureported in #2570 (wherecargo test -p leonida-gpu --libflaked under default parallel test threads while passing under--test-threads=1).Root causes & fixes
watch::tests(d3d12/crates/leonida-gpu/src/watch.rs)drop_viewscalledtitle_memory_remappedinstead oftitle_memory_unmapping, deterministically leakingclean,PUBLISHED, andVIEWSstate for an unmapped view address. Switcheddrop_viewstotitle_memory_unmapping.nothing_is_guarded_between_our_forgetting_it_and_its_unmappingandwrites_to_views_are_not_lostcalledUnmapViewOfFilebefore droppingRemapping, returning the virtual address to Windows whileg.changingstill marked its block asleft_alone. Ended the remapping window beforeUnmapViewOfFile(note: this race-window tightening is not directly covered by a unit test; reverting it leaves the suite green).descriptor::tests(d3d12/crates/leonida-gpu/src/descriptor.rs)records_copied_as_bytes_are_made_at_the_next_syncraced with the 4 ms background"leonida-heap-sync"thread and concurrent test submissions callingsync_heaps()over process-globalSHADER_HEAPS: a competing sync round could consume the write-watch reset for slot 5 before publishing its host descriptor, causing the test's post-syncassert!(host.made(5))to observefalse. Added a#[cfg(test)]TEST_SYNC_LOCKaroundsync_heaps()and held it across the raw copy, pre-sync check, and sync call.pool::Reclaim/texture::alias_cast_tests(d3d12/crates/leonida-gpu/src/pool.rs)Reclaim::releasereturned a pooled piece without removing the releasedID3D12Resourceraw pointer fromRECENTorUNSEEN. When a subsequent committed texture reused that COM pointer within 1 second,pool::freshfalsely reportedtrue, failingassert_eq!(pool::fresh(©.texture), false)incommitted_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers. Storedraw: usizeinReclaimand calledforget_released(gone.raw)before returninggone.piecetoTEXTURESon final release.released_texture_pointer_is_not_kept_in_recent_or_unseen(testsforget_releaseddirectly, inserting(raw, u64::MAX)intoUNSEENwithout callingnote_unseen's eviction sweep) and COM last-reference drop regression testdropping_last_pooled_texture_reference_forgets_recent_and_unseen(allocates a 32x32 RGBA8 placed texture viapool::texture, holds two COM references, confirms entries remain after dropping the first reference, and confirmsRECENTandUNSEENare cleared after dropping the final reference triggersReclaim::release).Verification
mainad7c62edb, 8 parallel runs):watch::tests::other_memory_at_a_guarded_address_keeps_its_protectionandwatch::tests::what_is_put_in_beside_the_guards_is_told_at_every_viewpanicked on parallel run 2/8.dropping_last_pooled_texture_reference_forgets_recent_and_unseen:forget_released(gone.raw)inReclaim::release:0 passed; 1 failed(panicked on post-dropRECENTassertion; independently reproduced by@Neutron-0and@KelboLive).forget_released(gone.raw)beforelock(&TEXTURES).give(...)(81a6e94a9):cargo test --locked -p leonida-gpu --lib pool::: 10/10 consecutive parallel runs passed (19 passed, 0 failed each).leonida-gpu --libparallel runs (atbce4a898b): 17/18 passed here (601/0/55; run 18 hit the separate standing-ask flake tracked in d3d12-gpu: clear watch rest state on unmap/free and serialize standing-ask tests #2896); 0/40 failures and 635/0/59 merged onmainon@KelboLive's machine.depth_bounds_pipeline_loads_and_filters_drawsfails deterministically on Windows 10 inbox D3D12 without Agility SDK; tracked in d3d12-gpu: drop unused SM 6.6 root signature flags in depth_bounds test #2855.)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 (plus separate read-only reviewer subagent)