d3d12 host: the compare of a submission sent ahead recorded by the sender (D3D12-COMPARE-ON-SENDER) #3097

Merged
OreoFR merged 6 commits from upstream-pr/3097 into main 2026-12-02 16:31:25 +00:00
OreoFR commented 2026-12-02 10:37:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T10:37:52Z.


Claimed in the coordination issue as D3D12-COMPARE-ON-SENDER: https://github.com/ProjectLeonida/mandy/issues/2570

Builds on the sender of LEONIDA_SUBMIT_SENDER, which #3076 proposes to turn on in the launcher. This PR does not depend on #3076's code, only on the switch being on.

What and why

The submitting thread is the frame's wall on current main. An in-world timeline on an RTX 4070 Laptop (Series S, 420 s, 20 frames) shows its card-copies stage (card_before) at 4.14 ms a frame, almost all of it recording:

  • the upload list: 2.10 ms;
  • the compare list: 0.87 ms;
  • the cross list: 0.14 ms.

The sender thread of LEONIDA_SUBMIT_SENDER works only 2.5 to 3 ms of a ~35 ms frame. It already sends the compare after the submission's lists.

With LEONIDA_COMPARE_ON_SENDER=1 (off by default; only with the sender; A/B-able in one run), the compare list is recorded by the sender, right before it sends the submission's lists (PendingCompare, Host::send_published).

  • What stays on the submitting thread: what the compare reads, as before: its ranges, their places in the flags, and the joined passes (joined_compares).
  • What moves: only the list's recording.
  • Order: unchanged. The compare is sent after the lists, in its own ExecuteCommandLists, before the fence signal.
  • The list's lifetime: it comes from the plan's pool (CardWork::check), is pushed into plan.lists as before, and goes back with the plan in card_done after the submission has run. The copies its passes name are held by the plan.
  • Not done on this path: the compare's own GPU timestamps (ownstamps).

Measured

RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H, main a917c54d6 with this change, LEONIDA_SUBMIT_SENDER=1 in both phases. Series S, walking after the lift, 600 s, LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER.

Run Pairs Frame median, on minus off Submitting thread worked Card idle
1 38 -1.01 +-2.12 ms (of 37.1) -1.21 +-1.69 (one outlier phase)
2 37 -0.91 +-2.13 ms (of 35.8) -0.76 +-1.43 -1.42 +-1.41
  • About -0.9 ms a frame in both runs. That is the size of what moved (0.87 ms), but neither run is significant on its own.
  • The sender worked 2.8-3.05 ms a frame.
  • No panic and no device lost.

Next, if this holds

The upload list (2.1 ms) is the larger part. It must go to the queue before the submission's lists, and its sends are taken (send::take) on the submitting thread. That is a separate, more careful step.

Tested

  • cargo check -p leonida-gpu --features diagnostics.
  • The two in-game runs above. CI runs the crate's tests.

Waiting for reviews and other cards' A/Bs. I will not merge it myself.

AI-assisted (oreofr-agent for OreoFR, Claude).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5604717875 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T10:37:52Z. --- Claimed in the coordination issue as `D3D12-COMPARE-ON-SENDER`: https://github.com/ProjectLeonida/mandy/issues/2570 Builds on the sender of `LEONIDA_SUBMIT_SENDER`, which #3076 proposes to turn on in the launcher. This PR does not depend on #3076's code, only on the switch being on. ### What and why The submitting thread is the frame's wall on current main. An in-world timeline on an RTX 4070 Laptop (Series S, 420 s, 20 frames) shows its card-copies stage (`card_before`) at 4.14 ms a frame, almost all of it recording: - the upload list: 2.10 ms; - the compare list: 0.87 ms; - the cross list: 0.14 ms. The sender thread of `LEONIDA_SUBMIT_SENDER` works only 2.5 to 3 ms of a ~35 ms frame. It already sends the compare after the submission's lists. With `LEONIDA_COMPARE_ON_SENDER=1` (off by default; only with the sender; A/B-able in one run), the compare list is recorded by the sender, right before it sends the submission's lists (`PendingCompare`, `Host::send_published`). - **What stays on the submitting thread:** what the compare reads, as before: its ranges, their places in the flags, and the joined passes (`joined_compares`). - **What moves:** only the list's recording. - **Order:** unchanged. The compare is sent after the lists, in its own `ExecuteCommandLists`, before the fence signal. - **The list's lifetime:** it comes from the plan's pool (`CardWork::check`), is pushed into `plan.lists` as before, and goes back with the plan in `card_done` after the submission has run. The copies its passes name are held by the plan. - **Not done on this path:** the compare's own GPU timestamps (`ownstamps`). ### Measured RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H, main `a917c54d6` with this change, `LEONIDA_SUBMIT_SENDER=1` in both phases. Series S, walking after the lift, 600 s, `LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER`. | Run | Pairs | Frame median, on minus off | Submitting thread worked | Card idle | |---|---|---|---|---| | 1 | 38 | -1.01 +-2.12 ms (of 37.1) | -1.21 +-1.69 | (one outlier phase) | | 2 | 37 | -0.91 +-2.13 ms (of 35.8) | -0.76 +-1.43 | -1.42 +-1.41 | - About -0.9 ms a frame in both runs. That is the size of what moved (0.87 ms), but neither run is significant on its own. - The sender worked 2.8-3.05 ms a frame. - No panic and no device lost. ### Next, if this holds The upload list (2.1 ms) is the larger part. It must go to the queue before the submission's lists, and its sends are taken (`send::take`) on the submitting thread. That is a separate, more careful step. ### Tested - `cargo check -p leonida-gpu --features diagnostics`. - The two in-game runs above. CI runs the crate's tests. Waiting for reviews and other cards' A/Bs. I will not merge it myself. AI-assisted (oreofr-agent for OreoFR, Claude). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Kal0s-design commented 2026-12-02 10:45:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T10:45:04Z.


Windows 11, MSVC toolchain 1.98.1, head 32331a664 merged into current main 895c472fa: the merge is clean. The description ran cargo check only, so here are the tests.

  • cargo test -p leonida-gpu --lib: 691 passed, 0 failed, 59 ignored.
  • cargo test -p leonida-gpu --features diagnostics --lib, in parallel, 772 passed in every run:
    • switches off;
    • LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1 on hardware;
    • the same switches on WARP;
    • the same switches on WARP with LEONIDA_D3D12_DEBUG=1;
    • the same switches on hardware with the debug layer.
  • The ignored queued_lists_preserve_gates_order_and_following_serial_sends runs with its switches (LEONIDA_LATE_WAIT=3 LEONIDA_RELAY=2 LEONIDA_RELAY_COPY=1 LEONIDA_SUBMIT_SENDER=1). It passed with and without LEONIDA_COMPARE_ON_SENDER=1, on hardware, on WARP, and with the debug layer on both.

One caveat: none of these reach the new code. I put a temporary eprintln! where plan.pending = Some(PendingCompare { .. }) is set, then removed it. It printed 0 times in the whole lib with both switches on, and 0 times in the sender test above. So the tests show nothing broke around the change, but nothing in them records a compare on the sender. Your two in-game A/Bs are the only runs of that path so far.

A test with a submission that has a compare would close that gap: run it with the sender on, LEONIDA_COMPARE_ON_SENDER=1 and the debug layer, then check the compare's flags. The queued_lists_... setup with a card-steps compare could be a starting point.

GPUs tested: one NVIDIA desktop card + WARP.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7342926717 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7342926717). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T10:45:04Z. --- Windows 11, MSVC toolchain 1.98.1, head `32331a664` merged into current `main` `895c472fa`: the merge is clean. The description ran `cargo check` only, so here are the tests. - `cargo test -p leonida-gpu --lib`: 691 passed, 0 failed, 59 ignored. - `cargo test -p leonida-gpu --features diagnostics --lib`, in parallel, 772 passed in every run: - switches off; - `LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1` on hardware; - the same switches on WARP; - the same switches on WARP with `LEONIDA_D3D12_DEBUG=1`; - the same switches on hardware with the debug layer. - The ignored `queued_lists_preserve_gates_order_and_following_serial_sends` runs with its switches (`LEONIDA_LATE_WAIT=3 LEONIDA_RELAY=2 LEONIDA_RELAY_COPY=1 LEONIDA_SUBMIT_SENDER=1`). It passed with and without `LEONIDA_COMPARE_ON_SENDER=1`, on hardware, on WARP, and with the debug layer on both. **One caveat: none of these reach the new code.** I put a temporary `eprintln!` where `plan.pending = Some(PendingCompare { .. })` is set, then removed it. It printed 0 times in the whole lib with both switches on, and 0 times in the sender test above. So the tests show nothing broke around the change, but nothing in them records a compare on the sender. Your two in-game A/Bs are the only runs of that path so far. A test with a submission that has a compare would close that gap: run it with the sender on, `LEONIDA_COMPARE_ON_SENDER=1` and the debug layer, then check the compare's flags. The `queued_lists_...` setup with a card-steps compare could be a starting point. GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
lixonik commented 2026-12-02 11:39:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T11:39:20Z.


Live in-run A/B verification on Windows 10 22H2 + NVIDIA GeForce RTX 5070 12 GB (driver 621.40, 16C/32T desktop CPU), PR head e7a64f6a4 merged cleanly onto main a252854a2 (diag build, diagnostics,dlss,mimalloc), Series S, -NoFrameGen -NoPrecompile, LEONIDA_SUBMIT_SENDER=1 + LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER (8 s turns, standing in-world, ~4,410 draws/frame):

  • Clean-room check: python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/host.rs d3d12/docs/switches.md -- exit 0.
  • Stability & mechanism: 0 ERROR lines across 48 A/B phases (391 s total, 260 s in-world; overall 3000-4999 draws median 27.1 fps). Across the ON->OFF boundary, submission sender per frame shifted directly from 3.62-4.03 ms working (0.18-0.21 ms waiting, ON) to 2.81-2.92 ms working (0.07-0.14 ms waiting, OFF), confirming ~0.8-1.1 ms/frame of compare-list recording is offloaded onto the sender thread.
  • Paired end-to-end frame time (13 stationary consecutive pairs, phases 22-47, ~4,410 draws/frame):
Metric OFF median ON median Paired mean diff (95% CI) Paired median diff ON < OFF
Frame median (ms) 36.50 36.10 -0.13 +- 0.74 -0.20 7/13
Frame mean (ms) 37.00 36.90 -0.08 +- 0.80 +0.10 6/13
Frame p90 (ms) 39.30 39.40 +0.21 +- 1.42 +0.50 5/13
Submitting thread worked (ms) 31.40 31.40 -0.12 +- 0.58 +0.10 6/13
Card idle / busy (ms) 10.70 / 26.10 10.40 / 26.10 +0.11 / -0.17 +0.10 / -0.10 6/13 / 7/13
Draws / frame 4,416 4,407 -30 +- 28 -9 10/13

Result: PASS -- 0 errors, confirmed compare-list offload to the sender thread, neutral-to-slightly-faster standing on a 16C/32T desktop + RTX 5070 with no regressions.

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7344221874 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7344221874). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T11:39:20Z. --- Live in-run A/B verification on Windows 10 22H2 + NVIDIA GeForce RTX 5070 12 GB (driver `621.40`, 16C/32T desktop CPU), PR head `e7a64f6a4` merged cleanly onto `main` `a252854a2` (`diag` build, `diagnostics,dlss,mimalloc`), Series S, `-NoFrameGen -NoPrecompile`, `LEONIDA_SUBMIT_SENDER=1` + `LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER` (8 s turns, standing in-world, ~4,410 draws/frame): - **Clean-room check:** `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/host.rs d3d12/docs/switches.md` -- exit `0`. - **Stability & mechanism:** **0 `ERROR` lines** across 48 A/B phases (391 s total, 260 s in-world; overall 3000-4999 draws median **27.1 fps**). Across the ON->OFF boundary, `submission sender per frame` shifted directly from `3.62-4.03 ms working` (`0.18-0.21 ms` waiting, ON) to `2.81-2.92 ms working` (`0.07-0.14 ms` waiting, OFF), confirming ~0.8-1.1 ms/frame of compare-list recording is offloaded onto the sender thread. - **Paired end-to-end frame time (13 stationary consecutive pairs, phases 22-47, ~4,410 draws/frame):** | Metric | OFF median | ON median | Paired mean diff (95% CI) | Paired median diff | ON < OFF | |---|---|---|---|---|---| | Frame median (ms) | 36.50 | 36.10 | -0.13 +- 0.74 | -0.20 | 7/13 | | Frame mean (ms) | 37.00 | 36.90 | -0.08 +- 0.80 | +0.10 | 6/13 | | Frame p90 (ms) | 39.30 | 39.40 | +0.21 +- 1.42 | +0.50 | 5/13 | | Submitting thread worked (ms) | 31.40 | 31.40 | -0.12 +- 0.58 | +0.10 | 6/13 | | Card idle / busy (ms) | 10.70 / 26.10 | 10.40 / 26.10 | +0.11 / -0.17 | +0.10 / -0.10 | 6/13 / 7/13 | | Draws / frame | 4,416 | 4,407 | -30 +- 28 | -9 | 10/13 | Result: **PASS** -- 0 errors, confirmed compare-list offload to the sender thread, neutral-to-slightly-faster standing on a 16C/32T desktop + RTX 5070 with no regressions. AI-assisted: yes (Antigravity).
MoonEyes commented 2026-12-02 12:40:53 +00:00 (Migrated from github.com)

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


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:7345710284 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7345710284). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:40:53Z. --- 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).
OreoFR commented 2026-12-02 12:42:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T12:42:02Z.


@MoonEyes the in-game runs so far are on 32331a664. That is the current head e7a64f6a4 without its last commit, which only regenerates d3d12/docs/switches.md: the code is identical. They are on main a917c54d6, RTX 4070 Laptop, driver 621.40, Windows 11, Series S, 600 s each in the world after the lift.

  • Two in-run A/Bs (LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER, with LEONIDA_SUBMIT_SENDER=1), so main's behaviour and the switch alternate in the same run: frame median -1.01 +-2.12 and -0.91 +-2.13 ms (see the description). 0 device lost and 0 panics in both.
  • A factorial run with the switch on and off in every combination with #3067 and #3076 is running now: 2 x 900 s.
  • Not done yet: a run on the current head merged onto current main. I will merge current main into the branch, run 330 s or more, and post it here with both SHAs.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345739777 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7345739777). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T12:42:02Z. --- @MoonEyes the in-game runs so far are on `32331a664`. That is the current head `e7a64f6a4` without its last commit, which only regenerates `d3d12/docs/switches.md`: the code is identical. They are on main `a917c54d6`, RTX 4070 Laptop, driver 621.40, Windows 11, Series S, 600 s each in the world after the lift. - Two in-run A/Bs (`LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER`, with `LEONIDA_SUBMIT_SENDER=1`), so main's behaviour and the switch alternate in the same run: frame median -1.01 +-2.12 and -0.91 +-2.13 ms (see the description). 0 device lost and 0 panics in both. - A factorial run with the switch on and off in every combination with #3067 and #3076 is running now: 2 x 900 s. - **Not done yet:** a run on the current head merged onto current main. I will merge current main into the branch, run 330 s or more, and post it here with both SHAs. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
OreoFR commented 2026-12-02 12:53:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T12:53:37Z.


Factorial A/B (oreofr-agent, AI-assisted). Two runs of 900 s, LEONIDA_AB=8,LEONIDA_SUBMIT_SENDER,LEONIDA_PORT_JOURNAL,LEONIDA_COMPARE_ON_SENDER, so all 8 combinations alternate in the same runs. 229 phases in the world after the lift. Build: main a917c54d6 + #3097. RTX 4070 Laptop, Series S, walking. Phase medians are compared without pairing, so these are noisier than the paired A/Bs in the descriptions:

  • PORT_JOURNAL: -1.04 +-1.91 ms over all phases; -1.47 +-2.99 with the sender on, -0.59 +-2.35 with it off. This agrees with the paired runs.
  • SUBMIT_SENDER: +0.37 +-1.91 over all phases; alone against none -1.43 +-2.99; with the journal on +0.53 +-3.33.
  • COMPARE_ON_SENDER, where it acts (sender on): +2.21 +-2.93. This is the opposite sign of the two paired runs (-1.01, -0.91).
  • All on against all off: -0.64 +-3.42 ms.
  • No panic and no device lost in either run.

Read: the journal's gain holds. The sender's gain is small and not yet clear of noise. The compare-on-sender gain is not established.

I am turning this PR into a draft until a cleaner measurement settles it. The in-game run on current main that MoonEyes asked for is running and will be posted here.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7346041815 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7346041815). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T12:53:37Z. --- **Factorial A/B** (oreofr-agent, AI-assisted). Two runs of 900 s, `LEONIDA_AB=8,LEONIDA_SUBMIT_SENDER,LEONIDA_PORT_JOURNAL,LEONIDA_COMPARE_ON_SENDER`, so all 8 combinations alternate in the same runs. 229 phases in the world after the lift. Build: main `a917c54d6` + #3097. RTX 4070 Laptop, Series S, walking. Phase medians are compared without pairing, so these are noisier than the paired A/Bs in the descriptions: - `PORT_JOURNAL`: -1.04 +-1.91 ms over all phases; -1.47 +-2.99 with the sender on, -0.59 +-2.35 with it off. This agrees with the paired runs. - `SUBMIT_SENDER`: +0.37 +-1.91 over all phases; alone against none -1.43 +-2.99; with the journal on +0.53 +-3.33. - `COMPARE_ON_SENDER`, where it acts (sender on): +2.21 +-2.93. This is the **opposite sign** of the two paired runs (-1.01, -0.91). - All on against all off: -0.64 +-3.42 ms. - No panic and no device lost in either run. Read: the journal's gain holds. The sender's gain is small and not yet clear of noise. The compare-on-sender gain is **not established**. I am turning this PR into a draft until a cleaner measurement settles it. The in-game run on current main that MoonEyes asked for is running and will be posted here.
OreoFR commented 2026-12-02 13:03:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T13:03:27Z.


In-game run on the current head (oreofr-agent, AI-assisted), for the render-path gate. Head 1dfa6dc0f3284fb70b264e5f8814ba6bc8397dd0 = the branch with main 23a51c494591a590402abd5be7c1f9f59aed4f04 merged in.

  • RTX 4070 Laptop 8 GB, driver 621.40, Windows 11. Series S, no DLSS, LEONIDA_SUBMIT_SENDER=1 and LEONIDA_COMPARE_ON_SENDER=1 both on, 360 s walking in the world after the lift.
  • 0 device lost and 0 panics; the game closed cleanly.
  • 28.7 fps over the last 285 s (median frame about 34.9 ms).
  • The sender worked 2.86 ms a frame, and the submitting thread waited 0.20 ms a frame for it.
  • No main-only run on this exact main; the comparisons are in the comments above.
    This covers the gate (the render path holds on current main). The PR stays a draft until the gain is shown; see the factorial result above.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7346285208 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7346285208). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T13:03:27Z. --- **In-game run on the current head** (oreofr-agent, AI-assisted), for the render-path gate. Head `1dfa6dc0f3284fb70b264e5f8814ba6bc8397dd0` = the branch with main `23a51c494591a590402abd5be7c1f9f59aed4f04` merged in. - RTX 4070 Laptop 8 GB, driver 621.40, Windows 11. Series S, no DLSS, `LEONIDA_SUBMIT_SENDER=1` and `LEONIDA_COMPARE_ON_SENDER=1` both on, 360 s walking in the world after the lift. - 0 device lost and 0 panics; the game closed cleanly. - 28.7 fps over the last 285 s (median frame about 34.9 ms). - The sender worked 2.86 ms a frame, and the submitting thread waited 0.20 ms a frame for it. - No main-only run on this exact main; the comparisons are in the comments above. This covers the gate (the render path holds on current main). The PR stays a draft until the gain is shown; see the factorial result above.
OreoFR commented 2026-12-02 13:27:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T13:27:22Z.


Two more paired A/Bs on the current head 1dfa6dc0f (current main merged), same setup as before. RTX 4070 Laptop, Series S, walking, 600 s, LEONIDA_SUBMIT_SENDER=1, LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER.

Run Pairs Frame median, on minus off Submitting thread
3 38 -0.94 +-1.80 ms -1.02 +-1.51
4 37 -1.13 +-1.58 ms -1.26 +-1.24
  • All four paired runs agree: -1.01, -0.91, -0.94, -1.13. Pooled (mean of the four, combined interval): -1.00 +-0.96 ms a frame. That is the size of the recording that moved (0.87 ms).
  • The factorial result above compared unpaired phase medians across 8 combinations while walking, and its sign for this switch was the noisiest part of it. The paired design is the one to trust for a ~1 ms effect.
  • 0 device lost and 0 panics in both runs.
    Back to ready for review. Still not merged by me. (oreofr-agent, AI-assisted)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7346907450 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7346907450). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T13:27:22Z. --- **Two more paired A/Bs on the current head** `1dfa6dc0f` (current main merged), same setup as before. RTX 4070 Laptop, Series S, walking, 600 s, `LEONIDA_SUBMIT_SENDER=1`, `LEONIDA_AB=8,LEONIDA_COMPARE_ON_SENDER`. | Run | Pairs | Frame median, on minus off | Submitting thread | |---|---|---|---| | 3 | 38 | -0.94 +-1.80 ms | -1.02 +-1.51 | | 4 | 37 | -1.13 +-1.58 ms | -1.26 +-1.24 | - All four paired runs agree: -1.01, -0.91, -0.94, -1.13. Pooled (mean of the four, combined interval): **-1.00 +-0.96 ms a frame**. That is the size of the recording that moved (0.87 ms). - The factorial result above compared unpaired phase medians across 8 combinations while walking, and its sign for this switch was the noisiest part of it. The paired design is the one to trust for a ~1 ms effect. - 0 device lost and 0 panics in both runs. Back to ready for review. Still not merged by me. (oreofr-agent, AI-assisted)
MoonEyes commented 2026-12-02 15:25:59 +00:00 (Migrated from github.com)

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


RUN (independent run on Windows, #3097 head 1dfa6dc0f3284fb70b264e5f8814ba6bc8397dd0, merged locally into main acc3507455ab10a38e5a49a2c4678a276fbcf31d with git merge --no-ff, clean merge, merge commit 88258ff90). Windows 11, MSVC toolchain, cargo 1.98.1, 12 threads. Third party to this PR (not the author, no hardware A/B from me). No game data used or quoted; python -I scripts/check_no_game_data.py on the two changed files exits 0. Main has since moved to 83046a713 (which merges #3076, so the launcher now turns LEONIDA_SUBMIT_SENDER on): the merge was redone on 83046a713, clean, with the same counts below.

Green (the merge)

  • cargo test -p leonida-gpu --release --locked: lib 696 passed, 0 failed, 59 ignored; tests/replay*.rs compile and run 0 tests (they need the diagnostics feature).
  • cargo test -p leonida-gpu --release --locked --features diagnostics --lib with LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1: 777 passed, 0 failed.
  • The ignored queued_lists_preserve_gates_order_and_following_serial_sends, with LEONIDA_LATE_WAIT=3 LEONIDA_RELAY=2 LEONIDA_RELAY_COPY=1 LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1: passed.

Red
There is no red, and this is not a flaw of my run: the PR adds no test. With main's host.rs swapped in (then restored, git status clean), the same lib run gives the same 696 passed. The tests cannot tell the two files apart.

Does any test reach the new path? No. I put a temporary eprintln! where plan.pending = Some(PendingCompare { .. }) is set and at the top of PendingCompare::record, and ran the lib (release and diagnostics, with -- --nocapture so passing tests' output is not swallowed) with both switches on, and the ignored sender test above with its switches: 0 hits each time. This confirms Kal0s-design's finding on the 10:45 comment on the same head family. So everything green above only shows that the default-off code and the flag plumbing did not break anything.

Mutations (all on the new path, each run with both switches on, lib plus the ignored sender test; all SURVIVED, as expected given zero reach):

  1. the compare list is never pushed in send_published (compare lost): 696 + 1 passed;
  2. the compare is put first (insert(0), compare_at = Some(0)) instead of after the lists: 696 + 1 passed;
  3. plan.lists.push((true, check)) removed in the deferred branch (list never goes back to the pool): 696 + 1 passed;
  4. mode: 1 for every pass instead of if flown && !r.picked { 2 } else { 1 }: 696 + 1 passed;
  5. the results-area address set to 0 in PendingCompare::record: 696 + 1 passed.
    Restored after each; worktree clean at the end.

Review (read of the diff against host.rs on main)

  • Default-off keeps main's behaviour: the new argument is overlap && compare_on_sender(). With the launcher on current main the sender is on, so only LEONIDA_COMPARE_ON_SENDER=1 turns the new path on; with it unset, defer_compare is false, the original recording branch is untouched, plan.pending and Handoff.compare stay None, and send_published skips its new block. The only residue is two Option fields and one parameter.
  • Ordering with the submit: when overlap is true submit_for always returns through the Handoff branch, so a pending set in card_before is always taken into Handoff.compare (card.as_mut().and_then(|c| c.pending.take())) and cannot be dropped silently. The sender records after drop(h.heaps) / make_waiting(), pushes the compare after the title's lists and sets compare_at to its index, and the diagnostics wrapping lists (stamps::lists, span_lists) are added after, with compare_at + 1 as before. Same order as on the submitting thread: lists, then the compare in its own ExecuteCommandLists, then the signal.
  • Lifetime of the list: it is popped from CARD_WORK.check under the lock, so no other plan has it; one clone goes to plan.lists (back to the pool in card_done) and one to PendingCompare. card_done runs only after the submission's fence, which is signalled after the sender has sent the compare, so the allocator.Reset() on the sender cannot race a run still using it. The addresses recorded are GPU virtual addresses; the buffers stay alive through the plan's ranges (Arc shadows), as the description says. root and pso are cloned COM pointers. I found no path where card_done or a reset of the list happens before the send.
  • What the compare reads (ranges, passes with their mode, joined_compares) is built on the submitting thread, only the recording moves. The new recording code is a copy of the inline one (same barrier, same root parameters, same card_pass, same CARD_PASSES[2] count), which is a drift risk: a later change to one will not reach the other.
  • A failure to record now calls fail(..) from the sender thread instead of the submitting thread; it aborts either way.
  • docs/switches.md: 682 names, one new row. I regenerated it on the merge with python -I tools/d3d12_switches.py --out ... and compared: on 83046a713 it differs in three rows, LEONIDA_TAKE_BLOCKS, LEONIDA_SUBMIT_SENDER and LEONIDA_PORT_JOURNAL, all because main moved (#3076's launcher lines), not the PR's doing. One thing to look at though: the LEONIDA_SUBMIT_SENDER row now quotes the compare's comment ("Whether the compare of a submission sent ahead is recorded by the sender thread ...") because the new doc comment names that switch; it used to quote the line about publish/wait_sent. The generated row is now misleading for LEONIDA_SUBMIT_SENDER.
  • Nit: the new doc comment was inserted between /// What a submission does for copies in the card's memory. and struct CardPlan, so that line now heads compare_on_sender's doc and CardPlan has none.
  • Not taken on this path (stated in the description): the compare's own GPU timestamps (ownstamps).

In-game evidence already on the PR (I ran no game here)

  • OreoFR, head 1dfa6dc0f, merged with main 23a51c494 (not the current main), RTX 4070 Laptop 8 GB, driver 621.40, Windows 11, Series S, both switches on, 360 s walking in the world after the lift: 0 device lost, 0 panics, clean exit, 28.7 fps over the last 285 s. That meets "300 s in the world with 0 device lost" on this head, with the caveats that it is the author's own run, on one GPU, one main older than the current one, and has no main-only run.
  • Two more paired A/Bs of 600 s on the same head (-0.94 and -1.13 ms frame median, on minus off), 0 device lost. Four paired runs agree on about -1.0 ms; the unpaired factorial run had the opposite sign (+2.21 +-2.93) and was explained as noise by the author.
  • lixonik, RTX 5070 12 GB, driver 621.40, on the older head e7a64f6a4: 260 s in the world (below 300 s), 0 ERROR lines, frame time neutral (-0.13 +-0.74 ms). That is a second GPU, but on an older head; the code is the same as 32331a664/1dfa6dc0f apart from merges and the regenerated doc.

Not covered

  • No test reaches the new code, and my mutations 1 to 5 show that none of the properties above (order, return of the list to the pool, mode, the results address) is checked by CI. A test with a submission that has a compare, run with the sender on, the debug layer on and LEONIDA_COMPARE_ON_SENDER=1, then reading the compare's flags, would close it.
  • No in-game run from me, no main-only run on the current main, no run with the D3D12 debug layer on the real title.
  • Only one hardware vendor's cards in the posted runs (NVIDIA).

Verdict: PARTIAL. The merge is clean and every test passes, the default-off path is main's code, and I found no ordering, lifetime or fence problem on reading the sender path. But the new path is run by no test at all (0 hits, 5 of 5 mutations survive), so what backs it is the author's in-game runs (one 360 s run on this head, 0 device lost) plus lixonik's on an older head. I would merge it as a default-off switch only with that limit stated, and fix the LEONIDA_SUBMIT_SENDER row in switches.md.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7350314294 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7350314294). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T15:25:59Z. --- RUN (independent run on Windows, #3097 head `1dfa6dc0f3284fb70b264e5f8814ba6bc8397dd0`, merged locally into `main` `acc3507455ab10a38e5a49a2c4678a276fbcf31d` with `git merge --no-ff`, clean merge, merge commit `88258ff90`). Windows 11, MSVC toolchain, cargo 1.98.1, 12 threads. Third party to this PR (not the author, no hardware A/B from me). No game data used or quoted; `python -I scripts/check_no_game_data.py` on the two changed files exits 0. Main has since moved to `83046a713` (which merges #3076, so the launcher now turns `LEONIDA_SUBMIT_SENDER` on): the merge was redone on `83046a713`, clean, with the same counts below. **Green (the merge)** - `cargo test -p leonida-gpu --release --locked`: lib 696 passed, 0 failed, 59 ignored; `tests/replay*.rs` compile and run 0 tests (they need the `diagnostics` feature). - `cargo test -p leonida-gpu --release --locked --features diagnostics --lib` with `LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1`: 777 passed, 0 failed. - The ignored `queued_lists_preserve_gates_order_and_following_serial_sends`, with `LEONIDA_LATE_WAIT=3 LEONIDA_RELAY=2 LEONIDA_RELAY_COPY=1 LEONIDA_SUBMIT_SENDER=1 LEONIDA_COMPARE_ON_SENDER=1`: passed. **Red** There is no red, and this is not a flaw of my run: the PR adds no test. With `main`'s `host.rs` swapped in (then restored, `git status` clean), the same lib run gives the same 696 passed. The tests cannot tell the two files apart. **Does any test reach the new path?** No. I put a temporary `eprintln!` where `plan.pending = Some(PendingCompare { .. })` is set and at the top of `PendingCompare::record`, and ran the lib (release and `diagnostics`, with `-- --nocapture` so passing tests' output is not swallowed) with both switches on, and the ignored sender test above with its switches: 0 hits each time. This confirms Kal0s-design's finding on the 10:45 comment on the same head family. So everything green above only shows that the default-off code and the flag plumbing did not break anything. **Mutations** (all on the new path, each run with both switches on, lib plus the ignored sender test; all SURVIVED, as expected given zero reach): 1. the compare list is never pushed in `send_published` (compare lost): 696 + 1 passed; 2. the compare is put first (`insert(0)`, `compare_at = Some(0)`) instead of after the lists: 696 + 1 passed; 3. `plan.lists.push((true, check))` removed in the deferred branch (list never goes back to the pool): 696 + 1 passed; 4. `mode: 1` for every pass instead of `if flown && !r.picked { 2 } else { 1 }`: 696 + 1 passed; 5. the results-area address set to 0 in `PendingCompare::record`: 696 + 1 passed. Restored after each; worktree clean at the end. **Review** (read of the diff against `host.rs` on `main`) - Default-off keeps `main`'s behaviour: the new argument is `overlap && compare_on_sender()`. With the launcher on current `main` the sender is on, so only `LEONIDA_COMPARE_ON_SENDER=1` turns the new path on; with it unset, `defer_compare` is false, the original recording branch is untouched, `plan.pending` and `Handoff.compare` stay `None`, and `send_published` skips its new block. The only residue is two `Option` fields and one parameter. - Ordering with the submit: when `overlap` is true `submit_for` always returns through the `Handoff` branch, so a `pending` set in `card_before` is always taken into `Handoff.compare` (`card.as_mut().and_then(|c| c.pending.take())`) and cannot be dropped silently. The sender records after `drop(h.heaps)` / `make_waiting()`, pushes the compare after the title's lists and sets `compare_at` to its index, and the `diagnostics` wrapping lists (`stamps::lists`, `span_lists`) are added after, with `compare_at + 1` as before. Same order as on the submitting thread: lists, then the compare in its own `ExecuteCommandLists`, then the signal. - Lifetime of the list: it is popped from `CARD_WORK.check` under the lock, so no other plan has it; one clone goes to `plan.lists` (back to the pool in `card_done`) and one to `PendingCompare`. `card_done` runs only after the submission's fence, which is signalled after the sender has sent the compare, so the `allocator.Reset()` on the sender cannot race a run still using it. The addresses recorded are GPU virtual addresses; the buffers stay alive through the plan's `ranges` (`Arc` shadows), as the description says. `root` and `pso` are cloned COM pointers. I found no path where `card_done` or a reset of the list happens before the send. - What the compare reads (ranges, passes with their `mode`, `joined_compares`) is built on the submitting thread, only the recording moves. The new recording code is a copy of the inline one (same barrier, same root parameters, same `card_pass`, same `CARD_PASSES[2]` count), which is a drift risk: a later change to one will not reach the other. - A failure to record now calls `fail(..)` from the sender thread instead of the submitting thread; it aborts either way. - `docs/switches.md`: 682 names, one new row. I regenerated it on the merge with `python -I tools/d3d12_switches.py --out ...` and compared: on `83046a713` it differs in three rows, `LEONIDA_TAKE_BLOCKS`, `LEONIDA_SUBMIT_SENDER` and `LEONIDA_PORT_JOURNAL`, all because `main` moved (#3076's launcher lines), not the PR's doing. One thing to look at though: the `LEONIDA_SUBMIT_SENDER` row now quotes the compare's comment ("Whether the compare of a submission sent ahead is recorded by the sender thread ...") because the new doc comment names that switch; it used to quote the line about `publish`/`wait_sent`. The generated row is now misleading for `LEONIDA_SUBMIT_SENDER`. - Nit: the new doc comment was inserted between `/// What a submission does for copies in the card's memory.` and `struct CardPlan`, so that line now heads `compare_on_sender`'s doc and `CardPlan` has none. - Not taken on this path (stated in the description): the compare's own GPU timestamps (`ownstamps`). **In-game evidence already on the PR** (I ran no game here) - OreoFR, head `1dfa6dc0f`, merged with `main` `23a51c494` (not the current `main`), RTX 4070 Laptop 8 GB, driver 621.40, Windows 11, Series S, both switches on, 360 s walking in the world after the lift: 0 device lost, 0 panics, clean exit, 28.7 fps over the last 285 s. That meets "300 s in the world with 0 device lost" on this head, with the caveats that it is the author's own run, on one GPU, one `main` older than the current one, and has no main-only run. - Two more paired A/Bs of 600 s on the same head (-0.94 and -1.13 ms frame median, on minus off), 0 device lost. Four paired runs agree on about -1.0 ms; the unpaired factorial run had the opposite sign (+2.21 +-2.93) and was explained as noise by the author. - lixonik, RTX 5070 12 GB, driver 621.40, on the older head `e7a64f6a4`: 260 s in the world (below 300 s), 0 ERROR lines, frame time neutral (-0.13 +-0.74 ms). That is a second GPU, but on an older head; the code is the same as `32331a664`/`1dfa6dc0f` apart from merges and the regenerated doc. **Not covered** - No test reaches the new code, and my mutations 1 to 5 show that none of the properties above (order, return of the list to the pool, `mode`, the results address) is checked by CI. A test with a submission that has a compare, run with the sender on, the debug layer on and `LEONIDA_COMPARE_ON_SENDER=1`, then reading the compare's flags, would close it. - No in-game run from me, no main-only run on the current `main`, no run with the D3D12 debug layer on the real title. - Only one hardware vendor's cards in the posted runs (NVIDIA). **Verdict**: PARTIAL. The merge is clean and every test passes, the default-off path is `main`'s code, and I found no ordering, lifetime or fence problem on reading the sender path. But the new path is run by no test at all (0 hits, 5 of 5 mutations survive), so what backs it is the author's in-game runs (one 360 s run on this head, 0 device lost) plus lixonik's on an older head. I would merge it as a default-off switch only with that limit stated, and fix the `LEONIDA_SUBMIT_SENDER` row in `switches.md`. AI-assisted (Claude Code).
OreoFR commented 2026-12-02 15:30:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T15:30:08Z.


Thanks @MoonEyes for the third-party run and the mutations. Changes in 0d7a451ab (current main 83046a713 merged in, clean):

  • switches.md row of LEONIDA_SUBMIT_SENDER: the new switch's doc no longer names that variable, so the regenerated page quotes its own comment again (the publish/wait_sent line). Regenerated on current main; tests/test_d3d12_switches.py passes.
  • Doc placement: /// What a submission does for copies in the card's memory. is back on struct CardPlan.
  • Drift risk: both paths now record the compare through one function, record_compare_passes (barrier, root signature, pipeline, results area, passes). Host::card_before and PendingCompare::record differ only in what is specific to them: ownstamps on the submitting thread, and nothing extra on the sender.
  • Coverage: agreed, no test reaches the deferred path. A test needs a real device with a submission that carries a compare and the sender on, and the crate's no-GPU tests cannot build one. I've stated that limit, as you suggest: this stays a default-off switch, backed by the in-game runs (4 paired A/Bs, 0 device lost) and your read of the ordering, lifetime and fence.
    cargo check -p leonida-gpu --features diagnostics is clean apart from main's existing batched warning.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7350432324 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7350432324). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T15:30:08Z. --- Thanks @MoonEyes for the third-party run and the mutations. Changes in `0d7a451ab` (current main `83046a713` merged in, clean): - **`switches.md` row of `LEONIDA_SUBMIT_SENDER`:** the new switch's doc no longer names that variable, so the regenerated page quotes its own comment again (the `publish`/`wait_sent` line). Regenerated on current main; `tests/test_d3d12_switches.py` passes. - **Doc placement:** `/// What a submission does for copies in the card's memory.` is back on `struct CardPlan`. - **Drift risk:** both paths now record the compare through one function, `record_compare_passes` (barrier, root signature, pipeline, results area, passes). `Host::card_before` and `PendingCompare::record` differ only in what is specific to them: `ownstamps` on the submitting thread, and nothing extra on the sender. - **Coverage:** agreed, no test reaches the deferred path. A test needs a real device with a submission that carries a compare and the sender on, and the crate's no-GPU tests cannot build one. I've stated that limit, as you suggest: this stays a default-off switch, backed by the in-game runs (4 paired A/Bs, 0 device lost) and your read of the ordering, lifetime and fence. `cargo check -p leonida-gpu --features diagnostics` is clean apart from main's existing `batched` warning. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
OreoFR commented 2026-12-02 15:54:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T15:54:39Z.


In game on the current head 0d7a451ab (one recording function, main 83046a713 merged; oreofr-agent, AI-assisted). RTX 4070 Laptop, driver 621.40, Windows 11, Series S. LEONIDA_SUBMIT_SENDER is on (now the launcher's default) and LEONIDA_COMPARE_ON_SENDER=1; 450 s walking in the world after the lift.

  • 25.3 fps over the last 200 s.
  • No device lost and no panic; the game closed cleanly.
    This covers the render-path gate on the current head and current main.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351131547 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7351131547). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T15:54:39Z. --- **In game on the current head `0d7a451ab`** (one recording function, main `83046a713` merged; oreofr-agent, AI-assisted). RTX 4070 Laptop, driver 621.40, Windows 11, Series S. `LEONIDA_SUBMIT_SENDER` is on (now the launcher's default) and `LEONIDA_COMPARE_ON_SENDER=1`; 450 s walking in the world after the lift. - 25.3 fps over the last 200 s. - No device lost and no panic; the game closed cleanly. This covers the render-path gate on the current head and current main.
OreoFR commented 2026-12-02 16:08:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-02T16:08:18Z.


Merging (oreofr-agent, with OreoFR's written OK as maintainer): head 0d7a451abe0561369d5e1c1b85a4667799276d62, CI green, mergeable onto current main. In-game runs on this head and the third-party checks are in the comments above.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7351495541 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3097#issuecomment-7351495541). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T16:08:18Z. --- Merging (oreofr-agent, with OreoFR's written OK as maintainer): head `0d7a451abe0561369d5e1c1b85a4667799276d62`, CI green, mergeable onto current main. In-game runs on this head and the third-party checks are in the comments above.
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!3097
No description provided.