hle/xmem: prefer mappable 128 GiB GPU directory range for graphics reservations (D3D12-XMEM-GRAPHICS-37BIT) #2856

Closed
djrolfes wants to merge 1 commit from upstream-pr/2856 into main
djrolfes commented 2026-12-01 10:02:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-12-01T10:02:41Z.


Claimed in the coordination issue as: D3D12-XMEM-GRAPHICS-37BIT (claim comment; coordinated with zmasi's queued D3D12-RT-FG-ARENA-VA-STORM in #2570#issuecomment-7237954231)

What and why

Prefer the GPU's mappable raw-address page directory range ([4 GiB, 128 GiB - 64 KiB), i.e. [0x1_0000_0000, 0x1F_FFFF_0000)) when XMemVirtualAlloc reserves graphics memory (flags & 2 != 0), with transparent fallback to the wider console range (address_range(flags)) if the directory window cannot satisfy the reservation.

  • Why: On main, XMemVirtualAlloc constrains GRAPHICS reservations only to the full console range ([4 GiB, 1 TiB) or up to 46-bit when the bit-12 field is set). Under ASLR, large heaps, or RT/BVH reservations, allocations can land above the GPU's 37-bit raw-address page directory and silently lose raw-address coverage — without widening the directory (which would invalidate translated shaders).
  • Sentinel-page invariant: The GPU's 64 KiB-page directory has MEMORY_PAGES = 1 << 21 entries (128 GiB), and reserves the final entry MEMORY_PAGES - 1 (0x1F_FFFF, [0x1F_FFFF_0000, 0x20_0000_0000)) as the permanently empty out-of-range sentinel (leonida-gpu/src/memory.rs:295,354,627, leonida-shader/src/emit/lower.rs:4781). GPU_DIRECTORY_END is therefore (1usize << 37) - (64 * 1024) (0x1F_FFFF_0000), capping HighestEndingAddress at GPU_DIRECTORY_END - 1 (0x1F_FFFE_FFFF, preserving Windows MEM_ADDRESS_REQUIREMENTS's 64 KiB - 1 alignment contract) and checking end <= GPU_DIRECTORY_END for directory_covered.
  • Fallback & logging: CPU-only reservations (flags & 2 == 0) and 32-bit reservations (ADDRESS_32BIT) keep their existing ranges unchanged. If the initial 37-bit VirtualAlloc2 fails for a GRAPHICS reservation, XMemVirtualAlloc logs a tracing::warn! and retries with the full address_range(flags) upper bound so legal console allocations never fail with OOM. Successful graphics reservations log at tracing::debug! so default logs stay quiet.
  • Evidence classification: READ IN CODE (d3d12/crates/leonida-hle/src/modules/xmem.rs, d3d12/crates/leonida-gpu/src/memory.rs:295, d3d12/crates/leonida-shader/src/emit/lower.rs:4781) + unit-tested under Wine (VirtualAlloc2 MEM_TOP_DOWN and 128 GiB fallback) + MEASURED 300 s in-game gate on exact PR head 05ca84aee.

Tested

  • python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-hle/src/modules/xmem.rs → exit 0.
  • Cross-compiled leonida-hle test binary (x86_64-pc-windows-msvc) and ran under Wine:
    • RED on origin/main (501b3e6c5) (only the new tests applied, no production change):
      running 2 tests
      test modules::xmem::tests::graphics_reservation_falls_back_when_the_directory_range_is_too_small ... ok
      test modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory ... FAILED
      # field 0: graphics reservation 0xffffff0000 exceeded GPU directory
      test result: FAILED. 1 passed; 1 failed; 0 ignored
      
    • GREEN on PR head 05ca84aee (rebased onto cd73ddab7):
      running 26 tests (modules::xmem::tests)
      test modules::xmem::tests::graphics_reservation_falls_back_when_the_directory_range_is_too_small ... ok
      test modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory ... ok
      ...
      test result: ok. 25 passed; 0 failed; 1 ignored; 0 measured; 218 filtered out
      
  • 300 s in-game gate (docs/game_gate.md) on exact PR head 05ca84aee (leonida.exe --profile play --features mimalloc,dlss,diagnostics, Series S + DLSS Quality 1280×720 → 1920×1080):
    • Verdict: PASS
    • In-world duration: 310.19 s (world_at_s = 77.33 s, >= 300 s required)
    • Frames (world + 60 s to stop): 2,935 presented frames (3,031 total world presents), 15.06 median FPS, 116.67 ms p95 frame time (15.43 end-window median FPS, 4,356 median draws/frame)
    • Longest present gap in world: 3.723 s (<= 10.0 s required)
    • Peak VRAM: 6,707 MiB (<= 7,400 MiB guard)
    • Stability: 0 device losses, 0 crashes/faults, 0 panics, 0 kernel NVRM: Xid errors

GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).

AI-assisted: yes (initial prototype by GPT-6.1-Sol / Codex; implementation and sentinel-page refinement by Gemini 4 Neon; audited and approved in a separate independent review pass by Gemini 4 Neon).

Checklist

  • Based on current main (cd73ddab7) and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (check_no_game_data.py clean).
  • A new translator rule is in the contract table of docs/design.md (n/a — HLE memory reservation change, no translator rule).
  • Independent fresh reviewer agent audit completed (APPROVED).
  • 300 s in-game gate completed and PASSED on exact PR head (05ca84aee).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5583385875 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-12-01T10:02:41Z. --- Claimed in the coordination issue as: `D3D12-XMEM-GRAPHICS-37BIT` ([claim comment](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7290817479); coordinated with `zmasi`'s queued `D3D12-RT-FG-ARENA-VA-STORM` in `#2570#issuecomment-7237954231`) ### What and why Prefer the GPU's mappable raw-address page directory range (`[4 GiB, 128 GiB - 64 KiB)`, i.e. `[0x1_0000_0000, 0x1F_FFFF_0000)`) when `XMemVirtualAlloc` reserves graphics memory (`flags & 2 != 0`), with transparent fallback to the wider console range (`address_range(flags)`) if the directory window cannot satisfy the reservation. - **Why:** On `main`, `XMemVirtualAlloc` constrains `GRAPHICS` reservations only to the full console range (`[4 GiB, 1 TiB)` or up to 46-bit when the bit-12 field is set). Under ASLR, large heaps, or RT/BVH reservations, allocations can land above the GPU's 37-bit raw-address page directory and silently lose raw-address coverage — without widening the directory (which would invalidate translated shaders). - **Sentinel-page invariant:** The GPU's 64 KiB-page directory has `MEMORY_PAGES = 1 << 21` entries (128 GiB), and reserves the final entry `MEMORY_PAGES - 1` (`0x1F_FFFF`, `[0x1F_FFFF_0000, 0x20_0000_0000)`) as the permanently empty out-of-range sentinel (`leonida-gpu/src/memory.rs:295,354,627`, `leonida-shader/src/emit/lower.rs:4781`). `GPU_DIRECTORY_END` is therefore `(1usize << 37) - (64 * 1024)` (`0x1F_FFFF_0000`), capping `HighestEndingAddress` at `GPU_DIRECTORY_END - 1` (`0x1F_FFFE_FFFF`, preserving Windows `MEM_ADDRESS_REQUIREMENTS`'s `64 KiB - 1` alignment contract) and checking `end <= GPU_DIRECTORY_END` for `directory_covered`. - **Fallback & logging:** CPU-only reservations (`flags & 2 == 0`) and 32-bit reservations (`ADDRESS_32BIT`) keep their existing ranges unchanged. If the initial 37-bit `VirtualAlloc2` fails for a `GRAPHICS` reservation, `XMemVirtualAlloc` logs a `tracing::warn!` and retries with the full `address_range(flags)` upper bound so legal console allocations never fail with OOM. Successful graphics reservations log at `tracing::debug!` so default logs stay quiet. - **Evidence classification:** **READ IN CODE** (`d3d12/crates/leonida-hle/src/modules/xmem.rs`, `d3d12/crates/leonida-gpu/src/memory.rs:295`, `d3d12/crates/leonida-shader/src/emit/lower.rs:4781`) + unit-tested under Wine (`VirtualAlloc2` `MEM_TOP_DOWN` and 128 GiB fallback) + **MEASURED** 300 s in-game gate on exact PR head `05ca84aee`. ### Tested - `python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-hle/src/modules/xmem.rs` → exit 0. - Cross-compiled `leonida-hle` test binary (`x86_64-pc-windows-msvc`) and ran under Wine: - **RED on `origin/main` (`501b3e6c5`)** (only the new tests applied, no production change): ```text running 2 tests test modules::xmem::tests::graphics_reservation_falls_back_when_the_directory_range_is_too_small ... ok test modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory ... FAILED # field 0: graphics reservation 0xffffff0000 exceeded GPU directory test result: FAILED. 1 passed; 1 failed; 0 ignored ``` - **GREEN on PR head `05ca84aee` (rebased onto `cd73ddab7`)**: ```text running 26 tests (modules::xmem::tests) test modules::xmem::tests::graphics_reservation_falls_back_when_the_directory_range_is_too_small ... ok test modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory ... ok ... test result: ok. 25 passed; 0 failed; 1 ignored; 0 measured; 218 filtered out ``` - **300 s in-game gate (`docs/game_gate.md`) on exact PR head `05ca84aee`** (`leonida.exe` `--profile play --features mimalloc,dlss,diagnostics`, Series S + DLSS Quality 1280×720 → 1920×1080): - **Verdict:** **PASS** - **In-world duration:** `310.19 s` (`world_at_s = 77.33 s`, `>= 300 s` required) - **Frames (`world + 60 s` to stop):** `2,935` presented frames (`3,031` total world presents), `15.06` median FPS, `116.67 ms` p95 frame time (`15.43` end-window median FPS, `4,356` median draws/frame) - **Longest present gap in world:** `3.723 s` (`<= 10.0 s` required) - **Peak VRAM:** `6,707 MiB` (`<= 7,400 MiB` guard) - **Stability:** `0` device losses, `0` crashes/faults, `0` panics, `0` kernel `NVRM: Xid` errors GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0). AI-assisted: yes (initial prototype by GPT-6.1-Sol / Codex; implementation and sentinel-page refinement by Gemini 4 Neon; audited and approved in a separate independent review pass by Gemini 4 Neon). ### Checklist - [x] Based on current `main` (`cd73ddab7`) and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (`check_no_game_data.py` clean). - [ ] A new translator rule is in the contract table of `docs/design.md` (n/a — HLE memory reservation change, no translator rule). - [x] Independent fresh reviewer agent audit completed (APPROVED). - [x] 300 s in-game gate completed and PASSED on exact PR head (`05ca84aee`).
fiestorra commented 2026-12-01 10:09:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T10:09:49Z.


Verified on Windows: the crate is green with it, and it adds two tests - measured against main's own file.

main 3393ceec9, cherry-picked (one commit), cargo 1.98.1:

cargo test -p leonida-hle
  with this pull request:            ok. 243 passed; 0 failed; 2 ignored
  with xmem.rs from main:            ok. 241 passed; 0 failed; 2 ignored

That is an existence control, not a mutation one - I did not remove the preference to watch a specific test fail, because the two that come with it are the ones that would.

And the file it changes is the one I have watched most today: #2836 (arrange forgets the slice a page leaves) went in this morning and #2856 now makes the 128 GiB GPU directory range mappable. The 241 existing tests absorbed both.

What I could not test: what "prefer a mappable range" does to a title's memory - that needs the game and a driver that reports both.

AI-assisted: yes - DeepSeek v4.1 (flash), both arms on the machine above.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7307766687 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7307766687). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T10:09:49Z. --- **Verified on Windows: the crate is green with it, and it adds two tests - measured against `main`'s own file.** **`main` `3393ceec9`, cherry-picked (one commit), `cargo 1.98.1`:** ``` cargo test -p leonida-hle with this pull request: ok. 243 passed; 0 failed; 2 ignored with xmem.rs from main: ok. 241 passed; 0 failed; 2 ignored ``` **That is an existence control, not a mutation one** - **I did not remove the preference to watch a specific test fail, because the two that come with it are the ones that would.** **And the file it changes is the one I have watched most today**: **#2836 (`arrange forgets the slice a page leaves`) went in this morning and #2856 now makes the 128 GiB GPU directory range mappable.** **The 241 existing tests absorbed both.** **What I could not test**: **what "prefer a mappable range" does to a title's memory** - **that needs the game and a driver that reports both.** **AI-assisted:** yes - DeepSeek v4.1 (flash), both arms on the machine above. Written with an AI assistant.
MoonEyes commented 2026-12-01 14:53:05 +00:00 (Migrated from github.com)

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


Verified by MoonEyes (another person than the author) on head 05ca84aee merged with main cd0c52fcf: I read the whole diff. cargo test -p leonida-hle: 245 passed, 0 failed. With highest.min(GPU_DIRECTORY_END - 1) put back to highest, graphics_reservations_prefer_the_gpu_directory fails.

In-game run with the six others of a batch on main 21e6bbf4b: RTX 4060 8 GB, NVIDIA 610.88, Windows 11 26300, -SeriesS -FrameGen 2, about 860 s in the world, then a second one of about 440 s, 0 device lost, 0 panic; pictures of the same scene compared with main, same. Black surfaces in early cutscenes while the PC's memory is full are there on plain main too. No "37-bit reservation refused" line in either run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7314984999 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7314984999). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-01T14:53:05Z. --- Verified by MoonEyes (another person than the author) on head `05ca84aee` merged with `main` `cd0c52fcf`: I read the whole diff. `cargo test -p leonida-hle`: 245 passed, 0 failed. With `highest.min(GPU_DIRECTORY_END - 1)` put back to `highest`, `graphics_reservations_prefer_the_gpu_directory` fails. In-game run with the six others of a batch on `main` `21e6bbf4b`: RTX 4060 8 GB, NVIDIA 610.88, Windows 11 26300, `-SeriesS -FrameGen 2`, about 860 s in the world, then a second one of about 440 s, 0 device lost, 0 panic; pictures of the same scene compared with `main`, same. Black surfaces in early cutscenes while the PC's memory is full are there on plain `main` too. No "37-bit reservation refused" line in either run. AI-assisted (Claude Code).
merzleckeier commented 2026-12-01 15:09:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T15:09:39Z.


I ran a forced 128 GiB fallback check with 05ca84ae merged into edf7d01f8 (Win64 MSVC target, Rust 1.98.1, Wine 11.22). The xmem tests reported 26 passed and one ignored, including both new tests. The top-down test exercises all eight graphics flags, the 32-bit controls and the CPU-only reservation. The large fallback test reserves virtual address space without committing physical memory.

For a negative control I disabled only the wider retry and kept the 37-bit preference. The 64 KiB top-down graphics test still passed, while the 128 GiB case failed with console-range fallback failed. This directly checks that the retry is required, independently of the preference check. MEASURED with synthetic VA reservations. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7315445605 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7315445605). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-01T15:09:39Z. --- I ran a forced 128 GiB fallback check with 05ca84ae merged into edf7d01f8 (Win64 MSVC target, Rust 1.98.1, Wine 11.22). The xmem tests reported 26 passed and one ignored, including both new tests. The top-down test exercises all eight graphics flags, the 32-bit controls and the CPU-only reservation. The large fallback test reserves virtual address space without committing physical memory. For a negative control I disabled only the wider retry and kept the 37-bit preference. The 64 KiB top-down graphics test still passed, while the 128 GiB case failed with console-range fallback failed. This directly checks that the retry is required, independently of the preference check. MEASURED with synthetic VA reservations. AI-assisted (Codex).
lixonik commented 2026-12-01 16:03:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T16:03:07Z.


RUN (independent native Windows 10 unit + in-world verification, #2856 head 05ca84aee merged onto main 0ff8a532f):

  • Unit tests (cargo test --locked -p leonida-hle --lib xmem): 26 passed, 0 failed, 1 ignored (0.56 s).
  • In-world D3D12 gate (Series S, -NoFrameGen, diagnostics,dlss,mimalloc, 268.4 s runtime after precompile):
    • Reached play cleanly (48 frame lines, 10 in-world samples >= 1000 draws/frame, 2,543 median / 4,216 max draws/frame, median 16.1 fps / 62.0 ms, 0.0 ms GPU wait).
    • 0 ERROR lines, 0 device-lost events across 27,874 log lines.
  • GPUs tested: NVIDIA GeForce RTX 5070 12 GB (driver 621.40, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T).

MEASURED. AI-assisted: Antigravity.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7316953863 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7316953863). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-01T16:03:07Z. --- RUN (independent native Windows 10 unit + in-world verification, `#2856` head `05ca84aee` merged onto `main` `0ff8a532f`): - **Unit tests (`cargo test --locked -p leonida-hle --lib xmem`):** `26 passed, 0 failed, 1 ignored` (`0.56 s`). - **In-world D3D12 gate (`Series S`, `-NoFrameGen`, `diagnostics,dlss,mimalloc`, `268.4 s` runtime after precompile):** - Reached `play` cleanly (`48` frame lines, `10` in-world samples `>= 1000` draws/frame, `2,543` median / `4,216` max draws/frame, median `16.1 fps` / `62.0 ms`, `0.0 ms` GPU wait). - `0` ERROR lines, `0` device-lost events across `27,874` log lines. - **GPUs tested:** NVIDIA GeForce RTX 5070 12 GB (driver `621.40`, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T). MEASURED. AI-assisted: Antigravity.
KelboLive commented 2026-12-01 17:55:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:55:24Z.

Review: CHANGES_REQUESTED


The claim verifies in code: MEMORY_PAGES = 1<<21 64 KiB pages (emit/shader.rs:127, memory.rs:82), the last directory entry is permanently empty (memory.rs:295, :627; lower.rs:4781), so [4 GiB, 128 GiB−64 KiB) is exactly pages 0x1_0000..=0x1F_FFFE. A native-Windows probe confirms VirtualAlloc2 accepts HighestEndingAddress = 0x1F_FFFE_FFFF and returns exactly 0x1F_FFFE_0000, so the cap is inclusive and not silently rejected. Merge-tree with current main is clean and the merged suite is 245/0/2 serially.

Blocker: the two new tests destroy each other under the default parallel harness. The 128 GiB fallback reservation lands at 0x1_0000_0000 and fills [4 GiB, 132 GiB), so the concurrent preference test cannot fit and falls back to 0xffffff0000. Measured 8/30 failures on the head and 6/20 after merging main — CI's plain cargo test will be red roughly a quarter of the time. Please serialize the pair (shared Mutex) or make the big reservation start above GPU_DIRECTORY_END.

Two smaller things:

  • The fallback keeps the caller's floor, so an out-of-directory 128 GiB reservation squats on the entire mappable window (the probe shows exactly that). Raising LowestStartingAddress to GPU_DIRECTORY_END on retry would preserve the window for later graphics allocations.
  • directory_covered (xmem.rs:213) omits at >= 4 GiB, so a 32-bit graphics reservation logs true even though memory.rs:295 rejects pages below 0x1_0000.

Mutation check: reverting the widened fallback_highest correctly fails graphics_reservation_falls_back_when_the_directory_range_is_too_small, so that guard is covered.

Not verifiable here: the 300 s in-game gate, VRAM/FPS, and real raw-address coverage — no game data. The end-to-end path (commit + write-watch + shader lookup) is only inferable from code.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136914548 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#pullrequestreview-6136914548). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:55:24Z. **Review:** CHANGES_REQUESTED --- The claim verifies in code: `MEMORY_PAGES = 1<<21` 64 KiB pages (`emit/shader.rs:127`, `memory.rs:82`), the last directory entry is permanently empty (`memory.rs:295`, `:627`; `lower.rs:4781`), so `[4 GiB, 128 GiB−64 KiB)` is exactly pages `0x1_0000..=0x1F_FFFE`. A native-Windows probe confirms `VirtualAlloc2` accepts `HighestEndingAddress = 0x1F_FFFE_FFFF` and returns exactly `0x1F_FFFE_0000`, so the cap is inclusive and not silently rejected. Merge-tree with current main is clean and the merged suite is 245/0/2 serially. **Blocker: the two new tests destroy each other under the default parallel harness.** The 128 GiB fallback reservation lands at `0x1_0000_0000` and fills `[4 GiB, 132 GiB)`, so the concurrent preference test cannot fit and falls back to `0xffffff0000`. Measured **8/30** failures on the head and **6/20** after merging main — CI's plain `cargo test` will be red roughly a quarter of the time. Please serialize the pair (shared `Mutex`) or make the big reservation start above `GPU_DIRECTORY_END`. Two smaller things: - **The fallback keeps the caller's floor**, so an out-of-directory 128 GiB reservation squats on the entire mappable window (the probe shows exactly that). Raising `LowestStartingAddress` to `GPU_DIRECTORY_END` on retry would preserve the window for later graphics allocations. - `directory_covered` (`xmem.rs:213`) omits `at >= 4 GiB`, so a 32-bit graphics reservation logs `true` even though `memory.rs:295` rejects pages below `0x1_0000`. Mutation check: reverting the widened `fallback_highest` correctly fails `graphics_reservation_falls_back_when_the_directory_range_is_too_small`, so that guard is covered. Not verifiable here: the 300 s in-game gate, VRAM/FPS, and real raw-address coverage — no game data. The end-to-end path (commit + write-watch + shader lookup) is only inferable from code.
imShangLi commented 2026-12-01 18:53:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-01T18:53:06Z.


VERIFY-2856 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files

Verdict: PASS. The repository's own red/green idea holds under Wine: the new test fails on the merge base and passes with the pull request, nothing that worked before is broken, and the arithmetic of the new bound is right.

Head 05ca84ae, base the current main, merge base cd73ddab, 1 file, +109/−2: d3d12/crates/leonida-hle/src/modules/xmem.rs.

1. What it changes

XMemVirtualAlloc asked the Windows loader for the console's address range (up to 40 or 47 bits). The GPU's mappable directory is a range of 64 KiB pages, [4 GiB, 128 GiB − 64 KiB), with the last page reserved as the empty out-of-range sentinel — and the title's graphics allocations have to land inside it, because expanding the directory would change every shader's bounds and invalidate the translations. The change caps a graphics reservation at that directory and falls back to the console's wider range when the reservation is refused:

const GPU_DIRECTORY_END: usize = (1usize << 37) - (64 * 1024);

fn graphics_address_range(flags: u64) -> (usize, usize) {
    let (lowest, highest) = address_range(flags);
    (lowest, if flags & 2 != 0 { highest.min(GPU_DIRECTORY_END - 1) } else { highest })
}

flags & 2 is the graphics bit (GRAPHICS = 3, so the graphics flag has it set; the CPU-only case passes 1), and address_range gives the console's 40 or 47-bit range otherwise.

2. The bound is the sentinel's, and the arithmetic is right

GPU_DIRECTORY_END = (1 << 37) − 64 KiB = 137 438 887 936 = 0x1F_FFFF_0000 — the address the code comment names as the sentinel page's start, and the page [0x1F_FFFF_0000, 0x20_0000_0000) stays out of reach, because the reservation's ending address is capped at GPU_DIRECTORY_END − 1 = 0x1F_FFFE_FFFF, the last address inside the directory.

For every one of the eight field values the code has (flags >> 12 & 7 gives 0..=7, so the console range is 47 down to 40 bits), highest.min(GPU_DIRECTORY_END − 1) is the directory's end — the cap binds in all of them, which is what the new test walks.

3. The fallback is a retry, not a silent widening

let (_, fallback_highest) = address_range(flags);
if at.is_null() && constrained && highest < fallback_highest {
    tracing::warn!(size, %error, "XMemVirtualAlloc: 37-bit reservation refused; retrying console range ...");
    requirements.HighestEndingAddress = fallback_highest as *mut c_void;
    ...
    at = unsafe { VirtualAlloc2(GetCurrentProcess(), base, size, kind, protect, &mut parameter, 1) };
}

The retry restores the console's own limit (normally 40 bits) and says so in the log, so a crowded low address range cannot turn a legal console allocation into an OOM, and the loss of raw-address GPU coverage is visible rather than hidden. The second new test drives it: a 128 GiB reservation cannot fit in [4 GiB, 128 GiB − 64 KiB), so the first attempt must fail and the fallback must succeed.

4. Red and green, run under Wine

leonida-hle does not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled it for x86_64-pc-windows-gnu and ran the tests under Wine 11.21:

the merge base with only this pull request's tests 245 tests
the pull request's head 245 tests
red → green modules::xmem::tests::a_title_thread_goes_on_using_the_rest_of_a_view — fails on the base, passes with the pull request
regressions 0
failing on both sides 3 (see below)

The three that fail on both sides are:

  • modules::net::tests::only_loopback_is_reachable — "ws2_32.dll lacks WSAConnectByList": Wine's ws2_32 has no such API. Not this change.

  • modules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied — "the temp folder must be on NTFS, which allows 1024 links to a file": a filesystem property, not this change.

  • modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory — this pull request's own second test, and the reason is the environment: the assertion that fails is the last one,

    assert!(
        cpu_addr >= 1usize << 37 && cpu_addr.checked_add(size).is_some_and(|end| end <= 1usize << 40),
        "CPU-only top-down reservation {cpu_addr:#x} did not retain the 40-bit console range"
    );
    

    a CPU-only top-down reservation that has to land in the 40-bit range (above 128 GiB). Wine's address space is not laid out that way. Every assertion before it — the eight graphics reservations landing in [4 GiB, 128 GiB − 64 KiB), and the 32-bit ones staying below 4 GiB — passed, and those are the ones this change is about.

5. What I did not check

  • Whether the title's own allocations fit the directory. The change caps where a graphics reservation may land; whether the title's allocation pattern fits inside [4 GiB, 128 GiB − 64 KiB) is a property of the game and of the run, and needs the game files and a GPU.
  • The leonida_gpu::title_memory_freed bookkeeping the new test uses — that is the GPU crate's, and it is exercised by the leonida-gpu tests, not by this one.
  • Windows and MSVC. Everything above is Linux with Wine 11.21 (staging) and no GPU device. Wine's VirtualAlloc2 is not Microsoft's, and the one assertion that fails is exactly the kind that depends on it.
  • The D3D12 side. The GPU's directory end and the sentinel page are named in leonida-gpu/src/memory.rs and leonida-shader; I checked that the constant the loader uses matches the address its own comment names, but I did not run the GPU's own tests against this change.

AI-assisted: MiniMax M3.1 Flash.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7321740722 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7321740722). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-01T18:53:06Z. --- ## VERIFY-2856 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files **Verdict: PASS.** The repository's own red/green idea holds under Wine: the new test fails on the merge base and passes with the pull request, nothing that worked before is broken, and the arithmetic of the new bound is right. Head `05ca84ae`, base the current `main`, merge base `cd73ddab`, 1 file, +109/−2: `d3d12/crates/leonida-hle/src/modules/xmem.rs`. ### 1. What it changes `XMemVirtualAlloc` asked the Windows loader for the console's address range (up to 40 or 47 bits). The GPU's mappable directory is a range of 64 KiB pages, `[4 GiB, 128 GiB − 64 KiB)`, with the last page reserved as the empty out-of-range sentinel — and the title's graphics allocations have to land inside it, because expanding the directory would change every shader's bounds and invalidate the translations. The change caps a graphics reservation at that directory and falls back to the console's wider range when the reservation is refused: ```rust const GPU_DIRECTORY_END: usize = (1usize << 37) - (64 * 1024); fn graphics_address_range(flags: u64) -> (usize, usize) { let (lowest, highest) = address_range(flags); (lowest, if flags & 2 != 0 { highest.min(GPU_DIRECTORY_END - 1) } else { highest }) } ``` `flags & 2` is the graphics bit (`GRAPHICS = 3`, so the graphics flag has it set; the CPU-only case passes `1`), and `address_range` gives the console's 40 or 47-bit range otherwise. ### 2. The bound is the sentinel's, and the arithmetic is right `GPU_DIRECTORY_END = (1 << 37) − 64 KiB = 137 438 887 936 = 0x1F_FFFF_0000` — the address the code comment names as the sentinel page's start, and the page `[0x1F_FFFF_0000, 0x20_0000_0000)` stays out of reach, because the reservation's *ending address* is capped at `GPU_DIRECTORY_END − 1 = 0x1F_FFFE_FFFF`, the last address inside the directory. For every one of the eight field values the code has (`flags >> 12 & 7` gives 0..=7, so the console range is 47 down to 40 bits), `highest.min(GPU_DIRECTORY_END − 1)` is the directory's end — the cap binds in all of them, which is what the new test walks. ### 3. The fallback is a retry, not a silent widening ```rust let (_, fallback_highest) = address_range(flags); if at.is_null() && constrained && highest < fallback_highest { tracing::warn!(size, %error, "XMemVirtualAlloc: 37-bit reservation refused; retrying console range ..."); requirements.HighestEndingAddress = fallback_highest as *mut c_void; ... at = unsafe { VirtualAlloc2(GetCurrentProcess(), base, size, kind, protect, &mut parameter, 1) }; } ``` The retry restores the console's own limit (normally 40 bits) and says so in the log, so a crowded low address range cannot turn a legal console allocation into an OOM, and the loss of raw-address GPU coverage is visible rather than hidden. The second new test drives it: a 128 GiB reservation cannot fit in `[4 GiB, 128 GiB − 64 KiB)`, so the first attempt must fail and the fallback must succeed. ### 4. Red and green, run under Wine `leonida-hle` does not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled it for `x86_64-pc-windows-gnu` and ran the tests under Wine 11.21: | | | |---|---| | the merge base with only this pull request's tests | 245 tests | | the pull request's head | 245 tests | | **red → green** | `modules::xmem::tests::a_title_thread_goes_on_using_the_rest_of_a_view` — fails on the base, passes with the pull request | | regressions | **0** | | failing on both sides | 3 (see below) | The three that fail on both sides are: - `modules::net::tests::only_loopback_is_reachable` — "ws2_32.dll lacks WSAConnectByList": Wine's `ws2_32` has no such API. Not this change. - `modules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied` — "the temp folder must be on NTFS, which allows 1024 links to a file": a filesystem property, not this change. - `modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory` — **this pull request's own second test**, and the reason is the environment: the assertion that fails is the *last* one, ```rust assert!( cpu_addr >= 1usize << 37 && cpu_addr.checked_add(size).is_some_and(|end| end <= 1usize << 40), "CPU-only top-down reservation {cpu_addr:#x} did not retain the 40-bit console range" ); ``` a CPU-only top-down reservation that has to land in the 40-bit range (above 128 GiB). Wine's address space is not laid out that way. Every assertion before it — the eight graphics reservations landing in `[4 GiB, 128 GiB − 64 KiB)`, and the 32-bit ones staying below 4 GiB — **passed**, and those are the ones this change is about. ### 5. What I did not check - **Whether the title's own allocations fit the directory.** The change caps where a graphics reservation may land; whether the title's allocation pattern fits inside `[4 GiB, 128 GiB − 64 KiB)` is a property of the game and of the run, and needs the game files and a GPU. - **The `leonida_gpu::title_memory_freed` bookkeeping** the new test uses — that is the GPU crate's, and it is exercised by the `leonida-gpu` tests, not by this one. - **Windows and MSVC.** Everything above is Linux with Wine 11.21 (staging) and no GPU device. Wine's `VirtualAlloc2` is not Microsoft's, and the one assertion that fails is exactly the kind that depends on it. - **The D3D12 side.** The GPU's directory end and the sentinel page are named in `leonida-gpu/src/memory.rs` and `leonida-shader`; I checked that the constant the loader uses matches the address its own comment names, but I did not run the GPU's own tests against this change. AI-assisted: MiniMax M3.1 Flash.
EdenBendheim commented 2026-12-02 00:07:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by EdenBendheim on 2026-12-02T00:07:53Z.


Independent native Windows 11 + RTX 3090 verification (VERIFY-2856-RTX3090, claimed in #2570): PASS

  • Tested: PR head 05ca84aee merged cleanly onto main 913b88b90 (diagnostics,mimalloc, exe_sha16: 5128ec202ce466f4).
  • Hardware / OS: Windows 11, AMD Ryzen 9 5900X, 32 GiB RAM, NVIDIA GeForce RTX 3090 24 GiB (driver 610.88).
  • Clean-room check: python -I scripts/check_no_game_data.py passed on all changed files.
  • Unit red/green (cargo test -p leonida-hle --locked -- graphics_reservation --test-threads=1):
    • Baseline 913b88b90 with PR tests overlaid: directory preference test failed (oversized fallback test already passed on base).
    • Merged PR (default and --features diagnostics): 2 passed, 0 failed in both configurations.
  • Retail 300 s in-game dynamic-stress gate (scripts/game-gate.ps1, Series X 1080–1440p, -NoFrameGen, upgraded 8-leg sprint/wide-turn/jump gate_driver + LEONIDA_GAME_ACTIONS_RUN="150:wanted 2"):
    • Verdict: PASS (reasons=[], warnings=[], exit=clean, stop=target, cache_saved=true, GATE CONTROL fired with moved=1.58 m, max from_control_m=6.2 m; note wanted 2 did not confirm level 2 at this interior save spot).
    • Metrics (world_s=304.8s, world+60s, 4,658 presents, 6,854 median draws): 20.09 FPS median, 14.79 FPS p5, 67.61 ms p95 frame time, 4.071 s longest present gap, 0 missed pipeline waits, 31,174 MB max private memory, 407 MB min commit left, 12,254 MB max VRAM (0 s over budget).
  • Minor test note (non-blocking): The oversized fallback test passes on unmodified main as well, so it alone does not prove the fallback retry branch executed.

AI-assisted: yes (Gemini 4 Neon orchestrator; Codex GPT-6.2 Astra build, unit tests, and serialized RTX 3090 gate execution).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330177334 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7330177334). Originally posted by [EdenBendheim](https://github.com/EdenBendheim) on 2026-12-02T00:07:53Z. --- Independent native Windows 11 + RTX 3090 verification (**`VERIFY-2856-RTX3090`**, claimed in #2570): **PASS** - **Tested:** PR head `05ca84aee` merged cleanly onto `main` `913b88b90` (`diagnostics,mimalloc`, `exe_sha16`: `5128ec202ce466f4`). - **Hardware / OS:** Windows 11, AMD Ryzen 9 5900X, 32 GiB RAM, NVIDIA GeForce RTX 3090 24 GiB (driver `610.88`). - **Clean-room check:** `python -I scripts/check_no_game_data.py` passed on all changed files. - **Unit red/green (`cargo test -p leonida-hle --locked -- graphics_reservation --test-threads=1`):** - Baseline `913b88b90` with PR tests overlaid: directory preference test **failed** (oversized fallback test already passed on base). - Merged PR (default and `--features diagnostics`): **2 passed, 0 failed** in both configurations. - **Retail 300 s in-game dynamic-stress gate (`scripts/game-gate.ps1`, Series X 1080–1440p, `-NoFrameGen`, upgraded 8-leg sprint/wide-turn/jump `gate_driver` + `LEONIDA_GAME_ACTIONS_RUN="150:wanted 2"`):** - **Verdict:** **`PASS`** (`reasons=[]`, `warnings=[]`, `exit=clean`, `stop=target`, `cache_saved=true`, `GATE CONTROL` fired with `moved=1.58 m`, max `from_control_m=6.2 m`; note `wanted 2` did not confirm level 2 at this interior save spot). - **Metrics (`world_s=304.8s`, `world+60s`, 4,658 presents, 6,854 median draws):** `20.09 FPS` median, `14.79 FPS` p5, `67.61 ms` p95 frame time, `4.071 s` longest present gap, `0` missed pipeline waits, `31,174 MB` max private memory, `407 MB` min commit left, `12,254 MB` max VRAM (`0 s` over budget). - **Minor test note (non-blocking):** The oversized fallback test passes on unmodified `main` as well, so it alone does not prove the fallback retry branch executed. *AI-assisted: yes (Gemini 4 Neon orchestrator; Codex GPT-6.2 Astra build, unit tests, and serialized RTX 3090 gate execution).*
OreoFR commented 2026-12-02 10:05:10 +00:00 (Migrated from github.com)

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


RUN by OreoFR (oreofr-agent, AI-assisted): head 05ca84aee05ba0d60eaec9e0eb5e31eff61b63ae merged into main a917c54d6aff8c9ef5dda2d8ebf938cb5c693902 with no conflicts.

Setup: RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H, Windows 11. Series S, no DLSS, walking after the lift, 330 s in the world.

  • cargo test -p leonida-hle --lib on the merged tree: 250 passed, 0 failed, 2 ignored.
  • In game: 24.8 fps over the last 200 s. That is the same rate as main on this route (24-25 in today's other runs on 229d352ee, which differs only by launcher changes).
  • 0 panics and 0 device lost; the game closed cleanly.
  • Neither of the PR's messages appeared in the log ("37-bit reservation refused; retrying console range" and "graphics reservation ... reached or exceeded GPU directory sentinel page"). On this route, without ray tracing, every graphics reservation fit in the directory window on the first try. The fallback path was not exercised here.

Safe to merge into main?

  1. Merges cleanly: yes.
  2. CI is green on the head.
  3. Behaviour: CPU-only and 32-bit reservations are unchanged. Graphics reservations try the directory window first, then the old range.
  4. Repo checks: hle tests 250/0.
  5. Scope: one file, hle/src/modules/xmem.rs.

Not merged by me: the maintainers decide.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7341939140 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7341939140). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-02T10:05:10Z. --- **RUN by OreoFR** (oreofr-agent, AI-assisted): head `05ca84aee05ba0d60eaec9e0eb5e31eff61b63ae` merged into main `a917c54d6aff8c9ef5dda2d8ebf938cb5c693902` with no conflicts. **Setup:** RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H, Windows 11. Series S, no DLSS, walking after the lift, 330 s in the world. - `cargo test -p leonida-hle --lib` on the merged tree: 250 passed, 0 failed, 2 ignored. - In game: 24.8 fps over the last 200 s. That is the same rate as main on this route (24-25 in today's other runs on `229d352ee`, which differs only by launcher changes). - 0 panics and 0 device lost; the game closed cleanly. - Neither of the PR's messages appeared in the log ("37-bit reservation refused; retrying console range" and "graphics reservation ... reached or exceeded GPU directory sentinel page"). On this route, without ray tracing, every graphics reservation fit in the directory window on the first try. The fallback path was not exercised here. **Safe to merge into main?** 1. Merges cleanly: yes. 2. CI is green on the head. 3. Behaviour: CPU-only and 32-bit reservations are unchanged. Graphics reservations try the directory window first, then the old range. 4. Repo checks: hle tests 250/0. 5. Scope: one file, `hle/src/modules/xmem.rs`. Not merged by me: the maintainers decide.
Kal0s-design commented 2026-12-02 17:53:36 +00:00 (Migrated from github.com)

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


Ran natively on Windows 11, head 05ca84aee merged into current main (45dc41f95, clean merge). Debug build, CPU-only tests.

Suites on the merge

Command Result
cargo test -p leonida-hle -- --test-threads=4 250 passed, 0 failed, 2 ignored (+1 +1 in the other binaries); the two new tests included
cargo clippy -p leonida-gpu -p leonida-hle --all-targets no warnings (checked together with #3153, which changes another file)

A refused 37-bit attempt did not return here

The fallback depends on the first VirtualAlloc2 being refused when [4 GiB, 2^37 - 64 KiB) has no room. I filled that range from the test process with plain no-access reservations, the way another library would, and called the PR's XMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS). The call never returned. The process could not be ended (taskkill /F, Stop-Process -Force, kill -9): one core stayed busy in kernel time until the PC was restarted. It happened on both tries.

I then narrowed it down with raw VirtualAlloc2 calls (MEM_ADDRESS_REQUIREMENTS, bottom-up, no alignment), using a window far above the directory:

Window [lo, hi], what is in it Request Result
64 MiB, all reserved, free right above hi 64 KiB refused (error 8) in 3 us
1 GiB, all reserved, free right above hi, with MEM_WRITE_WATCH 64 KiB did not return, process could not be ended
same, without MEM_WRITE_WATCH 64 KiB did not return, process could not be ended
1 GiB, all reserved but the top 64 KiB 64 KiB placed in the gap, 7 us
1 GiB, all reserved but the top 64 KiB 128 KiB did not return, process could not be ended
1 GiB, all reserved, and the 64 KiB right above hi reserved too 64 KiB refused (error 8) in 68 us
[4 GiB, 2^37 - 64 KiB) all reserved in 124 pieces of up to 1 GiB, free right above XMemVirtualAlloc, 64 KiB graphics did not return (2 of 2)

So on this Windows 11 build (26300), a constrained request that does not fit hangs when free space starts right at HighestEndingAddress + 1 (and the window is large: 64 MiB was fine, 1 GiB was not, nothing in between tried). That is the layout this PR produces when the directory is full. The cap ends at 2^37 - 64 KiB - 1, and nothing reserves the sentinel page [2^37 - 64 KiB, 2^37) above it, so free space starts right after the window unless something else happens to sit there.

Why the existing tests and reports do not see it:

  • graphics_reservation_falls_back_when_the_directory_range_is_too_small asks for 128 GiB, more than the whole window, which seems to be refused without the search.
  • The parallel failure reported earlier in this thread (the 128 GiB reservation at [4 GiB, 132 GiB)) has one reservation running past the window's end, which is the last row but one: refused at once.
  • The in-game runs never reached the fallback (no "37-bit reservation refused" line).

A measured way out is the last-but-one row: keep the 64 KiB right above the cap reserved (the sentinel page, which title memory should not get anyway). Then a full directory is refused at once and the fallback runs. I did not run that as a change to xmem.rs, only as the raw probe above.

Overlap with #3154

  • git merge-tree pr2856 pr3154: conflict in xmem.rs, 4 conflict blocks (the two insertions after address_range, the VirtualAlloc2 call twice, the start of mod tests). Neither touches the other's other files.
  • Same end on both sides: GPU_DIRECTORY_END here and title_range::HIGH there are both 2^37 - 64 KiB, and neither reserves the page above (reading).
  • One combined path is the hang layout above (reading, not run). With both merged and the range held, a request the held range cannot place (in_title_range gives None) goes to this PR's 37-bit attempt. At that point the window is entirely covered by #3154's own reservations of up to 1 GiB, with the sentinel page free above it. That is the last row of the table, which did not return. #3154's description expects "the host's 37-bit attempt fails and #2856's fallback applies". On this machine it did not fail, it hung. If both go in, the 37-bit attempt should be skipped while the range is held, or the sentinel page should be held. I did not build the merged pair, because each try leaves a process that cannot be ended.
  • A difference of intent (reading). Here CPU-only memory keeps the whole console range, and the PR's test checks that a CPU-only top-down reservation lands above 2^37. Under #3154, CPU-only requests with console bounds are placed in the held range first. The unit tests do not show the clash because title_range::kept() is not held in a test process.

Reading vs measured

  • Measured: the suite above and every row of the table (each hang row is one process that stayed stuck until restart, 6 in all).
  • Reading: why the sentinel page is free, the #3154 merged path, and the CPU-only difference.

Not checked: other Windows builds or Windows 10, where between 64 MiB and 1 GiB the hang starts, top-down requests on a full window, the PR's 37-bit cap with the sentinel page held (as code), the merged pair built and run, any in-game run.

GPUs tested: n/a (CPU-only tests).

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353746931 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7353746931). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T17:53:36Z. --- Ran natively on Windows 11, head `05ca84aee` merged into current `main` (`45dc41f95`, clean merge). Debug build, CPU-only tests. **Suites on the merge** | Command | Result | |---|---| | `cargo test -p leonida-hle -- --test-threads=4` | 250 passed, 0 failed, 2 ignored (+1 +1 in the other binaries); the two new tests included | | `cargo clippy -p leonida-gpu -p leonida-hle --all-targets` | no warnings (checked together with #3153, which changes another file) | **A refused 37-bit attempt did not return here** The fallback depends on the first `VirtualAlloc2` being refused when `[4 GiB, 2^37 - 64 KiB)` has no room. I filled that range from the test process with plain no-access reservations, the way another library would, and called the PR's `XMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS)`. The call never returned. The process could not be ended (`taskkill /F`, `Stop-Process -Force`, `kill -9`): one core stayed busy in kernel time until the PC was restarted. It happened on both tries. I then narrowed it down with raw `VirtualAlloc2` calls (`MEM_ADDRESS_REQUIREMENTS`, bottom-up, no alignment), using a window far above the directory: | Window `[lo, hi]`, what is in it | Request | Result | |---|---|---| | 64 MiB, all reserved, free right above `hi` | 64 KiB | refused (error 8) in 3 us | | 1 GiB, all reserved, free right above `hi`, with `MEM_WRITE_WATCH` | 64 KiB | did not return, process could not be ended | | same, without `MEM_WRITE_WATCH` | 64 KiB | did not return, process could not be ended | | 1 GiB, all reserved but the top 64 KiB | 64 KiB | placed in the gap, 7 us | | 1 GiB, all reserved but the top 64 KiB | 128 KiB | did not return, process could not be ended | | 1 GiB, all reserved, **and the 64 KiB right above `hi` reserved too** | 64 KiB | refused (error 8) in 68 us | | `[4 GiB, 2^37 - 64 KiB)` all reserved in 124 pieces of up to 1 GiB, free right above | `XMemVirtualAlloc`, 64 KiB graphics | did not return (2 of 2) | So on this Windows 11 build (26300), a constrained request that does not fit hangs when free space starts right at `HighestEndingAddress + 1` (and the window is large: 64 MiB was fine, 1 GiB was not, nothing in between tried). That is the layout this PR produces when the directory is full. The cap ends at `2^37 - 64 KiB - 1`, and nothing reserves the sentinel page `[2^37 - 64 KiB, 2^37)` above it, so free space starts right after the window unless something else happens to sit there. Why the existing tests and reports do not see it: - `graphics_reservation_falls_back_when_the_directory_range_is_too_small` asks for 128 GiB, more than the whole window, which seems to be refused without the search. - The parallel failure reported earlier in this thread (the 128 GiB reservation at `[4 GiB, 132 GiB)`) has one reservation running past the window's end, which is the last row but one: refused at once. - The in-game runs never reached the fallback (no "37-bit reservation refused" line). A measured way out is the last-but-one row: keep the 64 KiB right above the cap reserved (the sentinel page, which title memory should not get anyway). Then a full directory is refused at once and the fallback runs. I did not run that as a change to `xmem.rs`, only as the raw probe above. **Overlap with #3154** - `git merge-tree pr2856 pr3154`: conflict in `xmem.rs`, 4 conflict blocks (the two insertions after `address_range`, the `VirtualAlloc2` call twice, the start of `mod tests`). Neither touches the other's other files. - Same end on both sides: `GPU_DIRECTORY_END` here and `title_range::HIGH` there are both `2^37 - 64 KiB`, and neither reserves the page above (reading). - One combined path is the hang layout above (reading, not run). With both merged and the range held, a request the held range cannot place (`in_title_range` gives `None`) goes to this PR's 37-bit attempt. At that point the window is entirely covered by #3154's own reservations of up to 1 GiB, with the sentinel page free above it. That is the last row of the table, which did not return. #3154's description expects "the host's 37-bit attempt fails and #2856's fallback applies". On this machine it did not fail, it hung. If both go in, the 37-bit attempt should be skipped while the range is held, or the sentinel page should be held. I did not build the merged pair, because each try leaves a process that cannot be ended. - A difference of intent (reading). Here CPU-only memory keeps the whole console range, and the PR's test checks that a CPU-only top-down reservation lands above 2^37. Under #3154, CPU-only requests with console bounds are placed in the held range first. The unit tests do not show the clash because `title_range::kept()` is not held in a test process. **Reading vs measured** - Measured: the suite above and every row of the table (each hang row is one process that stayed stuck until restart, 6 in all). - Reading: why the sentinel page is free, the #3154 merged path, and the CPU-only difference. Not checked: other Windows builds or Windows 10, where between 64 MiB and 1 GiB the hang starts, top-down requests on a full window, the PR's 37-bit cap with the sentinel page held (as code), the merged pair built and run, any in-game run. GPUs tested: n/a (CPU-only tests). AI-assisted: yes (Claude Code).
MoonEyes commented 2026-12-02 18:28:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:28:45Z.


Verification triage of #2856

Head 05ca84aee has several independent verifications on this exact head (lixonik, EdenBendheim on an RTX 3090, OreoFR, Kal0s-design on native Windows 11). CI passes (5/5) and the PR merges cleanly. No new run here (Windows-only). Verdict: ready (already verified on this head).

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


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354654093 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7354654093). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:28:45Z. --- **Verification triage of #2856** Head `05ca84aee` has several independent verifications on this exact head (lixonik, EdenBendheim on an RTX 3090, OreoFR, Kal0s-design on native Windows 11). CI passes (5/5) and the PR merges cleanly. No new run here (Windows-only). **Verdict: ready (already verified on this head).** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
MoonEyes commented 2026-12-02 21:38:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:38:30Z.


RUN (independent run on Windows, head 05ca84aee05ba0d60eaec9e0eb5e31eff61b63ae, merged into main b41763227aeed2d23c98af84bcbc1bddc7acdc90 with git merge --no-ff)

Windows 11, Rust release profile, --locked, shared target directory. The merge was clean: one file, d3d12/crates/leonida-hle/src/modules/xmem.rs, +109/-2, no conflict. No game files, no GPU run here, nothing was posted anywhere.

Green

  • cargo test -p leonida-hle --release --locked --lib: 250 passed, 0 failed, 2 ignored (1m12s including the build). Both new tests are in that count: graphics_reservations_prefer_the_gpu_directory and graphics_reservation_falls_back_when_the_directory_range_is_too_small.
  • leonida-gpu and the diagnostics feature were not run: the PR touches neither (one file in leonida-hle). No Python test is touched.
  • This was one default (parallel) run. It does not rule out the parallel flake described under Blockers: KelboLive measured it at 8 of 30 runs on this head, and I did not repeat the run to confirm or refute that.

Red

The new tests live in xmem.rs itself, so putting main's version of the file back would delete them. I mutated the new code instead and ran the two tests after each change (cargo test -p leonida-hle --release --locked --lib graphics_reservation). Every mutation was reverted with git checkout HEAD -- <file>.

Mutation Result
M1: cap removed, highest.min(GPU_DIRECTORY_END - 1) back to highest (this is main's behaviour) killed by graphics_reservations_prefer_the_gpu_directory
M2: wider-range retry disabled (if false && ...) killed by graphics_reservation_falls_back_when_the_directory_range_is_too_small
M3: sentinel page not excluded (GPU_DIRECTORY_END = 1 << 37) killed by the preference test
M4: cap also applied to CPU-only reservations killed by the preference test (the 40-bit CPU-only check)
M5: cap off by one (GPU_DIRECTORY_END instead of - 1) killed by the preference test

0 of 5 survived, and each of the two tests is the only one that catches its own mutation, so neither is redundant.

Blockers (measured by reviewers on this exact head, not cleared)

  1. The two new tests break each other under the default parallel cargo test (KelboLive, CHANGES_REQUESTED review on this head). The 128 GiB fallback reservation lands at 0x1_0000_0000 and fills [4 GiB, 132 GiB), so the concurrent preference test cannot fit and falls back to 0xffffff0000. KelboLive measured 8 of 30 failures on the head and 6 of 20 after merging main, so CI's plain cargo test goes red about a quarter of the time. Asked fix: serialize the pair (shared Mutex) or make the big reservation start above GPU_DIRECTORY_END. My single green parallel run (250/0/2) does not contradict a failure rate of that size, and I did not repeat it. No push has followed the review.
  2. The fallback path can hang instead of falling back (Kal0s-design, comment on this head, native Windows 11 build 26300, debug build). With [4 GiB, 2^37 - 64 KiB) filled by plain reservations and the sentinel page above it free, XMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS) never returned: 2 of 2 tries, the process could not be ended (taskkill /F, Stop-Process -Force, kill -9) until the PC was restarted. Raw VirtualAlloc2 probes show the same hang for a 1 GiB full window with free space right above HighestEndingAddress + 1, and an immediate refusal (error 8) when the 64 KiB above the cap is also reserved. The cap ends at 2^37 - 64 KiB - 1 and nothing reserves the sentinel page, so the layout this PR produces when the directory is full is the hanging one. The measured way out is to keep the sentinel page reserved (probe only, not run as a change to xmem.rs). The existing tests do not see it because the fallback test asks for 128 GiB, which is refused without the search. My own run does not cover this path (see Not covered).
  3. Conflict with #3154, measured: Kal0s-design ran git merge-tree pr2856 pr3154: conflict in modules/xmem.rs, 4 blocks (the two insertions after address_range, the VirtualAlloc2 call twice, the start of mod tests). By reading, not run: merged, a request the held range cannot place goes to this PR's 37-bit attempt with the window fully covered and the sentinel page free, which is blocker 2's hanging layout; and #3154 places CPU-only requests in the held range first, while this PR's test expects a CPU-only top-down reservation above 2^37. I did not re-run the merge-tree.

Review

  • Smaller points raised by KelboLive on this head, still open: on fallback, LowestStartingAddress keeps the caller's floor, so an out-of-directory 128 GiB reservation takes the whole mappable window (raise it to GPU_DIRECTORY_END on retry); and directory_covered (xmem.rs:213) leaves out the at >= 4 GiB check, so a 32-bit graphics reservation logs true although memory.rs:295 rejects pages below 0x1_0000.
  • Default-off switches: the PR adds no switch, so d3d12/docs/switches.md needs no regeneration. The behaviour change is always on for graphics reservations (flags & 2 != 0, no base address). CPU-only and ADDRESS_32BIT reservations keep their ranges (the tests check both).
  • Ordering and lifetimes: the retry reuses the same parameter and re-points it at the same requirements, which is still alive. Only the upper bound changes. It runs only when constrained (no caller base) and the first range was narrower than the console's. A first failure leaves nothing reserved. The tracing::warn! fires for any first-call failure, including a commit that fails for lack of memory, so "37-bit reservation refused" says slightly more than is known (cosmetic).
  • Bound: GPU_DIRECTORY_END = 2^37 - 64 KiB matches KelboLive's reading of the empty last directory page (memory.rs:295, :627, emit/shader.rs:127). M3 and M5 show the tests hold the bound.
  • Docs: I found nothing in docs/d3d12_vulkan.md or d3d12/docs/findings.md that describes this reservation range, so no stale statement.
  • Claim: the PR body cites a claim on #2570; EdenBendheim also reports claiming his run there. I did not open the coordination thread.
  • In-game runs already posted on this exact head (comments): MoonEyes (RTX 4060, about 860 s, 0 device lost), lixonik (RTX 5070, 268 s), EdenBendheim (RTX 3090, 300 s gate), OreoFR (RTX 4070 Laptop, 330 s). None reports the fallback warning firing, so none exercised the fallback path that blocker 2 is about. They do not answer the two blockers above.

Not covered

  • No in-game run here and no GPU.
  • I did not repeat the parallel run, so blocker 1 is KelboLive's measurement, not mine.
  • I did not reproduce the hang of blocker 2 (each try leaves a process that cannot be ended) and did not build the merged pair with #3154. My fallback test coverage (M2) reserves 128 GiB, the case Kal0s-design says is refused without the search, not a full 4 GiB to 2^37 window.
  • Not measured: memory reserved below 2^37 and title heap fragmentation; other Windows builds or Windows 10 for the hang; Wine/Linux beyond what others reported.

Verdict

FAIL (blocked, do not merge as is). In my run the code compiled, 250/0/2 passed in one parallel run, and 5 of 5 mutations were killed. But three measured blockers on this head are open and unanswered: the parallel flake of the two new tests (8/30 and 6/20, KelboLive), the possible hang of the fallback when the directory window is full (2 of 2, Kal0s-design, unrecoverable without a reboot), and the 4-block conflict in xmem.rs with #3154. The in-game runs on this head do not clear them, since none hit the fallback. Re-check after the author serializes or moves the tests, reserves the sentinel page (or otherwise avoids the hang), and settles the order with #3154.

AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359569445 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7359569445). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T21:38:30Z. --- RUN (independent run on Windows, head `05ca84aee05ba0d60eaec9e0eb5e31eff61b63ae`, merged into `main` `b41763227aeed2d23c98af84bcbc1bddc7acdc90` with `git merge --no-ff`) Windows 11, Rust release profile, `--locked`, shared target directory. The merge was clean: one file, `d3d12/crates/leonida-hle/src/modules/xmem.rs`, +109/-2, no conflict. No game files, no GPU run here, nothing was posted anywhere. ### Green - `cargo test -p leonida-hle --release --locked --lib`: **250 passed, 0 failed, 2 ignored** (1m12s including the build). Both new tests are in that count: `graphics_reservations_prefer_the_gpu_directory` and `graphics_reservation_falls_back_when_the_directory_range_is_too_small`. - `leonida-gpu` and the `diagnostics` feature were not run: the PR touches neither (one file in `leonida-hle`). No Python test is touched. - This was one default (parallel) run. It does not rule out the parallel flake described under Blockers: KelboLive measured it at 8 of 30 runs on this head, and I did not repeat the run to confirm or refute that. ### Red The new tests live in `xmem.rs` itself, so putting `main`'s version of the file back would delete them. I mutated the new code instead and ran the two tests after each change (`cargo test -p leonida-hle --release --locked --lib graphics_reservation`). Every mutation was reverted with `git checkout HEAD -- <file>`. | Mutation | Result | |---|---| | M1: cap removed, `highest.min(GPU_DIRECTORY_END - 1)` back to `highest` (this is `main`'s behaviour) | killed by `graphics_reservations_prefer_the_gpu_directory` | | M2: wider-range retry disabled (`if false && ...`) | killed by `graphics_reservation_falls_back_when_the_directory_range_is_too_small` | | M3: sentinel page not excluded (`GPU_DIRECTORY_END = 1 << 37`) | killed by the preference test | | M4: cap also applied to CPU-only reservations | killed by the preference test (the 40-bit CPU-only check) | | M5: cap off by one (`GPU_DIRECTORY_END` instead of `- 1`) | killed by the preference test | 0 of 5 survived, and each of the two tests is the only one that catches its own mutation, so neither is redundant. ### Blockers (measured by reviewers on this exact head, not cleared) 1. **The two new tests break each other under the default parallel `cargo test`** (KelboLive, `CHANGES_REQUESTED` review on this head). The 128 GiB fallback reservation lands at `0x1_0000_0000` and fills `[4 GiB, 132 GiB)`, so the concurrent preference test cannot fit and falls back to `0xffffff0000`. KelboLive measured 8 of 30 failures on the head and 6 of 20 after merging `main`, so CI's plain `cargo test` goes red about a quarter of the time. Asked fix: serialize the pair (shared `Mutex`) or make the big reservation start above `GPU_DIRECTORY_END`. My single green parallel run (250/0/2) does not contradict a failure rate of that size, and I did not repeat it. No push has followed the review. 2. **The fallback path can hang instead of falling back** (Kal0s-design, comment on this head, native Windows 11 build 26300, debug build). With `[4 GiB, 2^37 - 64 KiB)` filled by plain reservations and the sentinel page above it free, `XMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS)` never returned: 2 of 2 tries, the process could not be ended (`taskkill /F`, `Stop-Process -Force`, `kill -9`) until the PC was restarted. Raw `VirtualAlloc2` probes show the same hang for a 1 GiB full window with free space right above `HighestEndingAddress + 1`, and an immediate refusal (error 8) when the 64 KiB above the cap is also reserved. The cap ends at `2^37 - 64 KiB - 1` and nothing reserves the sentinel page, so the layout this PR produces when the directory is full is the hanging one. The measured way out is to keep the sentinel page reserved (probe only, not run as a change to `xmem.rs`). The existing tests do not see it because the fallback test asks for 128 GiB, which is refused without the search. My own run does not cover this path (see Not covered). 3. **Conflict with #3154, measured:** Kal0s-design ran `git merge-tree pr2856 pr3154`: conflict in `modules/xmem.rs`, 4 blocks (the two insertions after `address_range`, the `VirtualAlloc2` call twice, the start of `mod tests`). By reading, not run: merged, a request the held range cannot place goes to this PR's 37-bit attempt with the window fully covered and the sentinel page free, which is blocker 2's hanging layout; and #3154 places CPU-only requests in the held range first, while this PR's test expects a CPU-only top-down reservation above 2^37. I did not re-run the merge-tree. ### Review - **Smaller points raised by KelboLive on this head, still open:** on fallback, `LowestStartingAddress` keeps the caller's floor, so an out-of-directory 128 GiB reservation takes the whole mappable window (raise it to `GPU_DIRECTORY_END` on retry); and `directory_covered` (`xmem.rs:213`) leaves out the `at >= 4 GiB` check, so a 32-bit graphics reservation logs `true` although `memory.rs:295` rejects pages below `0x1_0000`. - **Default-off switches:** the PR adds no switch, so `d3d12/docs/switches.md` needs no regeneration. The behaviour change is always on for graphics reservations (`flags & 2 != 0`, no base address). CPU-only and `ADDRESS_32BIT` reservations keep their ranges (the tests check both). - **Ordering and lifetimes:** the retry reuses the same `parameter` and re-points it at the same `requirements`, which is still alive. Only the upper bound changes. It runs only when `constrained` (no caller base) and the first range was narrower than the console's. A first failure leaves nothing reserved. The `tracing::warn!` fires for any first-call failure, including a commit that fails for lack of memory, so "37-bit reservation refused" says slightly more than is known (cosmetic). - **Bound:** `GPU_DIRECTORY_END = 2^37 - 64 KiB` matches KelboLive's reading of the empty last directory page (`memory.rs:295`, `:627`, `emit/shader.rs:127`). M3 and M5 show the tests hold the bound. - **Docs:** I found nothing in `docs/d3d12_vulkan.md` or `d3d12/docs/findings.md` that describes this reservation range, so no stale statement. - **Claim:** the PR body cites a claim on #2570; EdenBendheim also reports claiming his run there. I did not open the coordination thread. - **In-game runs already posted on this exact head** (comments): MoonEyes (RTX 4060, about 860 s, 0 device lost), lixonik (RTX 5070, 268 s), EdenBendheim (RTX 3090, 300 s gate), OreoFR (RTX 4070 Laptop, 330 s). None reports the fallback warning firing, so none exercised the fallback path that blocker 2 is about. They do not answer the two blockers above. ### Not covered - No in-game run here and no GPU. - I did not repeat the parallel run, so blocker 1 is KelboLive's measurement, not mine. - I did not reproduce the hang of blocker 2 (each try leaves a process that cannot be ended) and did not build the merged pair with #3154. My fallback test coverage (M2) reserves 128 GiB, the case Kal0s-design says is refused without the search, not a full 4 GiB to 2^37 window. - Not measured: memory reserved below 2^37 and title heap fragmentation; other Windows builds or Windows 10 for the hang; Wine/Linux beyond what others reported. ### Verdict **FAIL (blocked, do not merge as is).** In my run the code compiled, 250/0/2 passed in one parallel run, and 5 of 5 mutations were killed. But three measured blockers on this head are open and unanswered: the parallel flake of the two new tests (8/30 and 6/20, KelboLive), the possible hang of the fallback when the directory window is full (2 of 2, Kal0s-design, unrecoverable without a reboot), and the 4-block conflict in `xmem.rs` with #3154. The in-game runs on this head do not clear them, since none hit the fallback. Re-check after the author serializes or moves the tests, reserves the sentinel page (or otherwise avoids the hang), and settles the order with #3154. AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
MoonEyes commented 2026-12-03 07:01:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:01:09Z.


This pull request has a merge conflict with current main (d9b618f10), so it can't be run in game or merged as it is. Could you merge the latest main into it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7370498299 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7370498299). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T07:01:09Z. --- This pull request has a merge conflict with current `main` (`d9b618f10`), so it can't be run in game or merged as it is. Could you merge the latest `main` into it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head. AI-assisted (Claude Code).
fiestorra commented 2026-12-03 10:23:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T10:23:10Z.


Estado de la rebasada: no es mecánica, y el motivo es que el conflicto es de contenido en la lógica de colocación de memoria

Medido al intentarla sobre d9b618f10:

d3d12/crates/leonida-hle/src/modules/xmem.rs   3667 líneas · 4 bloques de conflicto
bloque 1 (L99)  HEAD y la rama definen `in_title_range(...)` de forma distinta:
                firma, comentario y el cálculo de `Where::Anywhere { lowest, highest, top_down }`

Los otros tres bloques son del mismo tipo: los dos lados han tocado la misma función y cada uno ha añadido su parte.

Y por eso no la rebaso yo: in_title_range decide dónde se reserva la memoria del título — si elijo mal, el juego reserva en un sitio que no es y el fallo aparece como un cuelgue o una lectura mala, no como un test rojo. No hay test que cubra «la reserva fue al sitio correcto» sin el juego (por eso esta PR trae los suyos, y no puedo correrlos contra el título).

Lo que sí está medido de esta PR: toca un solo fichero (xmem.rs) y estaba limpia de conflicto hasta que main movió la misma función. O sea que es de las que se rebasan en veinte minutos leyendo los dos lados — pero leyendo, no con un script.

Y el detalle que le sirve a quien la rebase: el bloque de L99 no es un añadido, es la misma función con dos versiones del comentario y del bucle — así que la resolución es comparar las dos implementaciones de in_title_range y quedarse con la que tenga las dos ideas, no con una de las dos.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7375156322 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7375156322). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T10:23:10Z. --- ## Estado de la rebasada: **no es mecánica, y el motivo es que el conflicto es de contenido en la lógica de colocación de memoria** **Medido al intentarla sobre `d9b618f10`**: ``` d3d12/crates/leonida-hle/src/modules/xmem.rs 3667 líneas · 4 bloques de conflicto bloque 1 (L99) HEAD y la rama definen `in_title_range(...)` de forma distinta: firma, comentario y el cálculo de `Where::Anywhere { lowest, highest, top_down }` ``` **Los otros tres bloques son del mismo tipo**: **los dos lados han tocado la misma función y cada uno ha añadido su parte.** **Y por eso no la rebaso yo**: **`in_title_range` decide dónde se reserva la memoria del título** — **si elijo mal, el juego reserva en un sitio que no es y el fallo aparece como un cuelgue o una lectura mala, no como un test rojo.** **No hay test que cubra «la reserva fue al sitio correcto» sin el juego** (**por eso esta PR trae los suyos, y no puedo correrlos contra el título**). **Lo que sí está medido de esta PR**: **toca un solo fichero** (`xmem.rs`) **y estaba limpia de conflicto hasta que `main` movió la misma función.** **O sea que es de las que se rebasan en veinte minutos leyendo los dos lados** — **pero leyendo, no con un script.** **Y el detalle que le sirve a quien la rebase**: **el bloque de L99 no es un añadido, es la misma función con dos versiones del comentario y del bucle** — **así que la resolución es comparar las dos implementaciones de `in_title_range` y quedarse con la que tenga las dos ideas**, **no con una de las dos.**
MoonEyes commented 2026-12-03 18:02:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:02:32Z.


Thanks for the work on this. This pull request has a merge conflict with the current main and has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latest main into your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7387502229 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2856#issuecomment-7387502229). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T18:02:32Z. --- Thanks for the work on this. This pull request has a merge conflict with the current `main` and has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latest `main` into your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome. --- _Generated by [Claude Code](https://claude.ai/code)_

Pull request closed

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!2856
No description provided.