d3d12: the contended-lock test waits for the holder, not for a thread to start (GPU-TIMELINE-REPORT-WAIT-HANDSHAKE) #3050

Open
Neutron-0 wants to merge 1 commit from upstream-pr/3050 into main
Neutron-0 commented 2026-12-02 05:38:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T05:38:41Z.


Claimed in the coordination issue as: GPU-TIMELINE-REPORT-WAIT-HANDSHAKE

What and why

real_waits_are_recorded_with_who_ended_them (d3d12/crates/leonida-gpu/src/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. The failing line is the assert, not the recorder: the recorder had nothing to name because there was no wait.

The test is under the diagnostics feature, so the default --lib run does not compile it; it is the run the layer's own diagnostics build uses.

What changed

  • The length of the wait is now the holder's hold, and the recorder says when the wait has begun. This thread takes the lock and spawns the waiter, which asks for the lock and blocks inside it; the recorder's own standing() counter for that lock says that the wait has been reached (the wrapper takes the counter before it waits), and only then does this thread start its hold of 30 ms. The wait is therefore the holder's hold and not the time the waiter took to arrive: however late the waiter is woken up, the wait is 30 ms.
  • The counter is a hash of the address into 4096 slots and the recorder is process-wide, so another waiter or a timer can share the slot: the hold can then begin before the waiter is really there, and the wait is short. Each sample has a lock of its own now, so a collision of that kind reaches one sample and not all of them: the test takes three samples and fails only when none of them waited.
  • The wait that is measured is the one on this lock inside a sample's own ticks, so the waiter's own sleeps, the join below, which is a wait of its own, and the first half's condvar wait cannot be mistaken for it, and it has to be 10 ms or more: that is the floor of a wait worth measuring, not a filter.
  • The wait for the recorder's word is bounded by two seconds, so a waiter that never arrives cannot hang the test, and the first half's gate wait is bounded the same way, so a worker that dies fails the test instead of hanging it.
  • The chain, the work, the stack sites, the JSON and the summary assertions are untouched, and last is still taken before the contention, so none of this enters the chain.
  • No product code changes.

Verification (CPU-only, no game files, no GPU)

On this head, based on main 0ae5a2664 (the branch's base; it merges cleanly into the current main ba9e65cec):

  • 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) - the flake, every time.
  • This test, with the same 30 ms of start-up delay: ok.
  • This test with the waiter thread starting 70 ms late, on every sample - the perturbation two reviewers used on the earlier head: ok. The hold starts when the recorder says the wait has begun, so the delay cannot shorten the wait.
  • This test with a standing guard for a different object in the same bucket of the recorder's table, held for the whole test, and the waiter 70 ms late - the case @merzleckeier forced on the earlier head, where every sample used the same lock and so the same bucket: FAILED there, "no sample of the 3 waited on the lock for 10 ms or more: ["-", "-", "-"] ms; the recorder's counter saw the waiter's key in 3 of them", and ok here, 5 of 5 runs: the samples have locks of their own now, so the collision reaches one of them and not all three.
  • This test with a holder that keeps the lock for 1 ms, so the wait it measures is too short: FAILED, "no sample of the 3 waited on the lock for 10 ms or more: ["1.30", "1.08", "1.25"] ms; the recorder reported the waiter at the lock's object in 3 of them". The message names the waits the trace holds, not the wall clock.
  • Teeth: with Trace::waker made to return None, this test fails, since the chain is built from the wakes.
  • This test without any of those: 20 of 20 runs ok.
  • Whole diagnostics suite (cargo test -p leonida-gpu --lib --locked --features diagnostics): 3 runs on this head - two clean, 749 passed and 0 failed, 59 ignored each, and one with watch.rs's known parallel race (watch::many_askers_tests::no_mapping_is_lost_between_askers, claimed under D3D12-GPU-TEST-PARALLEL-FLAKES), 748 passed and 1 failed. This test failed in none of them. The stock test failed in this suite 3 times in 40 runs on main 60f7dcd.
  • The whole diagnostics suite in parallel, ten times in a row over three heads of this branch (five on each of the last two): eight runs 749 passed / 0 failed, one run 748 passed / 1 failed - descriptor.rs's records_copied_as_bytes_are_made_at_the_next_sync, the parallel race D3D12-GPU-TEST-PARALLEL-FLAKES covers (claimed by lixonik); one run with the same item's watch.rs race; one run with texture.rs's alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, the parallel race #2854 fixes. Fifteen parallel runs in all, and this test failed in none of them.
  • cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1: 6 passed, 0 failed, 59 ignored.
  • Default suite (cargo test -p leonida-gpu --lib --locked): 667 passed, 1 failed, 59 ignored. The failure was texture.rs's alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, the parallel race #2854 fixes; it passes alone (6 passed, 1 ignored) and is not this test.
  • cargo clippy -p leonida-gpu --lib --features diagnostics --tests: nothing in this file.

What this does not do

It does not serialise the suite and does not touch the other parallel races in this crate (watch.rs, descriptor.rs, texture.rs, pool.rs), which are claimed elsewhere. It changes only this test, so it would also stand if the suite were serialised later: this test's wait is no longer a thing to hide.

Notes

  • No game files and no GPU. The test needs real threads and the wrappers, both of which this machine has.

The repository's own workflows ran on this head in the contributor's fork, where no maintainer's approval is needed, and they are green: check, linux-python-and-viewer and semantic-tests success, d3d12 (windows-latest) success (CI 47158599080; No Game Data 47158606629; D3D12 runtime 47158614758). change-scope is the one job that cannot be produced that way: it only runs on a pull_request event, so it needs the base repository's run.

Checklist

  • Based on main 0ae5a2664 (the branch's base); the branch merges cleanly into the current main ba9e65cec.
  • No game files, no GPU, no network.
  • python -I scripts/check_no_game_data.py clean.
  • Red/green: the stock shape with a delayed start fails; this shape with the same delay passes, and a late waiter cannot shorten the wait any more.

GPUs tested: n/a (a CPU-only test of the diagnostics recorder; it needs no GPU and no game files)

AI-assisted: yes - MiniMax M3.1 Flash (NVIDIA, via OpenCode) wrote the change, with independent read-only review agents (GLM-5.3 Flash via NVIDIA, Kimi K3.1 Pro via NVIDIA, and DeepSeek V4.1 Flash Free via OpenCode) and human reviews on this pull request.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5600581688 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T05:38:41Z. --- Claimed in the coordination issue as: GPU-TIMELINE-REPORT-WAIT-HANDSHAKE ### What and why `real_waits_are_recorded_with_who_ended_them` (`d3d12/crates/leonida-gpu/src/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`. The failing line is the assert, not the recorder: the recorder had nothing to name because there was no wait. The test is under the diagnostics feature, so the default `--lib` run does not compile it; it is the run the layer's own diagnostics build uses. ### What changed - The length of the wait is now the holder's hold, and the recorder says when the wait has begun. This thread takes the lock and spawns the waiter, which asks for the lock and blocks inside it; the recorder's own `standing()` counter for that lock says that the wait has been reached (the wrapper takes the counter before it waits), and only then does this thread start its hold of 30 ms. The wait is therefore the holder's hold and not the time the waiter took to arrive: however late the waiter is woken up, the wait is 30 ms. - The counter is a hash of the address into 4096 slots and the recorder is process-wide, so another waiter or a timer can share the slot: the hold can then begin before the waiter is really there, and the wait is short. Each sample has a lock of its own now, so a collision of that kind reaches one sample and not all of them: the test takes three samples and fails only when none of them waited. - The wait that is measured is the one on this lock inside a sample's own ticks, so the waiter's own sleeps, the join below, which is a wait of its own, and the first half's condvar wait cannot be mistaken for it, and it has to be 10 ms or more: that is the floor of a wait worth measuring, not a filter. - The wait for the recorder's word is bounded by two seconds, so a waiter that never arrives cannot hang the test, and the first half's gate wait is bounded the same way, so a worker that dies fails the test instead of hanging it. - The chain, the work, the stack sites, the JSON and the summary assertions are untouched, and `last` is still taken before the contention, so none of this enters the chain. - No product code changes. ### Verification (CPU-only, no game files, no GPU) On this head, based on `main` `0ae5a2664` (the branch's base; it merges cleanly into the current `main` `ba9e65cec`): - 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)` - the flake, every time. - This test, with the same 30 ms of start-up delay: ok. - This test with the waiter thread starting 70 ms late, on every sample - the perturbation two reviewers used on the earlier head: ok. The hold starts when the recorder says the wait has begun, so the delay cannot shorten the wait. - This test with a standing guard for a different object in the same bucket of the recorder's table, held for the whole test, and the waiter 70 ms late - the case @merzleckeier forced on the earlier head, where every sample used the same lock and so the same bucket: FAILED there, "no sample of the 3 waited on the lock for 10 ms or more: [\"-\", \"-\", \"-\"] ms; the recorder's counter saw the waiter's key in 3 of them", and ok here, 5 of 5 runs: the samples have locks of their own now, so the collision reaches one of them and not all three. - This test with a holder that keeps the lock for 1 ms, so the wait it measures is too short: FAILED, "no sample of the 3 waited on the lock for 10 ms or more: [\"1.30\", \"1.08\", \"1.25\"] ms; the recorder reported the waiter at the lock's object in 3 of them". The message names the waits the trace holds, not the wall clock. - Teeth: with `Trace::waker` made to return `None`, this test fails, since the chain is built from the wakes. - This test without any of those: 20 of 20 runs ok. - Whole diagnostics suite (`cargo test -p leonida-gpu --lib --locked --features diagnostics`): 3 runs on this head - two clean, 749 passed and 0 failed, 59 ignored each, and one with `watch.rs`'s known parallel race (`watch::many_askers_tests::no_mapping_is_lost_between_askers`, claimed under `D3D12-GPU-TEST-PARALLEL-FLAKES`), 748 passed and 1 failed. This test failed in none of them. The stock test failed in this suite 3 times in 40 runs on `main` `60f7dcd`. - The whole diagnostics suite in parallel, ten times in a row over three heads of this branch (five on each of the last two): eight runs 749 passed / 0 failed, one run 748 passed / 1 failed - `descriptor.rs`'s `records_copied_as_bytes_are_made_at_the_next_sync`, the parallel race `D3D12-GPU-TEST-PARALLEL-FLAKES` covers (claimed by lixonik); one run with the same item's `watch.rs` race; one run with `texture.rs`'s `alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, the parallel race #2854 fixes. Fifteen parallel runs in all, and this test failed in none of them. - `cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1`: 6 passed, 0 failed, 59 ignored. - Default suite (`cargo test -p leonida-gpu --lib --locked`): 667 passed, 1 failed, 59 ignored. The failure was `texture.rs`'s `alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, the parallel race #2854 fixes; it passes alone (6 passed, 1 ignored) and is not this test. - `cargo clippy -p leonida-gpu --lib --features diagnostics --tests`: nothing in this file. ### What this does not do It does not serialise the suite and does not touch the other parallel races in this crate (`watch.rs`, `descriptor.rs`, `texture.rs`, `pool.rs`), which are claimed elsewhere. It changes only this test, so it would also stand if the suite were serialised later: this test's wait is no longer a thing to hide. ### Notes - No game files and no GPU. The test needs real threads and the wrappers, both of which this machine has. The repository's own workflows ran on this head in the contributor's fork, where no maintainer's approval is needed, and they are green: `check`, `linux-python-and-viewer` and `semantic-tests` success, `d3d12 (windows-latest)` success ([CI 47158599080](https://github.com/Neutron-0/mandy/actions/runs/47158599080); [No Game Data 47158606629](https://github.com/Neutron-0/mandy/actions/runs/47158606629); [D3D12 runtime 47158614758](https://github.com/Neutron-0/mandy/actions/runs/47158614758)). `change-scope` is the one job that cannot be produced that way: it only runs on a `pull_request` event, so it needs the base repository's run. ### Checklist - [x] Based on `main` `0ae5a2664` (the branch's base); the branch merges cleanly into the current `main` `ba9e65cec`. - [x] No game files, no GPU, no network. - [x] `python -I scripts/check_no_game_data.py` clean. - [x] Red/green: the stock shape with a delayed start fails; this shape with the same delay passes, and a late waiter cannot shorten the wait any more. GPUs tested: n/a (a CPU-only test of the diagnostics recorder; it needs no GPU and no game files) AI-assisted: yes - MiniMax M3.1 Flash (NVIDIA, via OpenCode) wrote the change, with independent read-only review agents (GLM-5.3 Flash via NVIDIA, Kimi K3.1 Pro via NVIDIA, and DeepSeek V4.1 Flash Free via OpenCode) and human reviews on this pull request.
ecox982745 commented 2026-12-02 05:42:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-12-02T05:42:38Z.


CPU-only review at 82e4a68b9. The handshake fixes a holder that starts late. It still permits the waiter to be descheduled after the holder signals and before the waiter attempts lock.lock() (timeline/report.rs:1463). If the holder runs its 30 ms sleep and releases the lock during that interval, the waiter acquires immediately and the new 10 ms assertion fails. The 30 ms holder-start perturbation exercises a different schedule.

I checked the schedule in a small CPU-only model of the mutex and condvar handoff. Six ordinary attempts waited about 31 ms. Six with the waiter held until the release acquired in at most 0.001 ms. This models the synchronization sequence. The Rust trace test itself was not executed. A contrived delay immediately before the wait timer would exercise the remaining window in the Rust test.

The trace lookup also runs after second.join(). If the holder is descheduled between dropping the lock and returning from the thread, max_by_key(|w| w.t1) can select the join wait. Consider timestamping the lock call with the trace clock and restricting the lookup to that interval. For the minimum-duration assertion, a bounded retry of an attempt where there was no measured lock contention would distinguish an unlucky schedule from attribution failure.

AI-assisted review. No GPU or game files used.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7336213922 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7336213922). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-12-02T05:42:38Z. --- CPU-only review at `82e4a68b9`. The handshake fixes a holder that starts late. It still permits the waiter to be descheduled after the holder signals and before the waiter attempts `lock.lock()` (`timeline/report.rs:1463`). If the holder runs its 30 ms sleep and releases the lock during that interval, the waiter acquires immediately and the new 10 ms assertion fails. The 30 ms holder-start perturbation exercises a different schedule. I checked the schedule in a small CPU-only model of the mutex and condvar handoff. Six ordinary attempts waited about 31 ms. Six with the waiter held until the release acquired in at most 0.001 ms. This models the synchronization sequence. The Rust trace test itself was not executed. A contrived delay immediately before the wait timer would exercise the remaining window in the Rust test. The trace lookup also runs after `second.join()`. If the holder is descheduled between dropping the lock and returning from the thread, `max_by_key(|w| w.t1)` can select the join wait. Consider timestamping the lock call with the trace clock and restricting the lookup to that interval. For the minimum-duration assertion, a bounded retry of an attempt where there was no measured lock contention would distinguish an unlucky schedule from attribution failure. AI-assisted review. No GPU or game files used.
Neutron-0 commented 2026-12-02 06:06:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T06:06:58Z.


One review round found a second way for this test to fail, and it is fixed in this head (3f6545b0b).

The join below is a wait of its own: the wrappers record it like any other wait of this thread. If the worker is slow to exit, that wait is later than the wait for the lock and is at least 10 ms long, so the assertion could pick it - and a join names no waker, so it failed with left: None, the same shape as the flake this pull request removes. The ticks are now taken before the join and the waits are bounded by them, so the wait for the lock is the one that is measured.

Measured here: with 30 ms between the holder's release and its exit, this head passes, and the head without the bound fails with left: None.

The wait for the holder's word is bounded as well (two seconds), so a holder that never takes the lock fails the test instead of hanging it.

On this head: whole diagnostics suite 2 runs, 749 passed and 0 failed each; the test itself 20 of 20 runs; default suite 668 passed, 0 failed.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7336651071 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7336651071). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T06:06:58Z. --- One review round found a second way for this test to fail, and it is fixed in this head (`3f6545b0b`). The join below is a wait of its own: the wrappers record it like any other wait of this thread. If the worker is slow to exit, that wait is later than the wait for the lock and is at least 10 ms long, so the assertion could pick it - and a join names no waker, so it failed with `left: None`, the same shape as the flake this pull request removes. The ticks are now taken before the join and the waits are bounded by them, so the wait for the lock is the one that is measured. Measured here: with 30 ms between the holder's release and its exit, this head passes, and the head without the bound fails with `left: None`. The wait for the holder's word is bounded as well (two seconds), so a holder that never takes the lock fails the test instead of hanging it. On this head: whole diagnostics suite 2 runs, 749 passed and 0 failed each; the test itself 20 of 20 runs; default suite 668 passed, 0 failed.
Neutron-0 commented 2026-12-02 06:19:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T06:19:22Z.


One practical note on #3050: its three workflow runs (D3D12 runtime, CI, No Game Data) are at action_required on the head 3f6545b0b. A fork run of a first-time contributor needs a maintainer to approve it before the jobs run; approving them would let the checks run. The same was asked for #2864's runs.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7336884395 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7336884395). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T06:19:22Z. --- One practical note on #3050: its three workflow runs (`D3D12 runtime`, `CI`, `No Game Data`) are at `action_required` on the head `3f6545b0b`. A fork run of a first-time contributor needs a maintainer to approve it before the jobs run; approving them would let the checks run. The same was asked for #2864's runs.
MoonEyes commented 2026-12-02 12:39:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:39:51Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345682726 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7345682726). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:39:51Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
Kal0s-design commented 2026-12-02 14:47:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T14:47:00Z.


Ran natively on Windows 11, head 3f6545b0b merged into current main (2fc7383b9, clean merge), debug build, --locked.

Check Result
cargo test -p leonida-gpu --lib --features diagnostics, 3 runs (LEONIDA_D3D12_WARP=1, so the suite's few GPU tests ran on WARP only) 777 passed, 0 failed, 59 ignored, each run
cargo test -p leonida-gpu --lib 696 passed, 0 failed, 59 ignored
cargo clippy -p leonida-gpu --all-targets --features diagnostics nothing in timeline/report.rs (the findings it reports are elsewhere and already on main)

Repeat counts. I built two diagnostics test binaries from the same merged tree. One has main's version of the test and one has this head's. Each run launches the test binary as its own process with only real_waits_are_recorded_with_who_ended_them selected.

Condition main test this head's test
No load added by me (other builds were running on the machine), 200 runs each 0 / 200 failed 0 / 200 failed
48 busy-loop processes (twice the logical CPU count) at normal priority, 200 runs each 200 / 200 failed 0 / 200 failed

All 200 failures on main under load were no entry found for key at trace.waits[&second]. The spawned thread recorded no waits at all: it was not scheduled within the 20 ms, so it never blocked on the lock. That is the same root cause as the left: None failure in the description, just one line earlier. Without the added load neither version failed on this machine, so the flake here needs load.

Can it hang? No. With a throwaway variant where the holder never sets the flag or notifies, the test fails after 2.05 s with the holder did not take the lock within two seconds.

The window from the earlier review is real, but the load did not hit it. With a throwaway variant that sleeps 40 ms between the holder's notification and let blocked = Instant::now(), the test failed (one run) with this thread was to wait on the lock, and waited 11.3µs. So a waiter that is descheduled after the holder's word can still fail, as the earlier review described. It now fails at the new duration assertion with a clear message, not at the attribution. Under the 48-process load above that never happened in 200 runs. Reading the code (I only ran the 40 ms delay), the waiter blocks for about 30 ms minus its own delay, and the assertion needs 10 ms. So a delay of about 20 ms between wait_timeout returning and lock() is enough to fail. That margin is about the same size as main's 20 ms bet. The difference is which delay it is: a woken thread that already exists has to lose 20 ms, where main needed a new thread to start within 20 ms. Under this load the second happened every time and the first never did. A longer holder sleep (e.g. 100 ms) would widen the margin for slower CI machines, at the cost of test time.

Not checked: CI runners, a heavier or real-time-priority load, loads other than CPU spinning (I/O, memory), the whole diagnostics suite under load.

GPUs tested: WARP only for the suite (the test this PR changes is CPU-only).
AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7349130204 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7349130204). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T14:47:00Z. --- Ran natively on Windows 11, head `3f6545b0b` merged into current `main` (`2fc7383b9`, clean merge), debug build, `--locked`. | Check | Result | |---|---| | `cargo test -p leonida-gpu --lib --features diagnostics`, 3 runs (`LEONIDA_D3D12_WARP=1`, so the suite's few GPU tests ran on WARP only) | 777 passed, 0 failed, 59 ignored, each run | | `cargo test -p leonida-gpu --lib` | 696 passed, 0 failed, 59 ignored | | `cargo clippy -p leonida-gpu --all-targets --features diagnostics` | nothing in `timeline/report.rs` (the findings it reports are elsewhere and already on `main`) | **Repeat counts.** I built two diagnostics test binaries from the same merged tree. One has `main`'s version of the test and one has this head's. Each run launches the test binary as its own process with only `real_waits_are_recorded_with_who_ended_them` selected. | Condition | `main` test | this head's test | |---|---|---| | No load added by me (other builds were running on the machine), 200 runs each | 0 / 200 failed | 0 / 200 failed | | 48 busy-loop processes (twice the logical CPU count) at normal priority, 200 runs each | **200 / 200 failed** | **0 / 200 failed** | All 200 failures on `main` under load were `no entry found for key` at `trace.waits[&second]`. The spawned thread recorded no waits at all: it was not scheduled within the 20 ms, so it never blocked on the lock. That is the same root cause as the `left: None` failure in the description, just one line earlier. Without the added load neither version failed on this machine, so the flake here needs load. **Can it hang? No.** With a throwaway variant where the holder never sets the flag or notifies, the test fails after 2.05 s with `the holder did not take the lock within two seconds`. **The window from the earlier review is real, but the load did not hit it.** With a throwaway variant that sleeps 40 ms between the holder's notification and `let blocked = Instant::now()`, the test failed (one run) with `this thread was to wait on the lock, and waited 11.3µs`. So a waiter that is descheduled after the holder's word can still fail, as the earlier review described. It now fails at the new duration assertion with a clear message, not at the attribution. Under the 48-process load above that never happened in 200 runs. Reading the code (I only ran the 40 ms delay), the waiter blocks for about 30 ms minus its own delay, and the assertion needs 10 ms. So a delay of about 20 ms between `wait_timeout` returning and `lock()` is enough to fail. That margin is about the same size as `main`'s 20 ms bet. The difference is which delay it is: a woken thread that already exists has to lose 20 ms, where `main` needed a new thread to start within 20 ms. Under this load the second happened every time and the first never did. A longer holder sleep (e.g. 100 ms) would widen the margin for slower CI machines, at the cost of test time. Not checked: CI runners, a heavier or real-time-priority load, loads other than CPU spinning (I/O, memory), the whole diagnostics suite under load. GPUs tested: WARP only for the suite (the test this PR changes is CPU-only). AI-assisted: yes (Claude Code).
merzleckeier commented 2026-12-02 14:55:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:55:56Z.

Review: COMMENTED


I reproduced the late-waiter case on 3f6545b0 merged onto acc350745 under Wine 11.22. A 70 ms delay after the holder signalled and before the waiter called lock() let the 30 ms hold expire. The duration assertion then measured 400 ns, consistent with the earlier native Windows result. Previous verification

A local test-only variant removed that dependency. It armed a flag for the specific waiter thread immediately before the contended lock(). The existing recorder standing() hook signalled that the thread reached the instrumented wait. Only then did the holder start the measured 30 ms hold, with a two-second bound for a missing wait. The same 70 ms perturbation passed 3/3, including the assertion that the holder was the waker. This keeps the Rust mutex and tests the actual wait rather than increasing the scheduler allowance.

The binaries in this probe had no debug symbols, so the local variant checked that the stack sites existed and left symbol-name resolution outside the measurement. No production code was changed. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6153264471 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#pullrequestreview-6153264471). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:55:56Z. **Review:** COMMENTED --- I reproduced the late-waiter case on `3f6545b0` merged onto `acc350745` under Wine 11.22. A 70 ms delay after the holder signalled and before the waiter called `lock()` let the 30 ms hold expire. The duration assertion then measured 400 ns, consistent with the earlier native Windows result. [Previous verification](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7349130204) A local test-only variant removed that dependency. It armed a flag for the specific waiter thread immediately before the contended `lock()`. The existing recorder `standing()` hook signalled that the thread reached the instrumented wait. Only then did the holder start the measured 30 ms hold, with a two-second bound for a missing wait. The same 70 ms perturbation passed 3/3, including the assertion that the holder was the waker. This keeps the Rust mutex and tests the actual wait rather than increasing the scheduler allowance. The binaries in this probe had no debug symbols, so the local variant checked that the stack sites existed and left symbol-name resolution outside the measurement. No production code was changed. AI-assisted with OpenAI Codex.
Neutron-0 commented 2026-12-02 15:28:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T15:28:24Z.


Second review round, two findings, both fixed in 6a674a118.

The wait that was measured could have been the wrong one. The condvar's wait is ended by the same holder that holds the lock, so it names the same waker, and the earlier shape took the latest wait of 10 ms or more - which could be that one. With a holder that waits 10 ms before it signals and keeps the lock for 1 ms, the lock's own wait is 1 ms and the condvar's is 10 ms: the earlier shape picked the condvar's wait, saw the holder as its waker and passed, while the lock's wait was never checked. The wait is now pinned by the ticks around the lock call - the one inside a try's own ticks - and it has to be 10 ms or more. With that same holder the test now fails and says so: "no try of the five waited on the lock for 10 ms or more".

The timing bet was moved, not removed. If the machine does not wake the test thread up inside the holder's 30 ms, the lock is free before the test thread asks for it and there is no wait at all - the same class of failure as the one this pull request removes. The holder is now started again and the try repeated, five tries at most, and the test fails only when none of them waited. Measured: with the first try asking for the lock 40 ms after the holder let it go, this head passes and the same head with one try fails.

Also: the first half's gate wait is bounded by two seconds now, like the new one, so a worker that dies fails the test instead of hanging it.

On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 749 passed and 0 failed each; default suite 667 passed, 1 failed - texture.rs's known race (#2854), which passes alone and is not this test.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7350383578 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7350383578). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T15:28:24Z. --- Second review round, two findings, both fixed in `6a674a118`. **The wait that was measured could have been the wrong one.** The condvar's wait is ended by the same holder that holds the lock, so it names the same waker, and the earlier shape took the latest wait of 10 ms or more - which could be that one. With a holder that waits 10 ms before it signals and keeps the lock for 1 ms, the lock's own wait is 1 ms and the condvar's is 10 ms: the earlier shape picked the condvar's wait, saw the holder as its waker and passed, while the lock's wait was never checked. The wait is now pinned by the ticks around the lock call - the one inside a try's own ticks - and it has to be 10 ms or more. With that same holder the test now fails and says so: "no try of the five waited on the lock for 10 ms or more". **The timing bet was moved, not removed.** If the machine does not wake the test thread up inside the holder's 30 ms, the lock is free before the test thread asks for it and there is no wait at all - the same class of failure as the one this pull request removes. The holder is now started again and the try repeated, five tries at most, and the test fails only when none of them waited. Measured: with the first try asking for the lock 40 ms after the holder let it go, this head passes and the same head with one try fails. Also: the first half's gate wait is bounded by two seconds now, like the new one, so a worker that dies fails the test instead of hanging it. On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 749 passed and 0 failed each; default suite 667 passed, 1 failed - `texture.rs`'s known race (#2854), which passes alone and is not this test.
Neutron-0 commented 2026-12-02 17:29:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T17:29:42Z.


Third round, and the late-waiter window that @merzleckeier reproduced and @Kal0s-design measured is now closed by the recorder itself. New head 1c1f92f80.

What changed. The holder takes the lock first and keeps it. The waiter waits for the word that says so, asks for the lock and blocks inside it. The recorder's own standing() counter for that lock then says that the wait has been reached - the wrapper takes that counter before it waits (hooks.rs:52-58) - and only then does the holder start its hold of 30 ms. So the wait is the holder's hold and not the scheduler's: however late the machine wakes the waiter up, the wait is 30 ms.

The counter is a hash of the address into 4096 slots (record.rs:1422-1428), so another object can share the slot and the holder may see the wait before it is really there. The try is then made again, three tries at most, and the test fails only when none of them waited.

The perturbations both of you used, on this head. The waiter asks for the lock 70 ms late (merzleckeier's delay) - and I put that delay on every try, not only the first: the test passes. The wait cannot be shortened by a late waiter any more, because the hold does not start before the recorder says the wait has begun.

The other hole the second review found is closed too. The wait that is measured is the one inside a try's own ticks (the ticks around the lock call), so the join - a wait of its own - and the first half's condvar wait cannot be mistaken for it. With a holder that keeps the lock for 1 ms, so the wait it measures is too short, the test now fails and says what the trace holds: no try of the 3 waited on the lock for 10 ms or more: [Some(1.2785), Some(1.1458), Some(1.1336)] ms. Those are the recorded waits, not the wall clock around the lock call - the earlier message mixed the two up, which made it read as a contradiction.

The 10 ms floor is a liveness floor, not a filter, and the comment says so: a wait of a few microseconds is the lock being free, and is not recorded at all.

@MoonEyes, on the in-game run. This pull request changes one test function inside #[cfg(test)] in d3d12/crates/leonida-gpu/src/timeline/report.rs, and the whole diff is that one file. There is no product code in it: the recorder, the wrappers and the report are untouched, so nothing here can change what the title renders, and there is nothing in it for an in-game run to catch. The test itself only compiles with --features diagnostics (timeline.rs:42-47), so the default CI job does not build it either. If a maintainer still wants a run on this head, that is their call - I have no game files here.

On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 748 passed and 1 failed then 749 passed and 0 failed - the failure was texture.rs's known parallel race (#2854), which passes alone and is not this test; default suite 668 passed, 0 failed; clippy says nothing in this file.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353359116 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7353359116). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T17:29:42Z. --- Third round, and the late-waiter window that @merzleckeier reproduced and @Kal0s-design measured is now closed by the recorder itself. New head `1c1f92f80`. **What changed.** The holder takes the lock first and keeps it. The waiter waits for the word that says so, asks for the lock and blocks inside it. The recorder's own `standing()` counter for that lock then says that the wait has been reached - the wrapper takes that counter before it waits (`hooks.rs:52-58`) - and only then does the holder start its hold of 30 ms. So the wait is the holder's hold and not the scheduler's: however late the machine wakes the waiter up, the wait is 30 ms. The counter is a hash of the address into 4096 slots (`record.rs:1422-1428`), so another object can share the slot and the holder may see the wait before it is really there. The try is then made again, three tries at most, and the test fails only when none of them waited. **The perturbations both of you used, on this head.** The waiter asks for the lock 70 ms late (merzleckeier's delay) - and I put that delay on *every* try, not only the first: the test passes. The wait cannot be shortened by a late waiter any more, because the hold does not start before the recorder says the wait has begun. **The other hole the second review found is closed too.** The wait that is measured is the one inside a try's own ticks (the ticks around the lock call), so the join - a wait of its own - and the first half's condvar wait cannot be mistaken for it. With a holder that keeps the lock for 1 ms, so the wait it measures is too short, the test now fails and says what the trace holds: `no try of the 3 waited on the lock for 10 ms or more: [Some(1.2785), Some(1.1458), Some(1.1336)] ms`. Those are the recorded waits, not the wall clock around the lock call - the earlier message mixed the two up, which made it read as a contradiction. The 10 ms floor is a liveness floor, not a filter, and the comment says so: a wait of a few microseconds is the lock being free, and is not recorded at all. **@MoonEyes, on the in-game run.** This pull request changes one test function inside `#[cfg(test)]` in `d3d12/crates/leonida-gpu/src/timeline/report.rs`, and the whole diff is that one file. There is no product code in it: the recorder, the wrappers and the report are untouched, so nothing here can change what the title renders, and there is nothing in it for an in-game run to catch. The test itself only compiles with `--features diagnostics` (`timeline.rs:42-47`), so the default CI job does not build it either. If a maintainer still wants a run on this head, that is their call - I have no game files here. On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 748 passed and 1 failed then 749 passed and 0 failed - the failure was `texture.rs`'s known parallel race (#2854), which passes alone and is not this test; default suite 668 passed, 0 failed; clippy says nothing in this file.
MoonEyes commented 2026-12-02 18:00:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:00:25Z.


Code review of the new head 1c1f92f80 (third round, pushed 17:29 UTC today; merge base 0ae5a2664, merges cleanly into current main 45dc41f95). Not built: leonida-gpu's timeline hooks are Windows-only. No CI run exists on this head yet; the Windows runs in this thread are on 3f6545b0b and 6a674a118, not on this head.

1 file: d3d12/crates/leonida-gpu/src/timeline/report.rs  +88/-19 (test only)

What changed in this round: the holder takes the lock, sets taken, then spins on record::stood_at(object) (the recorder's per-object STOOD_AT counter, record.rs:1426-1449, incremented by hooks::wait before the real wait, hooks.rs:52-58) before it starts its 30 ms hold. Three tries, the first one with a wait of 10 ms or more inside its own [at, locked] ticks must name the holder as waker. That removes the scheduler bet that @ecox982745 and @merzleckeier showed for the earlier heads: the hold only starts once the waiter is provably inside the wait.

Points to check on Windows before merge

  1. object assumes the std Mutex's futex word sits at the Mutex's own address. let object = &*lock as *const Mutex<()> as u64; is compared with the address hooks::wait receives, which for a contended std::sync::Mutex is the address of its internal futex passed to WaitOnAddress. std::sync::Mutex<T> is { inner: sys::Mutex, poison: Flag, data } without repr(C), so the field order (and thus whether the futex is at offset 0) is the compiler's choice, and place() is a Fibonacci hash of the exact address, so a 1-byte offset lands in another slot. If it does not match, every try returns None after 2 s and the test fails with "the waiter did not reach the lock's wait". It passes for the author on 1.98.1, so it probably holds today, but it rests on std internals. A one-line note in the test, or deriving object from a recorded wait rather than from the Mutex pointer, would make that explicit.
  2. Hash-slot sharing is handled by up to three tries, as the comment says. With the test holding TEST_GLOBAL_LOCK, the only other standing waits during the try are this test's own threads, so the retry is enough.
  3. The 2-second deadlines turn a hang into a failure with a message in both directions, which is good for CI.

Relation to #2933: both PRs fix the same flaky test (real_waits_are_recorded_with_who_ended_them) under different claim IDs. #2933 still sleeps 50 ms after a ready flag that is set before lock(), so its waiter can be descheduled between the flag and the lock: the same window this PR closes. Only one should land; this one is the stronger fix.

Not run here. Before merge: one Windows run of cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1 and the full-parallel run on 1c1f92f80 merged onto main, ideally repeated (it is a flake fix), plus the CI approval.

Verdict: ready pending a Windows run on the current head (no defect found in the code; the open point is the std-layout assumption in 1).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353853493 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7353853493). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:00:25Z. --- **Code review of the new head `1c1f92f80` (third round, pushed 17:29 UTC today; merge base `0ae5a2664`, merges cleanly into current `main` `45dc41f95`). Not built: `leonida-gpu`'s timeline hooks are Windows-only. No CI run exists on this head yet; the Windows runs in this thread are on `3f6545b0b` and `6a674a118`, not on this head.** ``` 1 file: d3d12/crates/leonida-gpu/src/timeline/report.rs +88/-19 (test only) ``` **What changed in this round:** the holder takes the lock, sets `taken`, then spins on `record::stood_at(object)` (the recorder's per-object `STOOD_AT` counter, `record.rs:1426-1449`, incremented by `hooks::wait` before the real wait, `hooks.rs:52-58`) before it starts its 30 ms hold. Three tries, the first one with a wait of 10 ms or more inside its own `[at, locked]` ticks must name the holder as waker. That removes the scheduler bet that @ecox982745 and @merzleckeier showed for the earlier heads: the hold only starts once the waiter is provably inside the wait. **Points to check on Windows before merge** 1. **`object` assumes the std `Mutex`'s futex word sits at the `Mutex`'s own address.** `let object = &*lock as *const Mutex<()> as u64;` is compared with the address `hooks::wait` receives, which for a contended `std::sync::Mutex` is the address of its internal futex passed to `WaitOnAddress`. `std::sync::Mutex<T>` is `{ inner: sys::Mutex, poison: Flag, data }` without `repr(C)`, so the field order (and thus whether the futex is at offset 0) is the compiler's choice, and `place()` is a Fibonacci hash of the exact address, so a 1-byte offset lands in another slot. If it does not match, every try returns `None` after 2 s and the test fails with "the waiter did not reach the lock's wait". It passes for the author on 1.98.1, so it probably holds today, but it rests on std internals. A one-line note in the test, or deriving `object` from a recorded wait rather than from the `Mutex` pointer, would make that explicit. 2. **Hash-slot sharing** is handled by up to three tries, as the comment says. With the test holding `TEST_GLOBAL_LOCK`, the only other standing waits during the try are this test's own threads, so the retry is enough. 3. The 2-second deadlines turn a hang into a failure with a message in both directions, which is good for CI. **Relation to #2933:** both PRs fix the same flaky test (`real_waits_are_recorded_with_who_ended_them`) under different claim IDs. #2933 still sleeps 50 ms after a `ready` flag that is set before `lock()`, so its waiter can be descheduled between the flag and the lock: the same window this PR closes. Only one should land; this one is the stronger fix. **Not run here.** Before merge: one Windows run of `cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1` and the full-parallel run on `1c1f92f80` merged onto `main`, ideally repeated (it is a flake fix), plus the CI approval. **Verdict: ready pending a Windows run on the current head** (no defect found in the code; the open point is the std-layout assumption in 1). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
Neutron-0 commented 2026-12-02 18:07:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-02T18:07:58Z.


Fourth round: the roles are the stock ones again, and the wording now says only what the code does. New head 6934967a0.

What changed since the last round. The test thread is the holder again, as in the original test: it takes the lock, spawns the waiter, and the waiter asks for the lock and blocks inside it. The recorder's standing() counter for that lock says when the waiter has reached that wait, and only then does the holder start its hold of 30 ms. So:

  • the measured wait is on the freshly spawned thread again, and the waiter's first recorded event is the contended lock's Wait - the coverage the earlier head gave up;
  • the holder needs one thing only, the recorder's word, so the word-flag and the second spin loop are gone;
  • the wait that is measured is the one on this lock inside a sample's own ticks, so the waiter's own sleeps, the join and the first half's condvar wait cannot be mistaken for it.

The key the test uses is the mutex's own address. A temporary probe showed that the recorded wait's object field equals it exactly, and the selection now filters on that object, so a wait on something else cannot be measured by mistake.

The waits are still three samples, not three retries: the counter is a hash of the address into 4096 slots and the recorder is process-wide, so another waiter or a timer can share the slot and the hold can begin before the waiter is really there. The test fails only when none of the three waited, and the failure message says how many samples the recorder reported at the lock's object:

no sample of the 3 waited on the lock for 10 ms or more: ["1.30", "1.08", "1.25"] ms;
the recorder reported the waiter at the lock's object in 3 of them

Those are the recorded waits, not the wall clock around the lock call - the earlier message mixed the two up, which made it read as a contradiction.

The perturbations both of you used, on this head. The waiter thread starts 70 ms late (merzleckeier's delay) - I put that delay on every sample, not only the first: the test passes. The wait cannot be shortened by a late waiter any more, because the hold does not start before the recorder says the wait has begun.

On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 749 passed and 0 failed both times; default suite 667 passed, 1 failed - the known texture.rs parallel race (#2854), which passes alone and is not this test; clippy says nothing in this file.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353984010 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7353984010). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-02T18:07:58Z. --- Fourth round: the roles are the stock ones again, and the wording now says only what the code does. New head `6934967a0`. **What changed since the last round.** The test thread is the holder again, as in the original test: it takes the lock, spawns the waiter, and the waiter asks for the lock and blocks inside it. The recorder's `standing()` counter for that lock says when the waiter has reached that wait, and only then does the holder start its hold of 30 ms. So: - the measured wait is on the freshly spawned thread again, and the waiter's first recorded event is the contended lock's Wait - the coverage the earlier head gave up; - the holder needs one thing only, the recorder's word, so the word-flag and the second spin loop are gone; - the wait that is measured is the one *on this lock* inside a sample's own ticks, so the waiter's own sleeps, the join and the first half's condvar wait cannot be mistaken for it. The key the test uses is the mutex's own address. A temporary probe showed that the recorded wait's `object` field equals it exactly, and the selection now filters on that object, so a wait on something else cannot be measured by mistake. The waits are still three samples, not three retries: the counter is a hash of the address into 4096 slots and the recorder is process-wide, so another waiter or a timer can share the slot and the hold can begin before the waiter is really there. The test fails only when none of the three waited, and the failure message says how many samples the recorder reported at the lock's object: ``` no sample of the 3 waited on the lock for 10 ms or more: ["1.30", "1.08", "1.25"] ms; the recorder reported the waiter at the lock's object in 3 of them ``` Those are the recorded waits, not the wall clock around the lock call - the earlier message mixed the two up, which made it read as a contradiction. **The perturbations both of you used, on this head.** The waiter thread starts 70 ms late (merzleckeier's delay) - I put that delay on every sample, not only the first: the test passes. The wait cannot be shortened by a late waiter any more, because the hold does not start before the recorder says the wait has begun. On this head: the test 20 of 20 runs; whole diagnostics suite 2 runs, 749 passed and 0 failed both times; default suite 667 passed, 1 failed - the known `texture.rs` parallel race (#2854), which passes alone and is not this test; clippy says nothing in this file.
MoonEyes commented 2026-12-02 22:01:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T22:01:13Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360109733 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7360109733). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T22:01:13Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
fiestorra commented 2026-12-02 22:30:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T22:30:28Z.


VERIFY-3050 — Windows nativo: 15 pruebas del informe pasan, y la trampa de diagnostics otra vez

Head (this PR)
Merge base 0ae5a2664 (behind main b41763227)
Merged onto main — merge-tree clean, git merge --no-ff clean

Ran

cargo test -p leonida-gpu --lib --features diagnostics report     15 passed; 0 failed

The trap, recorded because it bit me twice tonight (#3005 was the other): mod report is #[cfg(all(windows, feature = "diagnostics"))] (timeline.rs:46). Without --features diagnostics the module is not compiled, and cargo test -p leonida-gpu --lib report answers 0 passed; 762 filtered out with exit 0 — a verifier would record "no tests" for fifteen.

What the change is: the stall-report test's worker wait is now a bounded one —

let (guard, timeout) = gate.1.wait_timeout(open, std::time::Duration::from_secs(2)).unwrap();
open = guard;
assert!(!timeout.timed_out(), "the worker did not finish within two seconds");

— so a worker that never signals fails the test in two seconds instead of hanging the suite, which is what the old blocking wait did. The contended-lock part of the test is reworked with it.

Negative control (synthetic): I set the timeout to Duration::ZERO so the wait expires at once:

FAILED: real_waits_are_recorded_with_who_ended_them
the worker did not finish within two seconds

The assertion is live and its message is accurate — the worker does not finish within a zero-length wait. What I did not build is the honest other half: the unbounded wait with a worker that never signals, because that control hangs the runner (which is precisely the failure this PR removes) and needs a harness timeout to observe.

What I could not test

  • The hang it prevents: a stalled worker in the real timeline. No title, and the control that would show it hangs the suite by construction.
  • The rest of the diagnostics suite: 828 filtered out — only the report module was run under the feature.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7360786832 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7360786832). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T22:30:28Z. --- ## VERIFY-3050 — Windows nativo: 15 pruebas del informe pasan, y **la trampa de `diagnostics` otra vez** | | | |---|---| | Head | `(this PR)` | | Merge base | `0ae5a2664` (behind `main` `b41763227`) | | Merged onto | `main` — `merge-tree` clean, `git merge --no-ff` clean | **Ran** ``` cargo test -p leonida-gpu --lib --features diagnostics report 15 passed; 0 failed ``` **The trap, recorded because it bit me twice tonight** (#3005 was the other): `mod report` is `#[cfg(all(windows, feature = "diagnostics"))]` (`timeline.rs:46`). **Without `--features diagnostics` the module is not compiled**, and `cargo test -p leonida-gpu --lib report` answers **`0 passed; 762 filtered out`** with **exit 0** — a verifier would record "no tests" for fifteen. **What the change is**: the stall-report test's worker wait is now a bounded one — ```rust let (guard, timeout) = gate.1.wait_timeout(open, std::time::Duration::from_secs(2)).unwrap(); open = guard; assert!(!timeout.timed_out(), "the worker did not finish within two seconds"); ``` — **so a worker that never signals fails the test in two seconds instead of hanging the suite**, which is what the old blocking `wait` did. The contended-lock part of the test is reworked with it. **Negative control (synthetic)**: I set the timeout to `Duration::ZERO` so the wait expires at once: ``` FAILED: real_waits_are_recorded_with_who_ended_them the worker did not finish within two seconds ``` **The assertion is live and its message is accurate** — the worker does not finish within a zero-length wait. **What I did not build is the honest other half**: the *unbounded* wait with a worker that never signals, because that control **hangs the runner** (which is precisely the failure this PR removes) and needs a harness timeout to observe. ## What I could not test - **The hang it prevents**: a stalled worker in the real timeline. No title, and the control that would show it hangs the suite by construction. - **The rest of the `diagnostics` suite**: 828 filtered out — only the report module was run under the feature. Written with an AI assistant.
MoonEyes commented 2026-12-03 00:38:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T00:38:29Z.


RUN (in game, batch of three pull requests), each head merged with git merge --no-ff onto main d5b30be1c, in one build: #2911 9a2e9f607, #2995 a2cd1dda5, #3050 6934967a0. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, -PrecompileUsed, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.6, mean 16.7
Rendered fps, last 120 s median 17.1
Time under 5 fps in the world 0 %

For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; arrival in the world was driven by keys and not checked on pictures; -PrecompileUsed was used, so the default start (every known pipeline precompiled) was not exercised. #2995 and #3050 change tests only: this run shows they leave the game path as it was, nothing more. #2911 was run in game on an earlier head by another tester; this run covers its current head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363421392 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7363421392). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T00:38:29Z. --- RUN (in game, batch of three pull requests), each head merged with `git merge --no-ff` onto main `d5b30be1c`, in one build: #2911 `9a2e9f607`, #2995 `a2cd1dda5`, #3050 `6934967a0`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, `-PrecompileUsed`, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.6, mean 16.7 | | Rendered fps, last 120 s | median 17.1 | | Time under 5 fps in the world | 0 % | For reference, the same machine and route rendered 13.3 to 17.2 fps on other batches in the last day. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; arrival in the world was driven by keys and not checked on pictures; `-PrecompileUsed` was used, so the default start (every known pipeline precompiled) was not exercised. #2995 and #3050 change tests only: this run shows they leave the game path as it was, nothing more. #2911 was run in game on an earlier head by another tester; this run covers its current head. AI-assisted (Claude Code).
merzleckeier commented 2026-12-03 00:59:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T00:59:28Z.

Review: COMMENTED


I rebuilt 6934967a merged onto d5b30be1 with Rust 1.98.1 and Windows MSVC, then ran it under Wine 11.22 with the original adjacent PDB. All six timeline::report::tests:: tests passed on the unmodified source, including the symbol-name and waker assertions. In a disposable copy, delaying every waiter by 70 ms before lock() also passed 3/3. The subsequent #3230 merge to 1a163523 changes the launcher, docs and launcher tests. The #3050 merge remains clean and its Rust sources and Cargo inputs are identical across those two bases.

One remaining case is reproducible. I used the same delay and held a record::standing() guard for a different synthetic object in the same bucket for all three samples. It failed 3/3 with recorded lengths ["-", "-", "-"], while the diagnostic reported the waiter at the object in all three samples. Each sample uses the same mutex address and therefore the same bucket. A single long-lived collision can make all three holds start before their waiter reaches the lock.

This is a test-only false negative under the forced collision. A test-only per-waiter signal from the actual standing() call would make the handshake independent of the shared bucket and preserve the existing trace assertions. All probes were synthetic. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6161845314 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#pullrequestreview-6161845314). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T00:59:28Z. **Review:** COMMENTED --- I rebuilt `6934967a` merged onto `d5b30be1` with Rust 1.98.1 and Windows MSVC, then ran it under Wine 11.22 with the original adjacent PDB. All six `timeline::report::tests::` tests passed on the unmodified source, including the symbol-name and waker assertions. In a disposable copy, delaying every waiter by 70 ms before `lock()` also passed 3/3. The subsequent #3230 merge to `1a163523` changes the launcher, docs and launcher tests. The #3050 merge remains clean and its Rust sources and Cargo inputs are identical across those two bases. One remaining case is reproducible. I used the same delay and held a `record::standing()` guard for a different synthetic object in the same bucket for all three samples. It failed 3/3 with recorded lengths `["-", "-", "-"]`, while the diagnostic reported the waiter at the object in all three samples. Each sample uses the same mutex address and therefore the same bucket. A single long-lived collision can make all three holds start before their waiter reaches the lock. This is a test-only false negative under the forced collision. A test-only per-waiter signal from the actual `standing()` call would make the handshake independent of the shared bucket and preserve the existing trace assertions. All probes were synthetic. AI-assisted with OpenAI Codex.
Neutron-0 commented 2026-12-03 05:42:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-03T05:42:36Z.


Windows run report on the current head (f95dc3224), as asked.

  • Head: f95dc3224. It merges cleanly into the current main 45dc41f95 (git merge-tree writes a tree with no conflict; the branch's base is 0ae5a2664).
  • Machine: Windows 11, AMD 780M iGPU, Rust 1.98.1 (the toolchain d3d12/rust-toolchain.toml pins). No GPU and no game files are used by this test: it is the diagnostics recorder's own test, on the CPU.
  • cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1: 6 passed, 0 failed, 59 ignored, 1.20 s.
  • The whole diagnostics suite in parallel, five times in a row (cargo test -p leonida-gpu --lib --locked --features diagnostics):
    • run 1: 749 passed, 0 failed, 59 ignored (31.66 s)
    • run 2: 749 passed, 0 failed, 59 ignored (28.86 s)
    • run 3: 748 passed, 1 failed - descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync, the known parallel race in descriptor.rs that D3D12-GPU-TEST-PARALLEL-FLAKES covers (claimed by lixonik); it is not this test
    • run 4: 749 passed, 0 failed, 59 ignored (28.96 s)
    • run 5: 749 passed, 0 failed, 59 ignored (31.23 s)
  • The same suite five more times on the previous head (6934967a0, the same test with only the note below added since): four runs clean, one with the known watch.rs race (watch::tests::a_write_opens_the_view_it_goes_through, the same item). Ten parallel runs in all, and this test failed in none of them.

On your point 1 (the std-layout assumption). The head now filters the measured wait on the recorder's own object, so a different layout cannot be measured by mistake, and the failure message says how many samples the recorder reported at the lock's object - none of them if the key is wrong. The assumption is written down in the test as well:

// The recorder's key for this lock is the address of the wait primitive inside the
// mutex, which is the mutex's own address in this toolchain's standard library. The
// selection below filters on that key, so if the layout ever moves the wait, this test
// fails and says the recorder reported the waiter in none of the samples.

About the in-game run in your first comment: this pull request changes one test function inside #[cfg(test)] in d3d12/crates/leonida-gpu/src/timeline/report.rs, and the whole diff is that one file. There is no product code in it - the recorder, the wrappers and the report are untouched - so it cannot change what the title renders, and there is nothing in it for an in-game run to catch. The test only compiles with --features diagnostics, so the default CI job does not build it either. I have no game files here, so I cannot post a run in the world; if you want one on this head anyway, that is your call.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369028588 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7369028588). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-03T05:42:36Z. --- **Windows run report on the current head** (`f95dc3224`), as asked. - Head: `f95dc3224`. It merges cleanly into the current `main` `45dc41f95` (`git merge-tree` writes a tree with no conflict; the branch's base is `0ae5a2664`). - Machine: Windows 11, AMD 780M iGPU, Rust 1.98.1 (the toolchain `d3d12/rust-toolchain.toml` pins). No GPU and no game files are used by this test: it is the diagnostics recorder's own test, on the CPU. - `cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1`: 6 passed, 0 failed, 59 ignored, 1.20 s. - The whole diagnostics suite in parallel, five times in a row (`cargo test -p leonida-gpu --lib --locked --features diagnostics`): - run 1: 749 passed, 0 failed, 59 ignored (31.66 s) - run 2: 749 passed, 0 failed, 59 ignored (28.86 s) - run 3: 748 passed, 1 failed - `descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync`, the known parallel race in `descriptor.rs` that `D3D12-GPU-TEST-PARALLEL-FLAKES` covers (claimed by lixonik); it is not this test - run 4: 749 passed, 0 failed, 59 ignored (28.96 s) - run 5: 749 passed, 0 failed, 59 ignored (31.23 s) - The same suite five more times on the previous head (`6934967a0`, the same test with only the note below added since): four runs clean, one with the known `watch.rs` race (`watch::tests::a_write_opens_the_view_it_goes_through`, the same item). Ten parallel runs in all, and this test failed in none of them. **On your point 1 (the std-layout assumption).** The head now filters the measured wait on the recorder's own object, so a different layout cannot be measured by mistake, and the failure message says how many samples the recorder reported at the lock's object - none of them if the key is wrong. The assumption is written down in the test as well: ``` // The recorder's key for this lock is the address of the wait primitive inside the // mutex, which is the mutex's own address in this toolchain's standard library. The // selection below filters on that key, so if the layout ever moves the wait, this test // fails and says the recorder reported the waiter in none of the samples. ``` About the in-game run in your first comment: this pull request changes one test function inside `#[cfg(test)]` in `d3d12/crates/leonida-gpu/src/timeline/report.rs`, and the whole diff is that one file. There is no product code in it - the recorder, the wrappers and the report are untouched - so it cannot change what the title renders, and there is nothing in it for an in-game run to catch. The test only compiles with `--features diagnostics`, so the default CI job does not build it either. I have no game files here, so I cannot post a run in the world; if you want one on this head anyway, that is your call.
Neutron-0 commented 2026-12-03 06:09:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-03T06:09:50Z.


Head moved to 856320528 - the only changes since the head MoonEyes ran in game (6934967a0) are three comments and the wording of one assertion message; no code path changed.

  • report.rs:1457-1460: the note on the recorder's key for the lock (the one MoonEyes asked for).
  • report.rs:1473-1475: the comment on the two-second bound now says what is true - a waiter that never arrives is reported as not reached instead of hanging the spin, and the join below still waits for the waiter to finish, which it does once the lock is released.
  • report.rs:1521-1522: the failure message now says "the recorder's counter saw the waiter's key in N of them" instead of "the recorder reported the waiter at the lock's object in N of them" - in the case where the standard library's layout moves the wait primitive, the recorder did record the wait, just under another key, so the old wording was not exact.

Those are the two optional findings of the fifth review round (GLM-5.3 Flash via NVIDIA, verdict PASS-with-nits, no must-fixes). The third optional finding (a named struct instead of a 4-tuple) and the fourth (the 4096-slot table can make released() record a phantom wake) are test-local and deliberately left alone; the second is in record.rs, which this pull request does not touch.

Windows run report on 856320528

  • Head: 856320528. It merges cleanly into the current main d9b618f10 (git merge-tree writes a tree with no conflict; the branch's base is 0ae5a2664).
  • Machine: Windows 11, AMD 780M iGPU, Rust 1.98.1 (the toolchain d3d12/rust-toolchain.toml pins). No GPU and no game files are used by this test: it is the diagnostics recorder's own test, on the CPU.
  • cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1: 6 passed, 0 failed, 59 ignored, 1.19 s.
  • The whole diagnostics suite in parallel, five times in a row (cargo test -p leonida-gpu --lib --locked --features diagnostics):
    • run 1: 748 passed, 1 failed - texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers, the parallel race #2854 fixes; it is not this test
    • run 2: 749 passed, 0 failed, 59 ignored (29.14 s)
    • run 3: 749 passed, 0 failed, 59 ignored (30.42 s)
    • run 4: 749 passed, 0 failed, 59 ignored (30.34 s)
    • run 5: 749 passed, 0 failed, 59 ignored (30.26 s)

With the five runs on the previous head and the five before that, fifteen parallel runs of the suite over three heads of this branch, and this test failed in none of them. The three failures were each a different known parallel race in this crate (descriptor.rs, watch.rs, texture.rs), all claimed elsewhere - D3D12-GPU-TEST-PARALLEL-FLAKES covers the first two and #2854 the third.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369524360 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7369524360). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-03T06:09:50Z. --- **Head moved to `856320528`** - the only changes since the head MoonEyes ran in game (`6934967a0`) are three comments and the wording of one assertion message; no code path changed. - `report.rs:1457-1460`: the note on the recorder's key for the lock (the one MoonEyes asked for). - `report.rs:1473-1475`: the comment on the two-second bound now says what is true - a waiter that never arrives is reported as not reached instead of hanging the spin, and the join below still waits for the waiter to finish, which it does once the lock is released. - `report.rs:1521-1522`: the failure message now says "the recorder's counter saw the waiter's key in N of them" instead of "the recorder reported the waiter at the lock's object in N of them" - in the case where the standard library's layout moves the wait primitive, the recorder did record the wait, just under another key, so the old wording was not exact. Those are the two optional findings of the fifth review round (GLM-5.3 Flash via NVIDIA, verdict PASS-with-nits, no must-fixes). The third optional finding (a named struct instead of a 4-tuple) and the fourth (the 4096-slot table can make `released()` record a phantom wake) are test-local and deliberately left alone; the second is in `record.rs`, which this pull request does not touch. **Windows run report on `856320528`** - Head: `856320528`. It merges cleanly into the current `main` `d9b618f10` (`git merge-tree` writes a tree with no conflict; the branch's base is `0ae5a2664`). - Machine: Windows 11, AMD 780M iGPU, Rust 1.98.1 (the toolchain `d3d12/rust-toolchain.toml` pins). No GPU and no game files are used by this test: it is the diagnostics recorder's own test, on the CPU. - `cargo test -p leonida-gpu --features diagnostics --lib timeline::report -- --test-threads=1`: 6 passed, 0 failed, 59 ignored, 1.19 s. - The whole diagnostics suite in parallel, five times in a row (`cargo test -p leonida-gpu --lib --locked --features diagnostics`): - run 1: 748 passed, 1 failed - `texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers`, the parallel race #2854 fixes; it is not this test - run 2: 749 passed, 0 failed, 59 ignored (29.14 s) - run 3: 749 passed, 0 failed, 59 ignored (30.42 s) - run 4: 749 passed, 0 failed, 59 ignored (30.34 s) - run 5: 749 passed, 0 failed, 59 ignored (30.26 s) With the five runs on the previous head and the five before that, fifteen parallel runs of the suite over three heads of this branch, and this test failed in none of them. The three failures were each a different known parallel race in this crate (`descriptor.rs`, `watch.rs`, `texture.rs`), all claimed elsewhere - `D3D12-GPU-TEST-PARALLEL-FLAKES` covers the first two and #2854 the third.
Neutron-0 commented 2026-12-03 12:57:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-03T12:57:11Z.


@merzleckeier - the case you forced is fixed in the new head, and your probe is what shows it.

What you forced. A record::standing() guard for a different object in the same bucket of the recorder's table, held for the whole test, and a waiter 70 ms late. Every sample used the same mutex, so every sample shared one bucket: the holder's hold began before the waiter was really inside the wait, and the test failed 3 of 3.

What changed. Each sample has a lock of its own now:

let locks: Vec<Arc<Mutex<()>>> = (0..3).map(|_| Arc::new(Mutex::new(()))).collect();

The recorder's key is computed per sample, and the trace filter uses that sample's key (w.object == *object). The three locks are alive at the same time, so their addresses differ and their buckets differ. A collision of your kind now reaches one sample and not all of them, and the test fails only when none of the samples waited.

Your probe on both heads. The probe is a test-only change: a standing guard for a different object in the same bucket as the first lock, held for the whole test, plus the 70 ms delay on the waiter.

  • head 856320528: FAILED, no sample of the 3 waited on the lock for 10 ms or more: ["-", "-", "-"] ms; the recorder's counter saw the waiter's key in 3 of them - the same shape you reported.
  • head 47d95f543: ok, 5 of 5 runs.

On the per-waiter signal you propose. A signal from the actual standing() call is the clean fix, but it has to come from the recorder: record::standing() counts per hash bucket, and only the recorder knows which thread stood there. Making it per waiter is a change in record.rs, which is not test code, and this pull request is test-only on purpose - that is what keeps @MoonEyes's in-game gate on solid ground ("nothing in it can change what the title renders"). I did not want to widen this pull request's scope for it, so I made the samples independent of each other instead.

If you want the recorder-level signal, say so and I will do it as a separate pull request: a d3d12: one, with the recorder change and a test of its own.

On the head. 47d95f543 is the new head. Since the head @MoonEyes ran in game (6934967a0) the changes are three comments, the wording of one assertion message, and this per-sample-lock change - still only test code, and the whole diff is still the one file.

Evidence on the new head (Windows 11, AMD 780M iGPU, Rust 1.98.1; no game files and no GPU are used by this test):

  • cargo test -p leonida-gpu --lib --locked --features diagnostics timeline::report::tests::real_waits: 20 of 20 runs ok.
  • Whole diagnostics suite (cargo test -p leonida-gpu --lib --locked --features diagnostics): 3 runs - two clean, 749 passed and 0 failed, 59 ignored each, and one with watch.rs's known parallel race (watch::many_askers_tests::no_mapping_is_lost_between_askers, claimed under D3D12-GPU-TEST-PARALLEL-FLAKES), 748 passed and 1 failed. This test failed in none of them.
  • cargo clippy -p leonida-gpu --lib --features diagnostics --tests: nothing in this file (the crate's 10 warnings are in other files, on this old base).

AI-assisted: yes (MiniMax M3.1 Flash via OpenCode wrote the change; separate read-only review agents audited it).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7379091385 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7379091385). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-03T12:57:11Z. --- @merzleckeier - the case you forced is fixed in the new head, and your probe is what shows it. **What you forced.** A `record::standing()` guard for a different object in the same bucket of the recorder's table, held for the whole test, and a waiter 70 ms late. Every sample used the same mutex, so every sample shared one bucket: the holder's hold began before the waiter was really inside the wait, and the test failed 3 of 3. **What changed.** Each sample has a lock of its own now: ```rust let locks: Vec<Arc<Mutex<()>>> = (0..3).map(|_| Arc::new(Mutex::new(()))).collect(); ``` The recorder's key is computed per sample, and the trace filter uses that sample's key (`w.object == *object`). The three locks are alive at the same time, so their addresses differ and their buckets differ. A collision of your kind now reaches one sample and not all of them, and the test fails only when none of the samples waited. **Your probe on both heads.** The probe is a test-only change: a standing guard for a different object in the same bucket as the first lock, held for the whole test, plus the 70 ms delay on the waiter. - head `856320528`: FAILED, `no sample of the 3 waited on the lock for 10 ms or more: ["-", "-", "-"] ms; the recorder's counter saw the waiter's key in 3 of them` - the same shape you reported. - head `47d95f543`: ok, 5 of 5 runs. **On the per-waiter signal you propose.** A signal from the actual `standing()` call is the clean fix, but it has to come from the recorder: `record::standing()` counts per hash bucket, and only the recorder knows which thread stood there. Making it per waiter is a change in `record.rs`, which is not test code, and this pull request is test-only on purpose - that is what keeps @MoonEyes's in-game gate on solid ground ("nothing in it can change what the title renders"). I did not want to widen this pull request's scope for it, so I made the samples independent of each other instead. If you want the recorder-level signal, say so and I will do it as a separate pull request: a `d3d12:` one, with the recorder change and a test of its own. **On the head.** `47d95f543` is the new head. Since the head @MoonEyes ran in game (`6934967a0`) the changes are three comments, the wording of one assertion message, and this per-sample-lock change - still only test code, and the whole diff is still the one file. **Evidence on the new head** (Windows 11, AMD 780M iGPU, Rust 1.98.1; no game files and no GPU are used by this test): - `cargo test -p leonida-gpu --lib --locked --features diagnostics timeline::report::tests::real_waits`: 20 of 20 runs ok. - Whole diagnostics suite (`cargo test -p leonida-gpu --lib --locked --features diagnostics`): 3 runs - two clean, 749 passed and 0 failed, 59 ignored each, and one with `watch.rs`'s known parallel race (`watch::many_askers_tests::no_mapping_is_lost_between_askers`, claimed under `D3D12-GPU-TEST-PARALLEL-FLAKES`), 748 passed and 1 failed. This test failed in none of them. - `cargo clippy -p leonida-gpu --lib --features diagnostics --tests`: nothing in this file (the crate's 10 warnings are in other files, on this old base). AI-assisted: yes (MiniMax M3.1 Flash via OpenCode wrote the change; separate read-only review agents audited it).
merzleckeier commented 2026-12-03 12:58:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T12:58:27Z.


Thanks, the test-only change resolves my review point. I rechecked 47d95f54 on main b053a181 with Rust 1.98.1 targeting Windows MSVC under Wine 11.22. The unmodified build passed all 17 timeline tests, including the symbol-name and waker assertions.

For the collision, I built a separate test copy of each head on the same base. One synthetic object occupied the first lock’s recorder bucket. In any sample where that bucket was already occupied, I held the waiter until after the holder released its lock. This makes the false signal deterministic without relying on a fixed startup delay.

  • 6934967a: all three samples saw the occupied bucket and the original assertion failed in 3/3 runs.
  • 47d95f54: only the first sample saw the occupied bucket. The existing assertion found a wait of at least 10 ms and attributed it to the correct waker in 5/5 runs.

These runs exercised the CPU diagnostics on the current head. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7379122878 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7379122878). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T12:58:27Z. --- Thanks, the test-only change resolves my review point. I rechecked `47d95f54` on `main` `b053a181` with Rust 1.98.1 targeting Windows MSVC under Wine 11.22. The unmodified build passed all 17 timeline tests, including the symbol-name and waker assertions. For the collision, I built a separate test copy of each head on the same base. One synthetic object occupied the first lock’s recorder bucket. In any sample where that bucket was already occupied, I held the waiter until after the holder released its lock. This makes the false signal deterministic without relying on a fixed startup delay. - `6934967a`: all three samples saw the occupied bucket and the original assertion failed in 3/3 runs. - `47d95f54`: only the first sample saw the occupied bucket. The existing assertion found a wait of at least 10 ms and attributed it to the correct waker in 5/5 runs. These runs exercised the CPU diagnostics on the current head. AI-assisted (Codex).
Neutron-0 commented 2026-12-03 17:25:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Neutron-0 on 2026-12-03T17:25:00Z.


The three workflow runs on this head are waiting for a maintainer's approval. They are action_required - a fork run of a first-time contributor waits for one: 47109751347 (CI), 47109751317 (No Game Data) and 47109751091 (D3D12 runtime), all on head 47d95f54.

The same workflows ran on this exact head in the contributor's fork, where no approval is needed, and they are green:

run jobs
CI 47158599080 check success, linux-python-and-viewer success, semantic-tests success
No Game Data 47158606629 no-game-data success
D3D12 runtime 47158614758 d3d12 (windows-latest) success

change-scope is the one job that cannot be produced that way: it only runs on a pull_request event (ci.yml:34), so it needs the approval itself.

@merzleckeier has re-verified this head independently: the unmodified build passes all 17 timeline tests on main b053a181 with Rust 1.98.1 targeting Windows MSVC under Wine 11.22, and the probe that forces the recorder's bucket collision fails 3/3 on the old head and passes 5/5 on this one.

Approving the runs (or merging) would let this account open its next pull request: GitHub allows it one open pull request while it is a first-time contributor, and this one holds the slot.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7386472208 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3050#issuecomment-7386472208). Originally posted by [Neutron-0](https://github.com/Neutron-0) on 2026-12-03T17:25:00Z. --- **The three workflow runs on this head are waiting for a maintainer's approval.** They are `action_required` - a fork run of a first-time contributor waits for one: 47109751347 (CI), 47109751317 (No Game Data) and 47109751091 (D3D12 runtime), all on head `47d95f54`. The same workflows ran on this exact head in the contributor's fork, where no approval is needed, and they are green: | run | jobs | |---|---| | [CI 47158599080](https://github.com/Neutron-0/mandy/actions/runs/47158599080) | `check` success, `linux-python-and-viewer` success, `semantic-tests` success | | [No Game Data 47158606629](https://github.com/Neutron-0/mandy/actions/runs/47158606629) | `no-game-data` success | | [D3D12 runtime 47158614758](https://github.com/Neutron-0/mandy/actions/runs/47158614758) | `d3d12 (windows-latest)` success | `change-scope` is the one job that cannot be produced that way: it only runs on a `pull_request` event (`ci.yml:34`), so it needs the approval itself. @merzleckeier has re-verified this head independently: the unmodified build passes all 17 timeline tests on `main` `b053a181` with Rust 1.98.1 targeting Windows MSVC under Wine 11.22, and the probe that forces the recorder's bucket collision fails 3/3 on the old head and passes 5/5 on this one. Approving the runs (or merging) would let this account open its next pull request: GitHub allows it one open pull request while it is a first-time contributor, and this one holds the slot.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3050:upstream-pr/3050'
git switch 'upstream-pr/3050'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3050'
git switch 'upstream-pr/3050'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3050'
git switch 'upstream-pr/3050'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3050'
git switch 'main'
git merge --squash 'upstream-pr/3050'
git switch 'main'
git merge --ff-only 'upstream-pr/3050'
git switch 'main'
git merge 'upstream-pr/3050'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3050
No description provided.