d3d12: say how many submissions were not yet seen finished when the device went (D3D12-REMOVAL-CONTEXT-IN-AIR) #2705

Merged
Kal0s-design merged 2 commits from upstream-pr/2705 into main 2026-12-01 09:24:43 +00:00
Kal0s-design commented 2026-11-30 09:07:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T09:07:09Z.


Claimed in the coordination issue as: D3D12-REMOVAL-CONTEXT-IN-AIR (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7273688756)

What and why

When the host device is removed, host::removal_context writes what the submitting thread was doing. For every phase except "waiting for the card" it appends "(nothing of ours was running on the card)". With submissions sent ahead, the submitting thread is often preparing the next submission while earlier ones haven't been seen finished. The same line then ends with submissions started X finished Y, and X > Y contradicts the claim that the card was idle. Someone reading a removal report takes the wrong lead from it.

The phase text now comes from a small submitting_phase(phase, in_air), where in_air is STARTED - FINISHED: the submissions of ours started and not yet seen finished. It says "nothing of ours was running" only when that number is 0. Otherwise it gives the number, as "1 submission / N submissions of ours started and not yet seen finished" (STARTED counts a submission from the start of its preparation, so the one being prepared is included; wording corrected in d35907845 after review). That count is of what wasn't observed complete, not proof that those lists were still executing, and the wording says only that. "Waiting for the card" and everything else in the report are unchanged.

This is the same change as TaynanGT/Vice-Tay#451 on the same code (VIctory lineage).

Tested

  • New host::trail::the_removal_phase_names_submissions_not_yet_seen_finished checks the five shapes (idle, 1, N, waiting, copy-back). As a negative control, ignoring in_air makes it fail. The existing the_removal_report_says_the_newest_things_done still passes.
  • cargo test -p leonida-gpu --lib: 560 passed, 0 failed, 50 ignored.
  • cargo clippy -p leonida-gpu --all-targets: no warning in the changed lines. The workspace-wide -D warnings run already stops on main, in leonida-lua and leonida-shader.
  • Windows only; Linux and macOS not covered.

GPUs tested: n/a (CPU unit tests)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5562245016 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T09:07:09Z. --- Claimed in the coordination issue as: D3D12-REMOVAL-CONTEXT-IN-AIR (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7273688756) ### What and why When the host device is removed, `host::removal_context` writes what the submitting thread was doing. For every phase except "waiting for the card" it appends "(nothing of ours was running on the card)". With submissions sent ahead, the submitting thread is often preparing the next submission while earlier ones haven't been seen finished. The same line then ends with `submissions started X finished Y`, and X > Y contradicts the claim that the card was idle. Someone reading a removal report takes the wrong lead from it. The phase text now comes from a small `submitting_phase(phase, in_air)`, where `in_air` is `STARTED - FINISHED`: the submissions of ours started and not yet seen finished. It says "nothing of ours was running" only when that number is 0. Otherwise it gives the number, as "1 submission / N submissions of ours started and not yet seen finished" (`STARTED` counts a submission from the start of its preparation, so the one being prepared is included; wording corrected in d35907845 after review). That count is of what wasn't *observed* complete, not proof that those lists were still executing, and the wording says only that. "Waiting for the card" and everything else in the report are unchanged. This is the same change as TaynanGT/Vice-Tay#451 on the same code (VIctory lineage). ### Tested - New `host::trail::the_removal_phase_names_submissions_not_yet_seen_finished` checks the five shapes (idle, 1, N, waiting, copy-back). As a negative control, ignoring `in_air` makes it fail. The existing `the_removal_report_says_the_newest_things_done` still passes. - `cargo test -p leonida-gpu --lib`: 560 passed, 0 failed, 50 ignored. - `cargo clippy -p leonida-gpu --all-targets`: no warning in the changed lines. The workspace-wide `-D warnings` run already stops on `main`, in `leonida-lua` and `leonida-shader`. - Windows only; Linux and macOS not covered. GPUs tested: n/a (CPU unit tests) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
merzleckeier commented 2026-11-30 09:34:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T09:34:10Z.


Independent Wine check of 0695de54 merged onto main 171af5d93. The two stock host::trail tests passed on RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M (RADV 26.3.1), Wine 11.22, VKD3D-Proton 3.1.0, Rust 1.98.1 MSVC diag with diagnostics.

There is a distinction between started and sent in the report. Host::submit increments STARTED at submit: gathering what to ask about, before preparing the lists and advancing the queue sequence or calling ExecuteCommandLists. Consequently STARTED - FINISHED includes the current submission during preparation.

I captured the actual removal_context() immediately after that increment in a fresh process submitting a synthetic 512-byte copy. On both real adapters the snapshot had queue sequence 0, STARTED=1, FINISHED=0. The line was preparing a submission (1 submission of ours sent and not yet seen finished). After the synchronous submission returned, the queue sequence was 1, STARTED=FINISHED=1, and all 512 readback bytes matched. The test invoked the formatter alone during preparation and completed on healthy GPUs.

I verified the wording 1 submission of ours started and not yet seen finished (plus the plural equivalent) in a local comparison. Both stock tests and the new preparation test passed, 3/3 on each GPU. This wording describes the existing counter, including preparation.

AI-assisted: yes (OpenAI Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274386621 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7274386621). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T09:34:10Z. --- Independent Wine check of `0695de54` merged onto `main` `171af5d93`. The two stock `host::trail` tests passed on RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M (RADV 26.3.1), Wine 11.22, VKD3D-Proton 3.1.0, Rust 1.98.1 MSVC `diag` with diagnostics. There is a distinction between **started** and **sent** in the report. `Host::submit` increments `STARTED` at `submit: gathering what to ask about`, before preparing the lists and advancing the queue sequence or calling `ExecuteCommandLists`. Consequently `STARTED - FINISHED` includes the current submission during preparation. I captured the actual `removal_context()` immediately after that increment in a fresh process submitting a synthetic 512-byte copy. On both real adapters the snapshot had queue sequence `0`, `STARTED=1`, `FINISHED=0`. The line was `preparing a submission (1 submission of ours sent and not yet seen finished)`. After the synchronous submission returned, the queue sequence was `1`, `STARTED=FINISHED=1`, and all 512 readback bytes matched. The test invoked the formatter alone during preparation and completed on healthy GPUs. I verified the wording `1 submission of ours started and not yet seen finished` (plus the plural equivalent) in a local comparison. Both stock tests and the new preparation test passed, 3/3 on each GPU. This wording describes the existing counter, including preparation. AI-assisted: yes (OpenAI Codex).
Kal0s-design commented 2026-11-30 09:40:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T09:40:04Z.


Thanks, that's right: STARTED is counted at the start of preparation, so the one being prepared is in STARTED - FINISHED. Pushed d35907845, which says "started and not yet seen finished" (singular and plural) and notes in the doc comment what the counter includes. host::trail tests pass (2/2).

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274521232 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7274521232). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T09:40:04Z. --- Thanks, that's right: `STARTED` is counted at the start of preparation, so the one being prepared is in `STARTED - FINISHED`. Pushed d35907845, which says "started and not yet seen finished" (singular and plural) and notes in the doc comment what the counter includes. `host::trail` tests pass (2/2). AI-assisted: yes
merzleckeier commented 2026-11-30 09:47:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T09:47:11Z.


Confirmed d35907845 merged onto main 4014af7fe with the original synthetic 512-byte copy under Wine 11.22 / VKD3D-Proton 3.1.0. On both RTX 4070 SUPER and Radeon 610M the report now says 1 submission of ours started and not yet seen finished while the queue sequence is still 0. After submission, all 512 bytes match. The two stock host::trail tests and the preparation probe passed 3/3 on each adapter.

AI-assisted: yes (OpenAI Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7274682905 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7274682905). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T09:47:11Z. --- Confirmed `d35907845` merged onto `main` `4014af7fe` with the original synthetic 512-byte copy under Wine 11.22 / VKD3D-Proton 3.1.0. On both RTX 4070 SUPER and Radeon 610M the report now says `1 submission of ours started and not yet seen finished` while the queue sequence is still 0. After submission, all 512 bytes match. The two stock `host::trail` tests and the preparation probe passed 3/3 on each adapter. AI-assisted: yes (OpenAI Codex).
KelboLive commented 2026-11-30 15:27:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T15:27:55Z.


Independent check on Windows (not the author), at d35907845.

  • cargo test --locked --jobs 8 -p leonida-gpu --lib -- --test-threads=8: 560 passed, 0 failed, 50 ignored in 14.2 s.

The diff is host.rs only (no new unit test), so this is compile + regression coverage; I did not repeat the Wine/512-byte-copy scenario already reported above.

Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, NVIDIA RTX 4070 Ti SUPER (driver 621.01), Rust 1.98.1 pinned.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283040951 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7283040951). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T15:27:55Z. --- Independent check on Windows (not the author), at `d35907845`. - `cargo test --locked --jobs 8 -p leonida-gpu --lib -- --test-threads=8`: **560 passed, 0 failed, 50 ignored** in 14.2 s. The diff is `host.rs` only (no new unit test), so this is compile + regression coverage; I did not repeat the Wine/512-byte-copy scenario already reported above. Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, NVIDIA RTX 4070 Ti SUPER (driver 621.01), Rust 1.98.1 pinned. AI-assisted: yes (opencode).
Kal0s-design commented 2026-11-30 15:42:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T15:42:35Z.


@KelboLive thanks for the Windows run. One correction: the diff does add a unit test in host.rs, host::trail::the_removal_phase_names_submissions_not_yet_seen_finished, which checks the in-air count in the removal-phase text (cargo test -p leonida-gpu --lib -- the_removal_phase_names).

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7283447724 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7283447724). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T15:42:35Z. --- @KelboLive thanks for the Windows run. One correction: the diff does add a unit test in `host.rs`, `host::trail::the_removal_phase_names_submissions_not_yet_seen_finished`, which checks the in-air count in the removal-phase text (`cargo test -p leonida-gpu --lib -- the_removal_phase_names`). AI-assisted: yes
MoonEyes commented 2026-12-01 08:33:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T08:33:53Z.


RUN - VERIFY-2705-RTX4060 - by MoonEyes (another person than the author) on head d35907845, with #2836, #2835, #2695, #2696, #2689, #2699 and #2705 merged together into main 9372a4d4f (clean).

  • Machine: RTX 4060 8 GB, Windows 11, diag profile, features diagnostics,mimalloc, Series S, BAR window off, texture budget 1024 MB.
  • In-game, no scripted action, 480 s asked, a session that loads into the world and stays: main 9372a4d4f and then main + the seven, one run each, same save: 0 device lost, 0 panics, 0 exceptions in both, about 490 s in the world each, alive at the time limit. Frame rate median 17.8 with the seven and 15.0 on main, not a comparison: other work ran on the PC during the main run.
  • Picture: screenshots every 60 s. The last four show the same scene in both runs (water, sky, the boat, the map) and look the same; the first four are cutscenes at different moments and were only looked at for broken textures (none seen). No screenshot is posted.
  • Tests on main 9372a4d4f + the seven (Windows): leonida-hle 243, leonida-gpu 602, leonida-formats 47, leonida 47, leonida-shader 403 of 405: two source_hash_tests failed on a stale build script of mine (a target folder shared with an older branch) and pass after a rebuild of it (3 of 3).

Limits: one card, one run per arm, two arms only, the seven together. Values only, no game data.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7305484588 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7305484588). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T08:33:53Z. --- RUN - VERIFY-2705-RTX4060 - by MoonEyes (another person than the author) on head `d35907845`, with #2836, #2835, #2695, #2696, #2689, #2699 and #2705 merged together into `main` `9372a4d4f` (clean). - **Machine:** RTX 4060 8 GB, Windows 11, diag profile, features diagnostics,mimalloc, Series S, BAR window off, texture budget 1024 MB. - **In-game, no scripted action, 480 s asked, a session that loads into the world and stays:** `main` `9372a4d4f` and then `main` + the seven, one run each, same save: **0 device lost, 0 panics, 0 exceptions** in both, about 490 s in the world each, alive at the time limit. Frame rate median 17.8 with the seven and 15.0 on `main`, **not a comparison**: other work ran on the PC during the `main` run. - **Picture:** screenshots every 60 s. The last four show the same scene in both runs (water, sky, the boat, the map) and look the same; the first four are cutscenes at different moments and were only looked at for broken textures (none seen). No screenshot is posted. - **Tests on `main` `9372a4d4f` + the seven (Windows):** leonida-hle 243, leonida-gpu 602, leonida-formats 47, leonida 47, leonida-shader 403 of 405: two `source_hash_tests` failed on a stale build script of mine (a target folder shared with an older branch) and pass after a rebuild of it (3 of 3). Limits: one card, one run per arm, two arms only, the seven together. Values only, no game data. AI-assisted (Claude Code).
MoonEyes commented 2026-12-01 09:24:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-01T09:24:38Z.


Merging. Head d35907845 merges cleanly with main 3bf2844a5 and does not force a rebase of #2566. CI green on this head and on main. In-game run on the RTX 4060 posted above (this head, with the six others, about 490 s in the world, 0 device lost, pictures compared with main). Tests on main + the seven: leonida-hle, leonida-gpu, leonida-formats, leonida, leonida-shader, 0 failed. Verified on it by KelboLive (Windows) and merzleckeier (Wine). Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7306660057 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7306660057). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T09:24:38Z. --- Merging. Head `d35907845` merges cleanly with `main` `3bf2844a5` and does not force a rebase of #2566. CI green on this head and on main. In-game run on the RTX 4060 posted above (this head, with the six others, about 490 s in the world, 0 device lost, pictures compared with main). Tests on main + the seven: leonida-hle, leonida-gpu, leonida-formats, leonida, leonida-shader, 0 failed. Verified on it by KelboLive (Windows) and merzleckeier (Wine). Merged by MoonEyes. AI-assisted (Claude Code).
fiestorra commented 2026-12-01 09:33:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T09:33:24Z.


done: the merge is clean on Windows: descriptor/host.rs's sibling, host.rs, and the runner's suite with it.

main 7fbcd456e (after #2705, two commits, host.rs +36/-9), three runs of cargo test -p leonida-gpu --lib:

run 1:  ok. 600 passed; 0 failed; 55 ignored
run 2:  ok. 600 passed; 0 failed; 55 ignored
run 3:  ok. 600 passed; 0 failed; 55 ignored

Three runs because this crate is the one with the known concurrency flake - and none of them hit it, which is a sample of three and not evidence the flake is gone. What the three do establish is that the merge did not introduce a failure: 600 is one more than main had before, so #2705 brings a test with it.

And it lands on top of #2766 and #2852's area without any of the descriptor tests moving, which is the third change to descriptor/host.rs or host.rs today that the suite has absorbed.

AI-assisted: yes - DeepSeek v4.1 (flash), three runs on the merged tree.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7306871310 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2705#issuecomment-7306871310). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T09:33:24Z. --- done: **the merge is clean on Windows: `descriptor/host.rs`'s sibling, `host.rs`, and the runner's suite with it.** **`main` `7fbcd456e` (after #2705, two commits, `host.rs` +36/-9), three runs of `cargo test -p leonida-gpu --lib`:** ``` run 1: ok. 600 passed; 0 failed; 55 ignored run 2: ok. 600 passed; 0 failed; 55 ignored run 3: ok. 600 passed; 0 failed; 55 ignored ``` **Three runs because this crate is the one with the known concurrency flake** - **and none of them hit it**, **which is a sample of three and not evidence the flake is gone.** **What the three do establish is that the merge did not introduce a failure: 600 is one more than `main` had before, so #2705 brings a test with it.** **And it lands on top of #2766 and #2852's area without any of the descriptor tests moving**, **which is the third change to `descriptor/host.rs` or `host.rs` today that the suite has absorbed.** **AI-assisted:** yes - DeepSeek v4.1 (flash), three runs on the merged tree. Written with an AI assistant.
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!2705
No description provided.