d3d12: save a rolling timeline after a frame stalls (D3D12-STALL-TRACE) #2623

Merged
hardly-relevant merged 1 commit from upstream-pr/2623 into main 2026-11-30 15:58:13 +00:00
hardly-relevant commented 2026-11-29 18:47:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hardly-relevant on 2026-11-29T18:47:23Z.


Claimed as D3D12-STALL-TRACE.

What and why

  • Add an opt-in, bounded rolling history to the native Rust D3D12 timeline. The first qualifying gap between title presents saves a Chrome trace and text summary when the game recovers.
  • Save waits, wakeups and CPU-side submissions with coverage and drop counts. Freeze and write on the background thread after the present closes the producer gate.
  • Keep the existing timed recorder available. Stall captures reserve fresh output files.

Tested

  • Windows: cargo test --locked -p leonida-gpu --features diagnostics passed 619 unit tests plus replay. cargo test --locked -p leonida-gpu passed 544 unit tests. All 17 focused timeline tests passed.
  • Deliberately reintroducing a blocking lock in a temporary checkout caused the contention regression to fail at its timeout in 2.01 s.
  • Two Windows game runs with the feature on base 4364a4fa6 wrote readable capture pairs. The recorded title-present gaps were 1.56 s and 1.06 s. The respective gaps between recorded CPU-side submissions were 1.47 s and 0.965 s.
  • Windows 11, NVIDIA GeForce RTX 4080 Laptop GPU, driver 621.40.

Checklist

  • Based on current main when tested.
  • One topic.
  • Game-data and private-path checks passed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5553915812 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2623). Originally posted by [hardly-relevant](https://github.com/hardly-relevant) on 2026-11-29T18:47:23Z. --- Claimed as [D3D12-STALL-TRACE](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7259058416). ### What and why - Add an opt-in, bounded rolling history to the native Rust D3D12 timeline. The first qualifying gap between title presents saves a Chrome trace and text summary when the game recovers. - Save waits, wakeups and CPU-side submissions with coverage and drop counts. Freeze and write on the background thread after the present closes the producer gate. - Keep the existing timed recorder available. Stall captures reserve fresh output files. ### Tested - Windows: `cargo test --locked -p leonida-gpu --features diagnostics` passed 619 unit tests plus replay. `cargo test --locked -p leonida-gpu` passed 544 unit tests. All 17 focused timeline tests passed. - Deliberately reintroducing a blocking lock in a temporary checkout caused the contention regression to fail at its timeout in 2.01 s. - Two Windows game runs with the feature on base `4364a4fa6` wrote readable capture pairs. The recorded title-present gaps were 1.56 s and 1.06 s. The respective gaps between recorded CPU-side submissions were 1.47 s and 0.965 s. - Windows 11, NVIDIA GeForce RTX 4080 Laptop GPU, driver 621.40. ### Checklist - [x] Based on current main when tested. - [x] One topic. - [x] Game-data and private-path checks passed.
merzleckeier commented 2026-11-29 19:09:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T19:09:03Z.


Independent end-to-end check of 37d2d73d merged onto bcbbd9a9 (tree b07e175e), Windows x64 diagnostics cross-build on CachyOS / Wine 11.22. A test-only emitter called the production environment parser and presented() using synthetic frame boundaries, spans, fence waits, wakeups and CPU submissions.

  • With LEONIDA_TIMELINE_AT=0 and LEONIDA_TIMELINE_STALL_MS=200, three short gaps left the files absent. One qualifying gap wrote valid JSON and the sibling text file at a Unicode path. A second qualifying gap left both files byte-identical. Chrome metadata gives 259.442 ms in the short run and 268.668 ms in the wrapped run.
  • The wrapped run retained exactly 65,536 ring events, counted 52 overwrites, and still emitted both trigger boundaries. The trace includes CPU-side submission timing for fence 703 and labels GPU execution timing unavailable.
  • The existing timed setting produced its own JSON and text pair. The invalid zero threshold left the recorder off and wrote no files.

All four production-path probes passed. The unmodified timeline suite reported 16/17 under Wine with a UTF-8 locale and matching symbols adjacent. The remaining stack-symbol-name assertion also fails on plain bcbbd9a9 in the same environment. The other 16 tests pass with exit 0 when that one case is excluded. Synthetic inputs only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261048692 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2623#issuecomment-7261048692). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T19:09:03Z. --- Independent end-to-end check of `37d2d73d` merged onto `bcbbd9a9` (tree `b07e175e`), Windows x64 diagnostics cross-build on CachyOS / Wine 11.22. A test-only emitter called the production environment parser and `presented()` using synthetic frame boundaries, spans, fence waits, wakeups and CPU submissions. - With `LEONIDA_TIMELINE_AT=0` and `LEONIDA_TIMELINE_STALL_MS=200`, three short gaps left the files absent. One qualifying gap wrote valid JSON and the sibling text file at a Unicode path. A second qualifying gap left both files byte-identical. Chrome metadata gives 259.442 ms in the short run and 268.668 ms in the wrapped run. - The wrapped run retained exactly 65,536 ring events, counted 52 overwrites, and still emitted both trigger boundaries. The trace includes CPU-side submission timing for fence 703 and labels GPU execution timing unavailable. - The existing timed setting produced its own JSON and text pair. The invalid zero threshold left the recorder off and wrote no files. All four production-path probes passed. The unmodified timeline suite reported 16/17 under Wine with a UTF-8 locale and matching symbols adjacent. The remaining stack-symbol-name assertion also fails on plain `bcbbd9a9` in the same environment. The other 16 tests pass with exit 0 when that one case is excluded. Synthetic inputs only. AI-assisted with OpenAI Codex.
bobcatchris commented 2026-11-29 20:06:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-29T20:06:31Z.


Independent verification on native Windows 11 Pro (10.0.26200) + AMD Radeon RX 7900 XTX (gfx1100, driver 32.0.32029.2010, Rust 1.98):

  • Merged PR head 37d2d73dc cleanly onto main (720bd3b4e) — zero conflicts.
  • cargo test -p leonida-gpu --lib -- --test-threads=4 — 549 passed; 0 failed; 47 ignored (13.91s), including the new timeline/stall-trace unit tests.
  • python -I scripts/check_no_game_data.py on all 6 touched files — PASS.

AI-assisted: Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7261812385 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2623#issuecomment-7261812385). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-29T20:06:31Z. --- Independent verification on native Windows 11 Pro (`10.0.26200`) + **AMD Radeon RX 7900 XTX** (`gfx1100`, driver `32.0.32029.2010`, Rust `1.98`): - Merged PR head `37d2d73dc` cleanly onto `main` (`720bd3b4e`) — zero conflicts. - `cargo test -p leonida-gpu --lib -- --test-threads=4` — **`549 passed; 0 failed; 47 ignored`** (`13.91s`), including the new timeline/stall-trace unit tests. - `python -I scripts/check_no_game_data.py` on all 6 touched files — **PASS**. AI-assisted: Antigravity (Gemini 4 Neon)
MoonEyes commented 2026-11-30 15:58:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T15:58:06Z.


Verified: merged cleanly in independent Windows and Linux checks, including 549 leonida-gpu tests passing with 0 failures and the no-game-data check passing. Ready for merge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283903141 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2623#issuecomment-7283903141). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T15:58:06Z. --- Verified: merged cleanly in independent Windows and Linux checks, including 549 leonida-gpu tests passing with 0 failures and the no-game-data check passing. Ready for merge.
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!2623
No description provided.