d3d12: a copy in the PC's memory writes back what shaders wrote again (D3D12-COPY-BACK-READ-AS, regression from #2699) #3163

Open
valenciana-nc wants to merge 2 commits from upstream-pr/3163 into main
valenciana-nc commented 2026-12-02 15:47:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by valenciana-nc on 2026-12-02T15:47:12Z.


Claimed in the coordination issue as: D3D12-COPY-BACK-READ-AS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7348400405)

Depends on: none

Fixes a regression from #2699.

What and why

#2699 changed back_piece: the scalar and AVX2 paths now emit runs and no longer fill the mask buffer (_mask). copy_back_with still rebuilds title memory as read from that buffer:

let was: Vec<u8> = title.iter().zip(&mask).map(|(now, changed)| now ^ changed).collect();
written += put_changed(start + at + first, &was[..n], &title[..n]);

was is therefore empty, and &was[..n] panics at the first stretch the GPU wrote back ("range end index N out of range for slice of length 0"). The panic cannot unwind across FFI, so the process aborts.

The path is hand_back → copy_back, i.e. a submission that is not late. That includes every timing run (LEONIDA_GPU_TIMING=1) and late waits off. In a timing run on an RTX 4060 Laptop, it ended the run about 3 minutes into the world.

The fix: back_piece keeps title memory as it read it (read_as, replacing the unused mask), and a new back_into_title passes read_as and the merged bytes to the existing put_changed. This is the contract from before #2699:

  • Only the dwords the GPU changed are written.
  • Exact-back, safecopy and the landing notes are unchanged.
  • A title write that lands meanwhile stays.
  • first/n are kept, and nothing is skipped.

read_as is a buffer reused across pieces, with one copy per differing stretch and no allocation in the steady state.

Tested

  • cargo test -p leonida-gpu --lib --locked -- merge_tests a_copy_in_the_pcs_memory: 9 passed.
  • New end-to-end test land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote goes through Shadow::writing → take_snapshots → Shadow::copy_back. It checks four things:
    • the GPU's bytes land in two pieces;
    • the title's byte wins where both sides changed it;
    • the title's own byte stays;
    • the bytes in between are untouched.
  • Red: with the fill removed, the end-to-end test panics with "range end index 101 out of range for slice of length 0" (the timing run's signature), and two more tests fail.
  • merge_tests::a_stretch_written_back_reaches_title_memory covers back_into_title on its own, including the case where nothing differs. The existing both-changed test now also checks read_as.
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shadow.rs: clean.

GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU 8 GB, driver 621.47, Windows 11 Home (the timing run that panicked; the unit tests need no GPU)

AI-assisted: yes (Claude Opus 5.5 wrote it; a separate read-only Claude Opus 5.5 reviewer agent checked it against the pre-#2699 contract and approved it; its nits are addressed in the second commit)

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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5609879524 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163). Originally posted by [valenciana-nc](https://github.com/valenciana-nc) on 2026-12-02T15:47:12Z. --- Claimed in the coordination issue as: D3D12-COPY-BACK-READ-AS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7348400405) Depends on: none Fixes a regression from #2699. ### What and why #2699 changed `back_piece`: the scalar and AVX2 paths now emit runs and no longer fill the mask buffer (`_mask`). `copy_back_with` still rebuilds title memory as read from that buffer: ``` let was: Vec<u8> = title.iter().zip(&mask).map(|(now, changed)| now ^ changed).collect(); written += put_changed(start + at + first, &was[..n], &title[..n]); ``` `was` is therefore empty, and `&was[..n]` panics at the first stretch the GPU wrote back ("range end index N out of range for slice of length 0"). The panic cannot unwind across FFI, so the process aborts. The path is `hand_back` → `copy_back`, i.e. a submission that is not late. That includes every timing run (`LEONIDA_GPU_TIMING=1`) and late waits off. In a timing run on an RTX 4060 Laptop, it ended the run about 3 minutes into the world. The fix: `back_piece` keeps title memory as it read it (`read_as`, replacing the unused mask), and a new `back_into_title` passes `read_as` and the merged bytes to the existing `put_changed`. This is the contract from before #2699: - Only the dwords the GPU changed are written. - Exact-back, safecopy and the landing notes are unchanged. - A title write that lands meanwhile stays. - `first`/`n` are kept, and nothing is skipped. `read_as` is a buffer reused across pieces, with one copy per differing stretch and no allocation in the steady state. ### Tested - `cargo test -p leonida-gpu --lib --locked -- merge_tests a_copy_in_the_pcs_memory`: 9 passed. - New end-to-end test `land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote` goes through `Shadow::writing` → `take_snapshots` → `Shadow::copy_back`. It checks four things: - the GPU's bytes land in two pieces; - the title's byte wins where both sides changed it; - the title's own byte stays; - the bytes in between are untouched. - **Red:** with the fill removed, the end-to-end test panics with "range end index 101 out of range for slice of length 0" (the timing run's signature), and two more tests fail. - `merge_tests::a_stretch_written_back_reaches_title_memory` covers `back_into_title` on its own, including the case where nothing differs. The existing both-changed test now also checks `read_as`. - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/shadow.rs`: clean. GPUs tested: NVIDIA GeForce RTX 4060 Laptop GPU 8 GB, driver 621.47, Windows 11 Home (the timing run that panicked; the unit tests need no GPU) AI-assisted: yes (Claude Opus 5.5 wrote it; a separate read-only Claude Opus 5.5 reviewer agent checked it against the pre-#2699 contract and approved it; its nits are addressed in the second commit) ### 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)
fiestorra commented 2026-12-02 16:33:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T16:33:12Z.


Verified here: it applies and the shadow group passes with it - 68 tests, 0 failed, including the new one whose name is the fix.

git apply of refs/pull/3163/head on main   (1 file: d3d12/crates/leonida-gpu/src/shadow.rs)

cargo test -p leonida-gpu --lib -- --test-threads=1 shadow
  test result: ok. 68 passed; 0 failed; 2 ignored
  shadow::land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote ... ok

That test name is the whole report: a copy in the PC's memory writes back what shaders wrote - the regression from #2699 that this repairs, stated as the behaviour a reader can check.

And it connects to something I measured about #2699 at the time, which is worth putting here because it is the same bug from the other end: when #2699 landed I read a run where the host's own copy-back check reported comparisons failing - the read-back was being compared against a mask that the run/AVX2 paths no longer filled - which is exactly what this changes. A regression that shows up as "the layer wrote the wrong bytes back" is the kind that corrupts silent state and is invisible for a long time.

What it does not cover: the shaders' actual writes. The test checks the bookkeeping of the mask and the land; whether a real title's compute pass and its CPU copy end up agreeing needs a run, and this machine cannot start the title.

One thing for the merge: the branch's merge base is d94e764d6, some way behind main - the patch applies today, but a rebase before merging would be worth it, and it is cheap.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352112964 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163#issuecomment-7352112964). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T16:33:12Z. --- **Verified here: it applies and the `shadow` group passes with it - 68 tests, 0 failed, including the new one whose name is the fix.** ``` git apply of refs/pull/3163/head on main (1 file: d3d12/crates/leonida-gpu/src/shadow.rs) cargo test -p leonida-gpu --lib -- --test-threads=1 shadow test result: ok. 68 passed; 0 failed; 2 ignored shadow::land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote ... ok ``` **That test name is the whole report**: **a copy in the PC's memory writes back what shaders wrote** - **the regression from #2699 that this repairs, stated as the behaviour a reader can check.** **And it connects to something I measured about #2699 at the time**, which is worth putting here because it is the same bug from the other end: **when #2699 landed I read a run where the host's own copy-back check reported comparisons failing** - **the read-back was being compared against a mask that the run/AVX2 paths no longer filled** - **which is exactly what this changes.** **A regression that shows up as "the layer wrote the wrong bytes back" is the kind that corrupts silent state and is invisible for a long time.** **What it does not cover**: **the shaders' actual writes.** The test checks the bookkeeping of the mask and the land; **whether a real title's compute pass and its CPU copy end up agreeing needs a run**, and this machine cannot start the title. **One thing for the merge**: the branch's merge base is **`d94e764d6`**, **some way behind `main`** - the patch applies today, but a rebase before merging would be worth it, and it is cheap. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
Kal0s-design commented 2026-12-02 17:19:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T17:19:34Z.


Ran natively on Windows 11, head f063f5b33 merged into current main (3c106eb2f, clean merge).

Measured

Check Result
PR tests (merge_tests, land_tests, a_copy_in_the_pcs_memory) on the merge 11 passed, 0 failed
Full cargo test -p leonida-gpu --lib --locked on the merge 698 passed, 0 failed, 59 ignored
shadow:: with --features diagnostics, LEONIDA_D3D12_WARP=1 68 passed, 0 failed
cargo clippy -p leonida-gpu --all-targets --locked only the existing unused_mut in host.rs
Red on plain main: only the new land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote added, no fix panics at shadow.rs:5269, "range end index 101 out of range for slice of length 0"

So the end-to-end test reproduces the reported panic on current main without any mutation. It doesn't depend on removing the fill.

Edge cases (throwaway tests, not pushed). These go through Shadow::writing → take_snapshots → copy_back / copy_back_with on the merge. Each was run with default switches and again in separate processes with LEONIDA_SAFE_COPY=0, LEONIDA_EXACT_BACK=0 and LEONIDA_WIDE_BACK=0. All results were the same.

Case Result
Four whole 64 KiB pieces written by the GPU (AVX2 path) while the title changes every 97th byte, private memory title and copy byte-exact against the expected merge (0 mismatches out of 262,144)
Same, title memory registered as a view (title_memory_view), not guarded 0 mismatches
Unaligned sub-range copy_back(title+150, PIECE+5-150) of a declared 2*PIECE first byte (150), interior bytes and last byte (PIECE+4) written. The bytes before (100, 149) and after (PIECE+5, PIECE+7) are left alone
Wide path: find_all pieces given to copy_back_with pieces [(0,64K),(128K,64K)]. GPU bytes written, a title byte next to them kept
copy_back twice on the same range before copy_back_done second call writes 0 and title memory is unchanged
Third call after the title put a GPU-written byte back to its pre-submission value the GPU byte is written again (ABA: snapshot equals title)

Cost (release, 2000 iterations, 3 runs). back_into_title per stretch, compared with the read_as copy the fix adds:

Stretch back_into_title read_as copy
1 byte 1.5–2.1 µs ~0.03 µs
65,473 B (every 64th byte) 12–18 µs 0.7–0.9 µs
65,536 B (all bytes) 15–18.5 µs 0.8–1.3 µs

The added copy is about 5–7% of a full-piece write-back. In steady state it doesn't allocate, while the pre-#2699 code allocated was for each stretch.

Reading (not measured)

  • Both hand_back branches (wide and not) go through copy_back_with, so the fix covers both. back_piece's only non-test caller is back_into_title, which is reached only from copy_back_with.
  • hand_back joins overlapping ranges before calling copy_back, so each byte is compared once per submission and the ABA case above shouldn't arise through it.
  • runs from back_piece now only decides whether to write. put_changed works out its own dword runs from read_as and the merged bytes, as it did before #2699.
  • With safecopy on (the default), put_changed returns the stretch length, not the bytes changed. The written / COPY_BACK[1] counts are stretch sizes: 262,144 in the whole-piece case above, where about 1% of bytes stayed the title's. This was already the case before #2699 and the PR doesn't change it.

Not checked: write-back into a guarded (read-only) title block, i.e. through the write-watch fault path; an in-game or timing run (LEONIDA_GPU_TIMING=1); a title write racing between the read and the write within the same dword (not deterministic in a unit test); the scalar path for stretches of 32 bytes or more (it only runs on CPUs without AVX2).

GPUs tested: one NVIDIA desktop card + WARP.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353185692 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163#issuecomment-7353185692). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T17:19:34Z. --- Ran natively on Windows 11, head `f063f5b33` merged into current `main` (`3c106eb2f`, clean merge). **Measured** | Check | Result | |---|---| | PR tests (`merge_tests`, `land_tests`, `a_copy_in_the_pcs_memory`) on the merge | 11 passed, 0 failed | | Full `cargo test -p leonida-gpu --lib --locked` on the merge | 698 passed, 0 failed, 59 ignored | | `shadow::` with `--features diagnostics`, `LEONIDA_D3D12_WARP=1` | 68 passed, 0 failed | | `cargo clippy -p leonida-gpu --all-targets --locked` | only the existing `unused_mut` in `host.rs` | | Red on plain `main`: only the new `land_tests::a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote` added, no fix | panics at `shadow.rs:5269`, "range end index 101 out of range for slice of length 0" | So the end-to-end test reproduces the reported panic on current `main` without any mutation. It doesn't depend on removing the fill. **Edge cases (throwaway tests, not pushed).** These go through `Shadow::writing` → `take_snapshots` → `copy_back` / `copy_back_with` on the merge. Each was run with default switches and again in separate processes with `LEONIDA_SAFE_COPY=0`, `LEONIDA_EXACT_BACK=0` and `LEONIDA_WIDE_BACK=0`. All results were the same. | Case | Result | |---|---| | Four whole 64 KiB pieces written by the GPU (AVX2 path) while the title changes every 97th byte, private memory | title and copy byte-exact against the expected merge (0 mismatches out of 262,144) | | Same, title memory registered as a view (`title_memory_view`), not guarded | 0 mismatches | | Unaligned sub-range `copy_back(title+150, PIECE+5-150)` of a declared `2*PIECE` | first byte (150), interior bytes and last byte (`PIECE+4`) written. The bytes before (100, 149) and after (`PIECE+5`, `PIECE+7`) are left alone | | Wide path: `find_all` pieces given to `copy_back_with` | pieces `[(0,64K),(128K,64K)]`. GPU bytes written, a title byte next to them kept | | `copy_back` twice on the same range before `copy_back_done` | second call writes 0 and title memory is unchanged | | Third call after the title put a GPU-written byte back to its pre-submission value | the GPU byte is written again (ABA: snapshot equals title) | **Cost (release, 2000 iterations, 3 runs).** `back_into_title` per stretch, compared with the `read_as` copy the fix adds: | Stretch | `back_into_title` | `read_as` copy | |---|---|---| | 1 byte | 1.5–2.1 µs | ~0.03 µs | | 65,473 B (every 64th byte) | 12–18 µs | 0.7–0.9 µs | | 65,536 B (all bytes) | 15–18.5 µs | 0.8–1.3 µs | The added copy is about 5–7% of a full-piece write-back. In steady state it doesn't allocate, while the pre-#2699 code allocated `was` for each stretch. **Reading (not measured)** - Both `hand_back` branches (wide and not) go through `copy_back_with`, so the fix covers both. `back_piece`'s only non-test caller is `back_into_title`, which is reached only from `copy_back_with`. - `hand_back` joins overlapping ranges before calling `copy_back`, so each byte is compared once per submission and the ABA case above shouldn't arise through it. - `runs` from `back_piece` now only decides whether to write. `put_changed` works out its own dword runs from `read_as` and the merged bytes, as it did before #2699. - With `safecopy` on (the default), `put_changed` returns the stretch length, not the bytes changed. The `written` / `COPY_BACK[1]` counts are stretch sizes: 262,144 in the whole-piece case above, where about 1% of bytes stayed the title's. This was already the case before #2699 and the PR doesn't change it. Not checked: write-back into a guarded (read-only) title block, i.e. through the write-watch fault path; an in-game or timing run (`LEONIDA_GPU_TIMING=1`); a title write racing between the read and the write within the same dword (not deterministic in a unit test); the scalar path for stretches of 32 bytes or more (it only runs on CPUs without AVX2). GPUs tested: one NVIDIA desktop card + WARP. AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 17:59:55 +00:00 (Migrated from github.com)

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


Triage of head f063f5b33 (merge base d94e764d6, 196 commits behind; git merge-tree against current main 45dc41f95: no conflicts).

1 file: d3d12/crates/leonida-gpu/src/shadow.rs (+119/-36).

CI is at action_required on this head (fork workflow approval), not failing.

Existing verification: Verified on this head by @fiestorra (shadow group 68 passed, including a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote) and natively by @Kal0s-design (full leonida-gpu --lib 698 passed, shadow:: under diagnostics on WARP 68 passed, clippy clean) on main 3c106eb2f. Nothing pushed since.

This check: Read the diff: it fixes a real panic introduced by #2699 (copy_back_with rebuilt was from a mask buffer the new run-emitting back_piece no longer fills, so &was[..n] indexed an empty Vec). The fix rebuilds the prior bytes from the runs themselves rather than reinstating the mask, which keeps #2699's speed-up. It also merges cleanly with #2981, the other open shadow.rs change (merge-tree of the two heads: no conflict).

I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here.

Verdict: ready (regression fix for #2699, verified on this head twice; needs CI approval).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353845620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163#issuecomment-7353845620). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T17:59:55Z. --- **Triage of head `f063f5b33` (merge base `d94e764d6`, 196 commits behind; `git merge-tree` against current `main` `45dc41f95`: no conflicts).** 1 file: `d3d12/crates/leonida-gpu/src/shadow.rs` (+119/-36). CI is at `action_required` on this head (fork workflow approval), not failing. **Existing verification:** Verified on this head by @fiestorra (`shadow` group 68 passed, including `a_copy_in_the_pcs_memory_writes_back_what_shaders_wrote`) and natively by @Kal0s-design (full `leonida-gpu --lib` 698 passed, `shadow::` under diagnostics on WARP 68 passed, clippy clean) on `main` `3c106eb2f`. Nothing pushed since. **This check:** Read the diff: it fixes a real panic introduced by #2699 (`copy_back_with` rebuilt `was` from a mask buffer the new run-emitting `back_piece` no longer fills, so `&was[..n]` indexed an empty `Vec`). The fix rebuilds the prior bytes from the runs themselves rather than reinstating the mask, which keeps #2699's speed-up. It also merges cleanly with #2981, the other open `shadow.rs` change (`merge-tree` of the two heads: no conflict). I did not build it: the crate is Windows-only (or the C++ runtime's Windows build), so no red/green was run here. **Verdict: ready** (regression fix for #2699, verified on this head twice; needs CI approval). AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
lixonik commented 2026-12-02 19:07:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T19:07:27Z.


RUN (in game) -- unit tests + 300 s render-path gate run for PR #3163:

  • PR head SHA: f063f5b33
  • Merged onto main SHA: f1a559851 (git merge --no-ff, clean merge)
  • Clean-room check: python -I scripts/check_no_game_data.py PASS
  • Unit tests (Windows 10 x64, Rust 1.98.1): cargo test -p leonida-gpu --features diagnostics --lib --locked shadow:: -- 68 passed, 0 failed, 2 ignored
  • Build: diag profile (diagnostics,dlss,mimalloc), Series S profile, DLSS on, Frame Gen off, same restored save snapshot
  • GPU / Driver / OS: NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64
Run Time in world World samples Device lost / crashes / errors Median rendered FPS (ms) Slowest / fastest tenth (fps) Copying back median (ms) Median draws
PR #3163 (f063f5b33 on f1a559851) 315 s (432.0 s total) 63 0 / 0 / 0 26.5 fps (37.7 ms) 21.5 / 27.4 9.0 ms 4,426
main alone (f1a559851) 303.2 s (480.0 s total) 62 0 / 0 / 0 27.2 fps (36.8 ms) 21.8 / 28.7 8.6 ms 4,385

Loaded cleanly into the world, stayed up past 300 s in-world with 0 device lost / 0 crashes / 0 ERROR lines, and closed cleanly. Rendered FPS and copy-back timing are within normal single-run variance against main.

Verdict: PASS.

AI-assisted: yes (Antigravity).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7355657558 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163#issuecomment-7355657558). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T19:07:27Z. --- RUN (in game) -- unit tests + 300 s render-path gate run for PR #3163: - **PR head SHA:** `f063f5b33` - **Merged onto `main` SHA:** `f1a559851` (`git merge --no-ff`, clean merge) - **Clean-room check:** `python -I scripts/check_no_game_data.py` PASS - **Unit tests (Windows 10 x64, Rust 1.98.1):** `cargo test -p leonida-gpu --features diagnostics --lib --locked shadow::` -- **68 passed, 0 failed, 2 ignored** - **Build:** `diag` profile (`diagnostics,dlss,mimalloc`), Series S profile, DLSS on, Frame Gen off, same restored save snapshot - **GPU / Driver / OS:** NVIDIA GeForce RTX 5070 (12 GB), driver 595.79, Windows 10 x64 | Run | Time in world | World samples | Device lost / crashes / errors | Median rendered FPS (ms) | Slowest / fastest tenth (fps) | Copying back median (ms) | Median draws | | --- | ---: | ---: | --- | ---: | ---: | ---: | ---: | | **PR #3163 (`f063f5b33` on `f1a559851`)** | 315 s (432.0 s total) | 63 | **0 / 0 / 0** | **26.5 fps** (37.7 ms) | 21.5 / 27.4 | 9.0 ms | 4,426 | | **`main` alone (`f1a559851`)** | 303.2 s (480.0 s total) | 62 | **0 / 0 / 0** | **27.2 fps** (36.8 ms) | 21.8 / 28.7 | 8.6 ms | 4,385 | Loaded cleanly into the world, stayed up past 300 s in-world with 0 device lost / 0 crashes / 0 `ERROR` lines, and closed cleanly. Rendered FPS and copy-back timing are within normal single-run variance against `main`. Verdict: **PASS**. AI-assisted: yes (Antigravity).
fiestorra commented 2026-12-02 23:58:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:58:40Z.


VERIFY-3163 — Windows nativo: la suite de shadow pasa, y la guarda era de verdad inalcanzable

Own commit f063f5b33 — shadow.rs, +18/−22 (a refactor of back_into_title)

Ran at the head

cargo test -p leonida-gpu --lib shadow     68 passed; 0 failed; 2 ignored

No control, and I will say why it cannot exist: the commit removes a guard (if runs.is_empty() { … }) that could not be reached, so there is no behaviour to mutate — re-introducing it would compile and pass, which is exactly the proof that it was dead. red not constructible.

What I checked instead, which is the only claim worth checking in a commit like this: is the guard really dead? back_into_title now starts with

// Some only with runs to write.
let Some((first, n)) = back_piece(host, old, title, read_as, runs, read) else {
    return 0;
};

and back_piece returns None when there is nothing to write — so the runs.is_empty() case is the None case, and the removed guard was a second return 0 for the same condition. The comment "Some only with runs to write" is the whole justification, and it is the right one.

The other half of the commit is the doc: a five-line paragraph about #2699 became one parenthetical — "Without title memory as read, which #2699 left unfilled, this sliced an empty buffer at the first GPU byte." The panic it describes is real and the date is in it, which is what a future reader needs; the rest was the archaeology of how it was found.

What I could not test

  • The copy-back on a title's frame: no game. What is verified is that removing the guard changes no test — and for a dead guard, that is the strongest statement available.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7362652460 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3163#issuecomment-7362652460). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T23:58:40Z. --- ## VERIFY-3163 — Windows nativo: la suite de `shadow` pasa, y la guarda era de verdad inalcanzable | | | |---|---| | Own commit | `f063f5b33` — `shadow.rs`, +18/−22 (a refactor of `back_into_title`) | **Ran at the head** ``` cargo test -p leonida-gpu --lib shadow 68 passed; 0 failed; 2 ignored ``` **No control, and I will say why it cannot exist**: the commit **removes** a guard (`if runs.is_empty() { … }`) that could not be reached, **so there is no behaviour to mutate** — **re-introducing it would compile and pass, which is exactly the proof that it was dead.** **`red not constructible`.** **What I checked instead, which is the only claim worth checking in a commit like this**: **is the guard really dead?** `back_into_title` now starts with ```rust // Some only with runs to write. let Some((first, n)) = back_piece(host, old, title, read_as, runs, read) else { return 0; }; ``` **and `back_piece` returns `None` when there is nothing to write** — so the `runs.is_empty()` case **is** the `None` case, and the removed guard was a second `return 0` for the same condition. **The comment "Some only with runs to write" is the whole justification, and it is the right one.** **The other half of the commit is the doc**: **a five-line paragraph about #2699 became one parenthetical** — *"Without title memory as read, which #2699 left unfilled, this sliced an empty buffer at the first GPU byte."* **The panic it describes is real and the date is in it**, which is what a future reader needs; **the rest was the archaeology of how it was found.** ## What I could not test - **The copy-back on a title's frame**: no game. **What is verified is that removing the guard changes no test** — **and for a dead guard, that is the strongest statement available.** Written with an AI assistant.
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/3163:upstream-pr/3163'
git switch 'upstream-pr/3163'

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/3163'
git switch 'upstream-pr/3163'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3163'
git switch 'upstream-pr/3163'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3163'
git switch 'main'
git merge --squash 'upstream-pr/3163'
git switch 'main'
git merge --ff-only 'upstream-pr/3163'
git switch 'main'
git merge 'upstream-pr/3163'
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!3163
No description provided.