d3d12: exclude write-combined sub-ranges from mixed copy-back (D3D12-WC-SUBRANGE-NO-BACK) #2795

Merged
hardly-relevant merged 1 commit from upstream-pr/2795 into main 2026-12-01 02:18:46 +00:00
hardly-relevant commented 2026-11-30 21:36:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hardly-relevant on 2026-11-30T21:36:50Z.


Claimed in the coordination issue as: D3D12-WC-SUBRANGE-NO-BACK (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263187405)

Overlaps with: #2703, #2569 (same function title_memory_freed in d3d12/crates/leonida-gpu/src/watch.rs; neither is a dependency — whichever merges later needs a small rebase)

What and why

Shadow::gpu_writes currently only skips write-combined (WC) copy-back when an entire card copy sits inside a registered WC region (LEONIDA_WC_NO_BACK). For mixed reservations split with MEM_REPLACE_PLACEHOLDER — notably the 185 MiB 32-bit graphics heap split across 0x1004/0x1404/0x8404/0x2404/0x2004 parts — two gaps prevented skipping the 0x2404 WC sub-range:

  1. XMemVirtualAlloc's MEM_REPLACE_PLACEHOLDER early-return path registered GPU_READ_ONLY (0x1000 / 0x8000) but did not register write-combined (asked & 0x400 != 0) sub-ranges (and watch::title_memory_freed with len == 0 on MEM_RELEASE did not resolve the full allocation span to clear split sub-ranges).
  2. Shadow::gpu_writes treated a card copy spanning mixed classes as wholly non-WC rather than subtracting qualifying WC sub-ranges (>= LEONIDA_WC_MIN_BYTES) alongside GPU_READ_ONLY.

Changes:

  • d3d12/crates/leonida-hle/src/modules/xmem.rs: Register asked & 0x400 != 0 via leonida_gpu::title_memory_write_combined (and guard both WC and GPU-RO registration with !base.is_null()) in the MEM_REPLACE_PLACEHOLDER path; add placeholder_replace_registers_write_combined_and_gpu_read_only.
  • d3d12/crates/leonida-gpu/src/watch.rs: Resolve the allocation span once via allocation_end(at, at) on title_memory_freed(at, 0) (when at != 0 and memory classes are registered), clearing split WC/GPU-RO sub-ranges on MEM_RELEASE and reusing the cached end for forget_views.
  • d3d12/crates/leonida-gpu/src/lib.rs: Re-export title_memory_is_write_combined and title_memory_is_gpu_read_only under #[cfg(windows)].
  • d3d12/crates/leonida-gpu/src/shadow.rs:
    • Sort/deduplicate WRITE_COMBINED and GPU_READ_ONLY tables (saturating_add), track ANY_WRITE_COMBINED, update ANY_* flags inside write locks on free, and expose has_memory_classes().
    • Extend Shadow.wc to 4 states (WcKind: unknown / none / whole / partial) so Shadow::gpu_writes skips extra work for non-WC and whole-WC copies and preserves standalone LEONIDA_WC_NO_BACK behavior.
    • Add opt-in LEONIDA_WC_SUBRANGE_NO_BACK (default off; LEONIDA_AB-switchable; disabled by explicit LEONIDA_WC_NO_BACK=0 unless LEONIDA_AB overrides LEONIDA_WC_NO_BACK).
    • On partial-WC card copies when enabled, run a zero-allocation 4-slot inline interval pass (SmallRanges spilling to Vec only above 4 intervals) subtracting GPU_READ_ONLY first (GPU_RO_DECLARED, avoiding double-counting overlaps like 0x1404/0x8404) and qualifying >= wc_min WC sub-ranges second (WC_LEFT, lock dropped before emit).
    • Expand shadow::write_combined_tests to 7 unit tests covering clipping/merging/minimum-size filtering, mixed GPU-RO + WC subtraction, WcKind classification, SmallRanges spill, and switch policy.

Kept opt-in (LEONIDA_WC_SUBRANGE_NO_BACK=0 by default) pending broader hardware/scene confirmation, since copy-back savings only translate into frame-time gains when relay landing is on the critical path.

Tested

Unit tests, checks, and clippy re-run after rebasing onto main (0b6e0e3bc):

  • python -I scripts/check_no_game_data.py on all 4 modified files: pass
  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib shadow::write_combined_tests: 7 passed, 0 failed
  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --features diagnostics --lib shadow::write_combined_tests: 7 passed, 0 failed
  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib -- --test-threads=4: 585 passed, 0 failed (52 ignored)
  • cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-hle --lib: 222 passed, 0 failed (2 ignored)
  • cargo check --manifest-path d3d12/Cargo.toml --locked -p leonida: pass
  • cargo clippy --manifest-path d3d12/Cargo.toml --locked -p leonida-hle -p leonida-gpu --features diagnostics --lib --tests: pass (0 warnings in modified lines)

Live retail-package runs (Series X profile, 2560x1440, render scale 0.6667, title upscaler, LEONIDA_WC_NO_BACK=1, LEONIDA_RELAY=2, diag profile with diagnostics,dlss,mimalloc, run on the same patchset prior to rebasing onto 0b6e0e3bc):

  • Moving/driving in-process A/B (LEONIDA_AB=4,LEONIDA_WC_SUBRANGE_NO_BACK, LEONIDA_FRAME_GEN=0, 8 min, 0 errors/TDRs):
    • All 5 split parts of the 185 MiB 32-bit heap registered (10 MiB 0x1004, 1 MiB 0x1404, 27 MiB 0x8404, 47 MiB 0x2404, 100 MiB 0x2004).
    • Post-compile heavy stretch (22 phases, ~9,300 draws/frame, n=9 drift-cancelled triplets): mean -6.41 ± 4.80 ms (8/9), p90 -13.59 ± 10.88 ms (8/9), jitter -7.28 ± 6.55 ms, landed new 4 KiB pages -17.4% (1,552 → 1,282), exact sawtooth on 12/12 consecutive phase flips.
  • Stationary / camera-hold in-process A/B (LEONIDA_AB=4,LEONIDA_WC_SUBRANGE_NO_BACK, LEONIDA_FRAME_GEN=0, 8 min, 56 stationary phases across 5 camera holds, 0 errors/TDRs):
    • All stationary interior telemetry (OFF n=77 / ON n=78): WC_LEFT +1,648 MB/frame (24,225 → 25,873 MB, +6.8%), GPU_RO_DECLARED unchanged (589.8 → 591.3 MB), landed pieces 296.2 → 263.3 (-11.1%), landed new 4 KiB pages 1,373.7 → 1,122.1 (-18.3%, 5.37 → 4.38 MB/frame), compare passes 439.4 → 432.9 (-1.5%), relay landing 11.62 → 10.57 ms (-9.0%).
    • High-draw stationary holds (~8,300–9,400 draws/frame, 22 phases, n=9 draw-locked <=3% drift-cancelled triplets): median -1.06 ± 0.92 ms (57.96 → 57.00 ms, 6/9), mean -0.96 ± 1.11 ms (59.88 → 58.99 ms), p90 -2.44 ± 2.52 ms (69.96 → 67.86 ms), submit worked -0.33 ± 0.12 ms (8/9), landed new 4 KiB pages -21.8% (1,679 → 1,313), relay landing -1.54 ms (12.80 → 11.26 ms), compare passes -13.0/frame.
    • Lighter stationary holds (~3,700–6,300 draws/frame, 29 phases, n=11 draw-locked <=3% triplets): frame time flat (+0.30 ± 0.61 ms median, +0.43 ± 0.89 ms mean; submit worked -0.15 ± 0.14 ms) because the ~10–11 ms relay landing sits behind async submit at ~50 ms/frame.
    • Paired ON/OFF visual check on the same standing scene showed no new visual regressions.
  • Steady-on DLSS Frame Generation 2x (LEONIDA_WC_SUBRANGE_NO_BACK=1, LEONIDA_FRAME_GEN=2, no LEONIDA_AB): 0 errors/TDRs, 2x FG active (status=0, presented=2), reduced copy-back confirmed (290 landed pieces / 1,293 new 4 KiB pages / 5.05 MB at median 10,188 draws), no new visual regressions.

GPUs tested: NVIDIA GeForce RTX 4080 Laptop GPU (12 GB VRAM), driver 621.40, Windows 11 (Intel Core Ultra 9 185H, 31.4 GB RAM)

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 — D3D12 shadow/HLE change only)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5574204435 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795). Originally posted by [hardly-relevant](https://github.com/hardly-relevant) on 2026-11-30T21:36:50Z. --- Claimed in the coordination issue as: D3D12-WC-SUBRANGE-NO-BACK (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263187405) Overlaps with: #2703, #2569 (same function `title_memory_freed` in `d3d12/crates/leonida-gpu/src/watch.rs`; neither is a dependency — whichever merges later needs a small rebase) ### What and why `Shadow::gpu_writes` currently only skips write-combined (WC) copy-back when an entire card copy sits inside a registered WC region (`LEONIDA_WC_NO_BACK`). For mixed reservations split with `MEM_REPLACE_PLACEHOLDER` — notably the 185 MiB 32-bit graphics heap split across `0x1004`/`0x1404`/`0x8404`/`0x2404`/`0x2004` parts — two gaps prevented skipping the `0x2404` WC sub-range: 1. `XMemVirtualAlloc`'s `MEM_REPLACE_PLACEHOLDER` early-return path registered `GPU_READ_ONLY` (`0x1000` / `0x8000`) but did not register write-combined (`asked & 0x400 != 0`) sub-ranges (and `watch::title_memory_freed` with `len == 0` on `MEM_RELEASE` did not resolve the full allocation span to clear split sub-ranges). 2. `Shadow::gpu_writes` treated a card copy spanning mixed classes as wholly non-WC rather than subtracting qualifying WC sub-ranges (`>= LEONIDA_WC_MIN_BYTES`) alongside `GPU_READ_ONLY`. Changes: - `d3d12/crates/leonida-hle/src/modules/xmem.rs`: Register `asked & 0x400 != 0` via `leonida_gpu::title_memory_write_combined` (and guard both WC and GPU-RO registration with `!base.is_null()`) in the `MEM_REPLACE_PLACEHOLDER` path; add `placeholder_replace_registers_write_combined_and_gpu_read_only`. - `d3d12/crates/leonida-gpu/src/watch.rs`: Resolve the allocation span once via `allocation_end(at, at)` on `title_memory_freed(at, 0)` (when `at != 0` and memory classes are registered), clearing split WC/GPU-RO sub-ranges on `MEM_RELEASE` and reusing the cached end for `forget_views`. - `d3d12/crates/leonida-gpu/src/lib.rs`: Re-export `title_memory_is_write_combined` and `title_memory_is_gpu_read_only` under `#[cfg(windows)]`. - `d3d12/crates/leonida-gpu/src/shadow.rs`: - Sort/deduplicate `WRITE_COMBINED` and `GPU_READ_ONLY` tables (`saturating_add`), track `ANY_WRITE_COMBINED`, update `ANY_*` flags inside write locks on free, and expose `has_memory_classes()`. - Extend `Shadow.wc` to 4 states (`WcKind`: unknown / none / whole / partial) so `Shadow::gpu_writes` skips extra work for non-WC and whole-WC copies and preserves standalone `LEONIDA_WC_NO_BACK` behavior. - Add opt-in `LEONIDA_WC_SUBRANGE_NO_BACK` (default off; `LEONIDA_AB`-switchable; disabled by explicit `LEONIDA_WC_NO_BACK=0` unless `LEONIDA_AB` overrides `LEONIDA_WC_NO_BACK`). - On partial-WC card copies when enabled, run a zero-allocation 4-slot inline interval pass (`SmallRanges` spilling to `Vec` only above 4 intervals) subtracting `GPU_READ_ONLY` first (`GPU_RO_DECLARED`, avoiding double-counting overlaps like `0x1404`/`0x8404`) and qualifying `>= wc_min` WC sub-ranges second (`WC_LEFT`, lock dropped before `emit`). - Expand `shadow::write_combined_tests` to 7 unit tests covering clipping/merging/minimum-size filtering, mixed GPU-RO + WC subtraction, `WcKind` classification, `SmallRanges` spill, and switch policy. Kept opt-in (`LEONIDA_WC_SUBRANGE_NO_BACK=0` by default) pending broader hardware/scene confirmation, since copy-back savings only translate into frame-time gains when relay landing is on the critical path. ### Tested Unit tests, checks, and clippy re-run after rebasing onto `main` (`0b6e0e3bc`): - `python -I scripts/check_no_game_data.py` on all 4 modified files: pass - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib shadow::write_combined_tests`: 7 passed, 0 failed - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --features diagnostics --lib shadow::write_combined_tests`: 7 passed, 0 failed - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-gpu --lib -- --test-threads=4`: 585 passed, 0 failed (52 ignored) - `cargo test --manifest-path d3d12/Cargo.toml --locked -p leonida-hle --lib`: 222 passed, 0 failed (2 ignored) - `cargo check --manifest-path d3d12/Cargo.toml --locked -p leonida`: pass - `cargo clippy --manifest-path d3d12/Cargo.toml --locked -p leonida-hle -p leonida-gpu --features diagnostics --lib --tests`: pass (0 warnings in modified lines) Live retail-package runs (Series X profile, 2560x1440, render scale `0.6667`, title upscaler, `LEONIDA_WC_NO_BACK=1`, `LEONIDA_RELAY=2`, `diag` profile with `diagnostics,dlss,mimalloc`, run on the same patchset prior to rebasing onto `0b6e0e3bc`): - **Moving/driving in-process A/B** (`LEONIDA_AB=4,LEONIDA_WC_SUBRANGE_NO_BACK`, `LEONIDA_FRAME_GEN=0`, 8 min, 0 errors/TDRs): - All 5 split parts of the 185 MiB 32-bit heap registered (`10 MiB 0x1004`, `1 MiB 0x1404`, `27 MiB 0x8404`, `47 MiB 0x2404`, `100 MiB 0x2004`). - Post-compile heavy stretch (22 phases, ~9,300 draws/frame, `n=9` drift-cancelled triplets): mean `-6.41 ± 4.80 ms` (8/9), p90 `-13.59 ± 10.88 ms` (8/9), jitter `-7.28 ± 6.55 ms`, landed new 4 KiB pages `-17.4%` (`1,552 → 1,282`), exact sawtooth on 12/12 consecutive phase flips. - **Stationary / camera-hold in-process A/B** (`LEONIDA_AB=4,LEONIDA_WC_SUBRANGE_NO_BACK`, `LEONIDA_FRAME_GEN=0`, 8 min, 56 stationary phases across 5 camera holds, 0 errors/TDRs): - All stationary interior telemetry (`OFF n=77` / `ON n=78`): `WC_LEFT` `+1,648 MB/frame` (`24,225 → 25,873 MB`, `+6.8%`), `GPU_RO_DECLARED` unchanged (`589.8 → 591.3 MB`), landed pieces `296.2 → 263.3` (`-11.1%`), landed new 4 KiB pages `1,373.7 → 1,122.1` (`-18.3%`, `5.37 → 4.38 MB/frame`), compare passes `439.4 → 432.9` (`-1.5%`), relay landing `11.62 → 10.57 ms` (`-9.0%`). - High-draw stationary holds (~8,300–9,400 draws/frame, 22 phases, `n=9` draw-locked `<=3%` drift-cancelled triplets): median `-1.06 ± 0.92 ms` (`57.96 → 57.00 ms`, 6/9), mean `-0.96 ± 1.11 ms` (`59.88 → 58.99 ms`), p90 `-2.44 ± 2.52 ms` (`69.96 → 67.86 ms`), submit worked `-0.33 ± 0.12 ms` (8/9), landed new 4 KiB pages `-21.8%` (`1,679 → 1,313`), relay landing `-1.54 ms` (`12.80 → 11.26 ms`), compare passes `-13.0/frame`. - Lighter stationary holds (~3,700–6,300 draws/frame, 29 phases, `n=11` draw-locked `<=3%` triplets): frame time flat (`+0.30 ± 0.61 ms` median, `+0.43 ± 0.89 ms` mean; submit worked `-0.15 ± 0.14 ms`) because the ~10–11 ms relay landing sits behind async submit at ~50 ms/frame. - Paired ON/OFF visual check on the same standing scene showed no new visual regressions. - **Steady-on DLSS Frame Generation 2x** (`LEONIDA_WC_SUBRANGE_NO_BACK=1`, `LEONIDA_FRAME_GEN=2`, no `LEONIDA_AB`): 0 errors/TDRs, 2x FG active (`status=0`, `presented=2`), reduced copy-back confirmed (`290` landed pieces / `1,293` new 4 KiB pages / `5.05 MB` at median `10,188` draws), no new visual regressions. GPUs tested: NVIDIA GeForce RTX 4080 Laptop GPU (12 GB VRAM), driver 621.40, Windows 11 (Intel Core Ultra 9 185H, 31.4 GB RAM) 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 — D3D12 shadow/HLE change only)
OreoFR commented 2026-11-30 21:42:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T21:42:05Z.


Verified by OreoFR on macOS 27.2.1, Apple M5, head f85d1790a, main 0b6e0e3bc. This is a type-check only: leonida-gpu does not build natively on macOS (Windows-only modules, the same on main), so the Mac can't run your unit tests.

MEASURED

  • git merge-tree of this head onto main 0b6e0e3bc gives no conflicts.
  • cargo check --target x86_64-pc-windows-msvc (no MSVC; the cc build steps are replaced with stand-ins that only create their output files), main vs main + this PR, exit 0 on both sides. The sorted warning lists are byte-identical:
    • -p leonida-gpu: 19 / 19
    • -p leonida-gpu --features diagnostics: 11 / 11
    • -p leonida-gpu --tests: 24 / 24 (this compiles the 7 new shadow::write_combined_tests)
    • -p leonida-hle --tests: 19 / 19 (this compiles placeholder_replace_registers_write_combined_and_gpu_read_only)
  • So the change adds no new warning or error in either crate, with or without diagnostics.

READ IN CODE

  • The switch exists and is opt-in: wc_subrange_no_back() (shadow.rs:3053 in this head) returns false unless LEONIDA_WC_SUBRANGE_NO_BACK is asked. An explicit LEONIDA_WC_NO_BACK=0 turns it off, and the LEONIDA_AB bit for LEONIDA_WC_NO_BACK is only read under diagnostics. With the switch unset, gpu_writes keeps its previous behavior. The new WcKind classification and the xmem.rs/watch.rs registration and release changes still run, and the type-check covers them.

ASSUMED

  • The unit test results (585 / 222 passed) and the in-game A/B are from your run on Windows. Not reproduced here.
  • The PR text says "Depends on: #2703, #2569 (does not build on either…)". On current main it applies and type-checks on its own, so the remaining question is only the rebase order with those two.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7292772176 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7292772176). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T21:42:05Z. --- Verified by OreoFR on macOS 27.2.1, Apple M5, head `f85d1790a`, main `0b6e0e3bc`. This is a type-check only: `leonida-gpu` does not build natively on macOS (Windows-only modules, the same on main), so the Mac can't run your unit tests. **MEASURED** - `git merge-tree` of this head onto main `0b6e0e3bc` gives no conflicts. - `cargo check --target x86_64-pc-windows-msvc` (no MSVC; the `cc` build steps are replaced with stand-ins that only create their output files), main vs main + this PR, exit 0 on both sides. The sorted warning lists are byte-identical: - `-p leonida-gpu`: 19 / 19 - `-p leonida-gpu --features diagnostics`: 11 / 11 - `-p leonida-gpu --tests`: 24 / 24 (this compiles the 7 new `shadow::write_combined_tests`) - `-p leonida-hle --tests`: 19 / 19 (this compiles `placeholder_replace_registers_write_combined_and_gpu_read_only`) - So the change adds no new warning or error in either crate, with or without `diagnostics`. **READ IN CODE** - The switch exists and is opt-in: `wc_subrange_no_back()` (`shadow.rs:3053` in this head) returns `false` unless `LEONIDA_WC_SUBRANGE_NO_BACK` is asked. An explicit `LEONIDA_WC_NO_BACK=0` turns it off, and the `LEONIDA_AB` bit for `LEONIDA_WC_NO_BACK` is only read under `diagnostics`. With the switch unset, `gpu_writes` keeps its previous behavior. The new `WcKind` classification and the `xmem.rs`/`watch.rs` registration and release changes still run, and the type-check covers them. **ASSUMED** - The unit test results (585 / 222 passed) and the in-game A/B are from your run on Windows. Not reproduced here. - The PR text says "Depends on: #2703, #2569 (does not build on either…)". On current main it applies and type-checks on its own, so the remaining question is only the rebase order with those two. AI-assisted: Claude Code
OreoFR commented 2026-11-30 23:46:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T23:46:39Z.


RUN - independent verification (Verified by OreoFR) - RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Pro 10.0.26300.

  • Base: main b1f91c2f9; green = main + this PR at f85d1790a (git merge --no-ff, clean, merge commit ad887098c). Head re-checked at the end: still f85d1790a. The newer main 398c085c4 (it brings #2779 and LEONIDA_SEND_CHANGED in LEONIDA_AB, touching shadow.rs and watch.rs) also merges cleanly (git merge-tree --write-tree, exit 0).
  • #2703 and #2569 are both still open. As the description says, this PR does not build on them.
  • Switch: LEONIDA_WC_SUBRANGE_NO_BACK is off unless set (crate::asked!). An explicit LEONIDA_WC_NO_BACK=0 also turns it off. Some parts are not behind the switch:
    • the xmem.rs registration of the write-combined parts of the split 32-bit heap;
    • the watch.rs release over the whole allocation span;
    • the sorted, deduplicated tables.
  • Command (from d3d12/, one worktree and one target/ per arm): cargo test --locked -p leonida-gpu and cargo test --locked -p leonida-hle.

Red / green

"Main + only the new tests" does not compile: the tests import plan_gpu_write_ranges, classify_write_combined, title_memory_is_write_combined and others that main does not have. So red is the PR with one fix hunk reverted at a time.

Arm leonida-gpu (lib) leonida-hle (lib)
main b1f91c2f9 582 passed, 0 failed 221 passed, 0 failed
red 1: without the 3 lines in xmem.rs that register the write-combined part - 221 passed, 1 failed
red 2: watch.rs back to main 587 passed, 0 failed 221 passed, 1 failed
red 3: the sub-range subtraction in for_each_gpu_write_range disabled (&& false) 584 passed, 3 failed -
green (main + PR) 587 passed, 0 failed 222 passed, 0 failed
  • Red 1: placeholder_replace_registers_write_combined_and_gpu_read_only fails at xmem.rs:3256. No page is write-combined ([false, false, false, false], expected [false, true, true, false]).
  • Red 2: the same test fails at xmem.rs:3264 with "WC cleared on page 1": with main's title_memory_freed(at, 0), a MEM_RELEASE forgets only the region that starts at at.
  • Red 3:
    • mixed_copy_subtracts_gpu_ro_then_wc_subranges and small_ranges_spills_past_four_intervals fail with wc_left: 0, and the ranges are kept whole.
    • The third failure, watch::tests::freed_memory_leaves_no_notes, is a flake that is already on main. I ran cargo test -p leonida-gpu --lib 8 times on each arm:
      • main failed it once (watch.rs:5163, its first assertion, before any free);
      • the PR passed 8 of 8 (587 each time).
  • The 52 ignored tests in leonida-gpu and 2 in leonida-hle are the same on every arm.

In game. I built a diag leonida.exe of main and of main + PR with build-nvidia.ps1 (diagnostics,dlss,mimalloc).

  • Start command: play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log, with LEONIDA_WINDOWS_BAR_MB=0 and LEONIDA_TEXTURE_BUDGET_MB=1024.
  • Data: a fresh copy of our gate data folder (prologue cell, standing still), shared by all runs.
  • Switches:
    • A is main with LEONIDA_WC_NO_BACK=1. That is the value play-nvidia.ps1 sets for every NVIDIA player.
    • B is main + PR with the same switch plus LEONIDA_WC_SUBRANGE_NO_BACK=1.
    • B0 is main + PR with neither switch named: the player's default, with WC_NO_BACK on from play-nvidia.ps1.
  • Order: one warm-up each, then A B B A, then B0.
  • Window: fps and copy-back figures are medians of the per-second lines from +30 s to +330 s after the first frame with 500+ draws.
run into the world frames in the world fps median / p5 draws/frame "copying back" ms / MB a frame relay landing ms landed pieces compare passes WC left on the card, MB a frame GPU-RO left out, MB device lost / panic alive at end
A warm-up (cold, 925 pipelines being made) 104 s 289 s 6.6 / 0.1 4428 14.1 / 1.1 15.3 487 394 114,199 782 0 / 0 yes
B warm-up (cold, 937 being made) 101 s 287 s 0.5 / 0.1 4610 13.9 / 0.8 14.1 474 421 122,527 845 0 / 0 yes
A1 49 s 403 s 20.6 / 12.3 4190 10.6 / 1.0 11.2 503 379 73,656 651 0 / 0 yes
B1 62 s 386 s 24.6 / 1.6 2394 8.6 / 1.2 10.2 420 454 28,714 592 0 / 0 yes
B2 68 s 382 s 28.1 / 16.5 2196 7.8 / 1.3 9.6 405 450 27,476 592 0 / 0 yes
A2 58 s 395 s 17.7 / 12.3 3734 14.0 / 1.8 22.5 488 418 28,872 620 0 / 0 yes
B0 (PR, default switches) 58 s 393 s 22.7 / 18.1 3393 11.3 / 1.3 13.8 467 421 28,861 596 0 / 0 yes
  • "Into the world" is counted from the start of the runtime's log. The precompile before it took about 9 minutes on each warm-up, the first start of each new exe.
  • No run had a device loss, a panic or a fault. All 7 were alive when the script closed them.
  • The longest frame gaps were 6.5 to 10.2 s, in every arm. B1 had the 10.2 s gap and the low p5: its pipelines were still being made (472 at most), after a warm-up that did not finish making them.

What the copy-back numbers say

  • Registration works on this PC. All 5 parts of the 185 MiB heap arrive through MEM_REPLACE_PLACEHOLDER in every run: 10 MiB 0x1004, 1 MiB 0x1404, 27 MiB 0x8404, 47 MiB 0x2404 and 100 MiB 0x2004. These are the sizes your description gives.
  • The default path did not change anything I could see here. No run logged a "write-combined title memory ... not copied back" line for a copy inside that heap. There were 63-66 such lines per run, the same on A and B0. So on this scene, the new registration did not make any copy wholly write-combined. B0's copy-back figures are within A's range: WC left 28,861 vs 28,872 MB, landing 13.8 vs 11.2-22.5 ms.
  • The sub-range path cannot be isolated from the log. It adds to the same WC_LEFT counter as whole write-combined copies, and that counter changes with the scene far more than the gain you measured (+1,648 MB a frame): A1 73,656 vs A2 28,872 MB a frame, in the same arm. The B runs went the way you describe:
    • landed pieces 420 / 405 vs A 503 / 488 (-17 %);
    • "copying back" 8.6 / 7.8 ms vs 10.6 / 14.0;
    • relay landing 10.2 / 9.6 ms vs 11.2 / 22.5.
  • But B and A did not render the same scene. B drew 2,196-2,394 draws a frame and A drew 3,734-4,190, from the same save, standing still. So the fps (B 24.6 / 28.1 vs A 20.6 / 17.7) and the copy-back drop cannot be credited to the PR from these runs. I count the gain as not confirmed here (n=2, scene not matched). It is not contradicted either. An in-process LEONIDA_AB=...,LEONIDA_WC_SUBRANGE_NO_BACK run, as in your description, would remove the scene difference. A counter of its own for the sub-range bytes would help too.

Safe to merge into main? Yes, with one note on point 3.

  1. Clean merge: yes. git merge-tree --write-tree gives no conflict on b1f91c2f9 or on the newer 398c085c4. #2703 and #2569 are not merged yet. Whichever of the three merges second needs the small watch.rs rebase the description announces.
  2. CI: yes. All 5 jobs pass on f85d1790a: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests.
  3. Off by default: the sub-range exclusion is off by default. Two parts run without the switch:
    • Registration: the write-combined parts of the split heap are now registered. With the LEONIDA_WC_NO_BACK=1 that play-nvidia.ps1 sets, a copy of 1 MiB or more lying wholly inside the 47 MiB 0x2404 part would now be left on the card. In my B0 run no such copy happened (0 lines inside the heap), and the run was stable.
    • Release: MEM_RELEASE now clears those regions over the whole allocation.
    • This is a small change in default behaviour. It is not a risk seen in game.
  4. Repository checks: yes.
    • check_no_game_data.py on the 4 changed files: clean.
    • cargo test -p leonida-gpu: 587/587. The only failure seen is the freed_memory_leaves_no_notes flake, which main has too.
    • cargo test -p leonida-hle: 222/222.
  5. Scope: yes. The diff is shadow.rs, watch.rs, lib.rs (2 re-exports) and xmem.rs, all on the write-combined / GPU read-only copy-back path, with 7 + 1 unit tests. d3d12/docs/switches.md does not list the new switch yet; that is not required by CI.

Verdict:

  • CPU red/green and merge safety: PASS.
  • In game: PASS for stability (PROVISIONAL: one PC, n=2 measured runs per arm, standing still). No device loss, no panic, alive at the end in all 7 runs, B0 included. The copy-back and fps gain is not confirmed, because the A and B scenes differed (draws a frame 3,700-4,200 vs 2,200-2,400).

Not covered:

  • Moving or driving runs, and the heavier scenes (8,000+ draws a frame) where your description finds the gain.
  • An in-process LEONIDA_AB A/B on this card.
  • DLSS, frame generation, Series X, BAR on, and other cards.
  • LEONIDA_GPU_READ_ONLY_NO_BACK=0, where the 27 MiB 0x8404 part is subtracted as write-combined.
  • A picture check: screenshots were taken but not compared side by side.

AI-assisted (Claude Code, oreofr-agent).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7295514359 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7295514359). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-30T23:46:39Z. --- **RUN - independent verification (Verified by OreoFR)** - RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Pro 10.0.26300. - **Base:** main `b1f91c2f9`; green = main + this PR at `f85d1790a` (`git merge --no-ff`, clean, merge commit `ad887098c`). Head re-checked at the end: still `f85d1790a`. The newer main `398c085c4` (it brings #2779 and `LEONIDA_SEND_CHANGED` in `LEONIDA_AB`, touching `shadow.rs` and `watch.rs`) also merges cleanly (`git merge-tree --write-tree`, exit 0). - #2703 and #2569 are both still open. As the description says, this PR does not build on them. - **Switch:** `LEONIDA_WC_SUBRANGE_NO_BACK` is off unless set (`crate::asked!`). An explicit `LEONIDA_WC_NO_BACK=0` also turns it off. Some parts are not behind the switch: - the `xmem.rs` registration of the write-combined parts of the split 32-bit heap; - the `watch.rs` release over the whole allocation span; - the sorted, deduplicated tables. - **Command** (from `d3d12/`, one worktree and one `target/` per arm): `cargo test --locked -p leonida-gpu` and `cargo test --locked -p leonida-hle`. **Red / green** "Main + only the new tests" does not compile: the tests import `plan_gpu_write_ranges`, `classify_write_combined`, `title_memory_is_write_combined` and others that main does not have. So red is the PR with one fix hunk reverted at a time. | Arm | leonida-gpu (lib) | leonida-hle (lib) | |---|---|---| | main `b1f91c2f9` | 582 passed, 0 failed | 221 passed, 0 failed | | red 1: without the 3 lines in `xmem.rs` that register the write-combined part | - | 221 passed, **1 failed** | | red 2: `watch.rs` back to main | 587 passed, 0 failed | 221 passed, **1 failed** | | red 3: the sub-range subtraction in `for_each_gpu_write_range` disabled (`&& false`) | 584 passed, **3 failed** | - | | green (main + PR) | 587 passed, 0 failed | 222 passed, 0 failed | - **Red 1:** `placeholder_replace_registers_write_combined_and_gpu_read_only` fails at `xmem.rs:3256`. No page is write-combined (`[false, false, false, false]`, expected `[false, true, true, false]`). - **Red 2:** the same test fails at `xmem.rs:3264` with "WC cleared on page 1": with main's `title_memory_freed(at, 0)`, a `MEM_RELEASE` forgets only the region that starts at `at`. - **Red 3:** - `mixed_copy_subtracts_gpu_ro_then_wc_subranges` and `small_ranges_spills_past_four_intervals` fail with `wc_left: 0`, and the ranges are kept whole. - The third failure, `watch::tests::freed_memory_leaves_no_notes`, is a flake that is already on main. I ran `cargo test -p leonida-gpu --lib` 8 times on each arm: - main failed it once (`watch.rs:5163`, its first assertion, before any free); - the PR passed 8 of 8 (587 each time). - The 52 ignored tests in `leonida-gpu` and 2 in `leonida-hle` are the same on every arm. **In game.** I built a diag `leonida.exe` of main and of main + PR with `build-nvidia.ps1` (`diagnostics,dlss,mimalloc`). - **Start command:** `play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log`, with `LEONIDA_WINDOWS_BAR_MB=0` and `LEONIDA_TEXTURE_BUDGET_MB=1024`. - **Data:** a fresh copy of our gate data folder (prologue cell, standing still), shared by all runs. - **Switches:** - A is main with `LEONIDA_WC_NO_BACK=1`. That is the value `play-nvidia.ps1` sets for every NVIDIA player. - B is main + PR with the same switch plus `LEONIDA_WC_SUBRANGE_NO_BACK=1`. - B0 is main + PR with neither switch named: the player's default, with `WC_NO_BACK` on from `play-nvidia.ps1`. - **Order:** one warm-up each, then A B B A, then B0. - **Window:** fps and copy-back figures are medians of the per-second lines from +30 s to +330 s after the first frame with 500+ draws. | run | into the world | frames in the world | fps median / p5 | draws/frame | "copying back" ms / MB a frame | relay landing ms | landed pieces | compare passes | WC left on the card, MB a frame | GPU-RO left out, MB | device lost / panic | alive at end | |---|---|---|---|---|---|---|---|---|---|---|---|---| | A warm-up (cold, 925 pipelines being made) | 104 s | 289 s | 6.6 / 0.1 | 4428 | 14.1 / 1.1 | 15.3 | 487 | 394 | 114,199 | 782 | 0 / 0 | yes | | B warm-up (cold, 937 being made) | 101 s | 287 s | 0.5 / 0.1 | 4610 | 13.9 / 0.8 | 14.1 | 474 | 421 | 122,527 | 845 | 0 / 0 | yes | | A1 | 49 s | 403 s | 20.6 / 12.3 | 4190 | 10.6 / 1.0 | 11.2 | 503 | 379 | 73,656 | 651 | 0 / 0 | yes | | B1 | 62 s | 386 s | 24.6 / 1.6 | 2394 | 8.6 / 1.2 | 10.2 | 420 | 454 | 28,714 | 592 | 0 / 0 | yes | | B2 | 68 s | 382 s | 28.1 / 16.5 | 2196 | 7.8 / 1.3 | 9.6 | 405 | 450 | 27,476 | 592 | 0 / 0 | yes | | A2 | 58 s | 395 s | 17.7 / 12.3 | 3734 | 14.0 / 1.8 | 22.5 | 488 | 418 | 28,872 | 620 | 0 / 0 | yes | | B0 (PR, default switches) | 58 s | 393 s | 22.7 / 18.1 | 3393 | 11.3 / 1.3 | 13.8 | 467 | 421 | 28,861 | 596 | 0 / 0 | yes | - "Into the world" is counted from the start of the runtime's log. The precompile before it took about 9 minutes on each warm-up, the first start of each new exe. - No run had a device loss, a panic or a fault. All 7 were alive when the script closed them. - The longest frame gaps were 6.5 to 10.2 s, in every arm. B1 had the 10.2 s gap and the low p5: its pipelines were still being made (472 at most), after a warm-up that did not finish making them. **What the copy-back numbers say** - **Registration works on this PC.** All 5 parts of the 185 MiB heap arrive through `MEM_REPLACE_PLACEHOLDER` in every run: 10 MiB `0x1004`, 1 MiB `0x1404`, 27 MiB `0x8404`, 47 MiB `0x2404` and 100 MiB `0x2004`. These are the sizes your description gives. - **The default path did not change anything I could see here.** No run logged a "write-combined title memory ... not copied back" line for a copy inside that heap. There were 63-66 such lines per run, the same on A and B0. So on this scene, the new registration did not make any copy wholly write-combined. B0's copy-back figures are within A's range: WC left 28,861 vs 28,872 MB, landing 13.8 vs 11.2-22.5 ms. - **The sub-range path cannot be isolated from the log.** It adds to the same `WC_LEFT` counter as whole write-combined copies, and that counter changes with the scene far more than the gain you measured (+1,648 MB a frame): A1 73,656 vs A2 28,872 MB a frame, in the same arm. The B runs went the way you describe: - landed pieces 420 / 405 vs A 503 / 488 (-17 %); - "copying back" 8.6 / 7.8 ms vs 10.6 / 14.0; - relay landing 10.2 / 9.6 ms vs 11.2 / 22.5. - **But B and A did not render the same scene.** B drew 2,196-2,394 draws a frame and A drew 3,734-4,190, from the same save, standing still. So the fps (B 24.6 / 28.1 vs A 20.6 / 17.7) and the copy-back drop cannot be credited to the PR from these runs. I count the gain as **not confirmed here** (n=2, scene not matched). It is not contradicted either. An in-process `LEONIDA_AB=...,LEONIDA_WC_SUBRANGE_NO_BACK` run, as in your description, would remove the scene difference. A counter of its own for the sub-range bytes would help too. **Safe to merge into main? Yes, with one note on point 3.** 1. **Clean merge:** yes. `git merge-tree --write-tree` gives no conflict on `b1f91c2f9` or on the newer `398c085c4`. #2703 and #2569 are not merged yet. Whichever of the three merges second needs the small `watch.rs` rebase the description announces. 2. **CI:** yes. All 5 jobs pass on `f85d1790a`: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests. 3. **Off by default:** the sub-range exclusion is off by default. Two parts run without the switch: - **Registration:** the write-combined parts of the split heap are now registered. With the `LEONIDA_WC_NO_BACK=1` that `play-nvidia.ps1` sets, a copy of 1 MiB or more lying wholly inside the 47 MiB `0x2404` part would now be left on the card. In my B0 run no such copy happened (0 lines inside the heap), and the run was stable. - **Release:** `MEM_RELEASE` now clears those regions over the whole allocation. - This is a small change in default behaviour. It is not a risk seen in game. 4. **Repository checks:** yes. - `check_no_game_data.py` on the 4 changed files: clean. - `cargo test -p leonida-gpu`: 587/587. The only failure seen is the `freed_memory_leaves_no_notes` flake, which main has too. - `cargo test -p leonida-hle`: 222/222. 5. **Scope:** yes. The diff is `shadow.rs`, `watch.rs`, `lib.rs` (2 re-exports) and `xmem.rs`, all on the write-combined / GPU read-only copy-back path, with 7 + 1 unit tests. `d3d12/docs/switches.md` does not list the new switch yet; that is not required by CI. **Verdict:** - CPU red/green and merge safety: **PASS**. - In game: **PASS for stability** (PROVISIONAL: one PC, n=2 measured runs per arm, standing still). No device loss, no panic, alive at the end in all 7 runs, B0 included. The copy-back and fps gain is **not confirmed**, because the A and B scenes differed (draws a frame 3,700-4,200 vs 2,200-2,400). **Not covered:** - Moving or driving runs, and the heavier scenes (8,000+ draws a frame) where your description finds the gain. - An in-process `LEONIDA_AB` A/B on this card. - DLSS, frame generation, Series X, BAR on, and other cards. - `LEONIDA_GPU_READ_ONLY_NO_BACK=0`, where the 27 MiB `0x8404` part is subtracted as write-combined. - A picture check: screenshots were taken but not compared side by side. AI-assisted (Claude Code, oreofr-agent).
enlight3d commented 2026-12-01 00:52:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-01T00:52:57Z.


IN-GAME RUN (gate, independent): #2795 head f85d1790a, RTX 3090 24 GB, NVIDIA 621.40, Windows 11.

Setup: leonida.exe built from this head (d3d12/scripts/build-nvidia.ps1, diag profile, no DLSS files), scripts/play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log, the same save restored, standing still once in the world, with LEONIDA_NO_WATCHDOG=1 and a stall-mode timeline. Other jobs (cargo builds) ran on the PC at the same time, so the frame rates are not comparable with other runs.

Gate: PASS. No device loss, no gap over 10 s between frames, ended at the time limit: 421 s, world reached at 72 s, so 349 s in the world.

One setting differs from the defaults, and why: LEONIDA_REAPER=0. On this card, main's release thread falls behind in most long runs and its queue piles up memory, unrelated to this PR (a fix is in progress under claim D3D12-REAPER-BOUNDED-QUEUE). A first gate attempt on this head with default settings had no device loss but was cut by my own memory safety stop at 329 s (82 GB private, only 256 s in the world). LEONIDA_REAPER=0 removes that pile-up, so this run tests the PR alone: private memory stayed under 29.6 GB, VRAM under 12.9 GB, mapped scratch under 0.62 GB.

Median 8.5 fps (p5 5.7), not comparable (see above). Unit tests for this PR were done independently by another verifier on Windows; this comment covers only the in-game gate. Not checked: Series X, walking, picture.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7296847307 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7296847307). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-01T00:52:57Z. --- IN-GAME RUN (gate, independent): #2795 head f85d1790a, RTX 3090 24 GB, NVIDIA 621.40, Windows 11. Setup: leonida.exe built from this head (`d3d12/scripts/build-nvidia.ps1`, diag profile, no DLSS files), `scripts/play-d3d12.ps1 -SeriesS -NoDlss -NoFrameGen -Log`, the same save restored, standing still once in the world, with `LEONIDA_NO_WATCHDOG=1` and a stall-mode timeline. Other jobs (cargo builds) ran on the PC at the same time, so the frame rates are not comparable with other runs. **Gate: PASS. No device loss, no gap over 10 s between frames, ended at the time limit**: 421 s, world reached at 72 s, so 349 s in the world. One setting differs from the defaults, and why: `LEONIDA_REAPER=0`. On this card, main's release thread falls behind in most long runs and its queue piles up memory, unrelated to this PR (a fix is in progress under claim D3D12-REAPER-BOUNDED-QUEUE). A first gate attempt on this head with default settings had no device loss but was cut by my own memory safety stop at 329 s (82 GB private, only 256 s in the world). `LEONIDA_REAPER=0` removes that pile-up, so this run tests the PR alone: private memory stayed under 29.6 GB, VRAM under 12.9 GB, mapped scratch under 0.62 GB. Median 8.5 fps (p5 5.7), not comparable (see above). Unit tests for this PR were done independently by another verifier on Windows; this comment covers only the in-game gate. Not checked: Series X, walking, picture.
OreoFR commented 2026-12-01 01:28:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T01:28:00Z.


Re-verification on current main (asked by OreoFR, maintainer: a verdict on an older main does not count). AI-assisted (Claude Code agent oreofr-agent). RTX 4070 Laptop 8 GB, NVIDIA 621.40, Core Ultra 7 155H, Windows 11.

Head f85d1790a (unchanged since my first verdict), merged into current main d920d850d with git merge --no-ff in a scratch worktree (clean; shadow.rs and watch.rs, which main also changed since the PR's base 0b6e0e3bc, auto-merged).

Tests (cargo test --locked, from d3d12/):

main d920d850d main + PR
-p leonida-gpu 582 passed, 1 failed 587 passed, 1 failed (same)
-p leonida-hle 241 passed, 0 failed 242 passed, 0 failed

No new failure. The one failure is already on main and not from this PR: host::refresh_tests::only_what_differs_goes_up (host.rs:14735), 3/3 deterministic on plain main, passes with LEONIDA_TAKE_BLOCKS=0, so it comes from d920d850d turning that switch on by default (likely a stale test, see the analysis relayed on the agents' bridge). GitHub CI does not run the d3d12/ Rust tests, so main shows green. OreoFR decided in writing to ignore that one test until its author updates it; nothing else is covered by that.

In-game run on the merged build (diagnostics,mimalloc, no DLSS), fresh copy of our standing gate data, -SeriesS -NoDlss -NoFrameGen, BAR 0, texture budget 1024, standing:

  • First start of a new build: ~17 min of shader compiles before the world.
  • 330 s in the world, then a clean close (window close; pipeline library saved).
  • 0 device loss, 0 ERROR lines, no crash. Median 22.5 fps in the run's last 66 fps lines; private memory 23.6 GB at the end (7.3 GB of RAM free).

Verdict: no new failure and no device loss on current main + this PR. The remaining blocker is a rule one, not this PR: main is red on the test above until it is fixed or waived; the waiver is written.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7297532069 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7297532069). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T01:28:00Z. --- **Re-verification on current `main`** (asked by OreoFR, maintainer: a verdict on an older main does not count). AI-assisted (Claude Code agent `oreofr-agent`). RTX 4070 Laptop 8 GB, NVIDIA 621.40, Core Ultra 7 155H, Windows 11. Head `f85d1790a` (unchanged since my first verdict), merged into **current main `d920d850d`** with `git merge --no-ff` in a scratch worktree (clean; `shadow.rs` and `watch.rs`, which main also changed since the PR's base `0b6e0e3bc`, auto-merged). **Tests** (`cargo test --locked`, from `d3d12/`): | | main `d920d850d` | main + PR | | --- | --- | --- | | `-p leonida-gpu` | 582 passed, **1 failed** | 587 passed, **1 failed (same)** | | `-p leonida-hle` | 241 passed, 0 failed | 242 passed, 0 failed | No new failure. The one failure is **already on main** and not from this PR: `host::refresh_tests::only_what_differs_goes_up` (`host.rs:14735`), 3/3 deterministic on plain main, passes with `LEONIDA_TAKE_BLOCKS=0`, so it comes from `d920d850d` turning that switch on by default (likely a stale test, see the analysis relayed on the agents' bridge). GitHub CI does not run the `d3d12/` Rust tests, so main shows green. OreoFR decided in writing to ignore that one test until its author updates it; nothing else is covered by that. **In-game run** on the merged build (`diagnostics,mimalloc`, no DLSS), fresh copy of our standing gate data, `-SeriesS -NoDlss -NoFrameGen`, BAR 0, texture budget 1024, standing: - First start of a new build: ~17 min of shader compiles before the world. - **330 s in the world**, then a clean close (window close; pipeline library saved). - **0 device loss, 0 ERROR lines, no crash.** Median 22.5 fps in the run's last 66 fps lines; private memory 23.6 GB at the end (7.3 GB of RAM free). Verdict: **no new failure and no device loss on current main + this PR.** The remaining blocker is a rule one, not this PR: main is red on the test above until it is fixed or waived; the waiver is written.
OreoFR commented 2026-12-01 01:32:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T01:32:57Z.


Question before merging, from OreoFR (maintainer). AI-assisted (Claude Code agent oreofr-agent).

The description says Depends on: #2703, #2569, but also that this PR does not build on either of them: they only touch the same function (title_memory_freed in d3d12/crates/leonida-gpu/src/watch.rs). Our checks agree: this head merged into current main d920d850d without #2703 or #2569 builds, passes the crate tests and ran 330 s in the game with no device loss (see the comment above).

Could you confirm it is not a real dependency, and if so change that line to something like Overlaps with: #2703, #2569 (same function in watch.rs; whichever merges later needs a small rebase)? Our merge checklist reads Depends on: as "must be merged first".

About the rebase: #2703 (Kal0s-design) and #2569 (adrianmjim) are by other authors, so each of them would rebase their own pull request onto whatever lands first; nothing to do on your side.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7297629826 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7297629826). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T01:32:57Z. --- Question before merging, from OreoFR (maintainer). AI-assisted (Claude Code agent `oreofr-agent`). The description says `Depends on: #2703, #2569`, but also that this PR does not build on either of them: they only touch the same function (`title_memory_freed` in `d3d12/crates/leonida-gpu/src/watch.rs`). Our checks agree: this head merged into current main `d920d850d` **without** #2703 or #2569 builds, passes the crate tests and ran 330 s in the game with no device loss (see the comment above). Could you confirm it is not a real dependency, and if so change that line to something like `Overlaps with: #2703, #2569 (same function in watch.rs; whichever merges later needs a small rebase)`? Our merge checklist reads `Depends on:` as "must be merged first". About the rebase: #2703 (Kal0s-design) and #2569 (adrianmjim) are by other authors, so each of them would rebase their own pull request onto whatever lands first; nothing to do on your side.
hardly-relevant commented 2026-12-01 01:42:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by hardly-relevant on 2026-12-01T01:42:08Z.


Confirmed — neither #2703 nor #2569 is a dependency of this PR:

  • #2569 is unrelated memory-leak work that only touches the same function (watch::title_memory_freed) without changing write_combined_freed.
  • #2703 fixes the same MEM_RELEASE (len == 0) span resolution in watch::title_memory_freed that this PR already includes (reusing the cached allocation_end for forget_views and gating on has_memory_classes()), alongside this PR's xmem.rs placeholder registration and shadow.rs sub-range subtraction.

Updated the description line from Depends on: to Overlaps with:. Ready to merge on its own whenever you're ready!

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7297796242 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7297796242). Originally posted by [hardly-relevant](https://github.com/hardly-relevant) on 2026-12-01T01:42:08Z. --- Confirmed — neither #2703 nor #2569 is a dependency of this PR: - `#2569` is unrelated memory-leak work that only touches the same function (`watch::title_memory_freed`) without changing `write_combined_freed`. - `#2703` fixes the same `MEM_RELEASE` (`len == 0`) span resolution in `watch::title_memory_freed` that this PR already includes (reusing the cached `allocation_end` for `forget_views` and gating on `has_memory_classes()`), alongside this PR's `xmem.rs` placeholder registration and `shadow.rs` sub-range subtraction. Updated the description line from `Depends on:` to `Overlaps with:`. Ready to merge on its own whenever you're ready!
OreoFR commented 2026-12-01 02:19:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T02:19:03Z.


Merging. Head f85d1790a merges cleanly with main bf19719ab (merge commit d921489d1).
Claim: D3D12-WC-SUBRANGE-NO-BACK, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263187405 (author hardly-relevant). The Depends on: line was clarified by the author to Overlaps with: #2703, #2569 (not dependencies; whichever merges later rebases).
Red/green: by oreofr-agent (not the author), RTX 4070 Laptop, Windows 11 (red/green on the first verdict above). I ran on this head merged into the current main bf19719ab: cargo test --locked -p leonida-gpu 588 passed, 0 failed; -p leonida-hle 242 passed, 0 failed.
In-game run: RTX 4070 Laptop 8 GB, NVIDIA 621.40, 330 s in the world on this head merged into d920d850d, 0 device loss (comment above); bf19719ab only adds a test arm on top, nothing that runs. Independent run by enlighted on an RTX 3090 (421 s, PASS).
CI: green on the head (all 5 checks) and on main (CI, No Game Data; Runtime last green on cd9fe51a9, not triggered since).
AI-assisted: yes, Claude Code agent oreofr-agent, merged on OreoFR's (maintainer) written instruction.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7298477190 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2795#issuecomment-7298477190). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T02:19:03Z. --- Merging. Head `f85d1790a` merges cleanly with main `bf19719ab` (merge commit `d921489d1`). Claim: D3D12-WC-SUBRANGE-NO-BACK, https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7263187405 (author hardly-relevant). The `Depends on:` line was clarified by the author to `Overlaps with: #2703, #2569` (not dependencies; whichever merges later rebases). Red/green: by oreofr-agent (not the author), RTX 4070 Laptop, Windows 11 (red/green on the first verdict above). I ran on this head merged into the current main `bf19719ab`: `cargo test --locked -p leonida-gpu` 588 passed, 0 failed; `-p leonida-hle` 242 passed, 0 failed. In-game run: RTX 4070 Laptop 8 GB, NVIDIA 621.40, 330 s in the world on this head merged into `d920d850d`, 0 device loss (comment above); `bf19719ab` only adds a test arm on top, nothing that runs. Independent run by enlighted on an RTX 3090 (421 s, PASS). CI: green on the head (all 5 checks) and on main (CI, No Game Data; Runtime last green on `cd9fe51a9`, not triggered since). AI-assisted: yes, Claude Code agent `oreofr-agent`, merged on OreoFR's (maintainer) written instruction.
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!2795
No description provided.