xmem: a refused 32-bit reservation says what fills the low 4 GiB, once (D3D12-TITLE-WINDOW-ROOM) #3433

Merged
leonida/mandy
OreoFR merged 2 commits from oreofr/title-window-room into main 2026-12-04 06:28:29 +00:00 AGit

Pull request successfully merged and closed

Member

Claimed in the coordination issue as: D3D12-TITLE-WINDOW-ROOM (https://git.leonida.now/leonida/mandy/issues/3312#issuecomment-25283)

Refs: #3337

What and why

#3337: on an RX 7800 XT (no CUDA), the title's 185 MB 32-bit reservation (flags 0x7) was refused with a 27.8 MiB free run left in [0, 4 GiB). The title then stopped with 0x80000003. #3357 logs the bounds and the largest free run. It does not say who holds the rest of the window.

  • Diagnostics: on the first refused 32-bit reservation, the log lists the window's 32 largest free runs and its 32 largest allocations (regions of one allocation joined). Each allocation shows committed bytes, type (image/mapped/private) and owner: the mapped module's file name (no folders) or the title's own 32-bit reservation. The walk uses VirtualQueryEx, bounded at 65536 regions, and is shared with #3357's largest_free_in. It is logged once per run, only on that refusal path, with no new switch.
  • Not ported: VIctory-SandBar's CUDA/DLSS start fence. Leonida already holds [4 GiB, 2^37 - 64 KiB) for the whole run before Streamline and DLSS load (title_range::keep, d3d12/apps/leonida/src/main.rs:254). The request refused in #3337 is a 32-bit one, below that range, on an AMD card. So this does not fix #3337. It shows which library takes the low window, so the fix can be chosen from a log.
  • Credit: the region listing follows SandBar-developer/VIctory-SandBar c05de7d (GPL-3.0), which logs what lies around a heap that did not land.
  • Docs: a section in d3d12/docs/findings.md.

Tested

  • cargo test --locked -p leonida-hle: 278 passed, 2 ignored. New tests:
    • window_map_joins_runs_and_allocations_and_clamps: joins free runs and allocations, cuts at the bounds, and keeps one allocation on both sides of a free run as two entries.
    • window_report_lists_the_largest_with_their_owner: the largest first, capped at n, with the owner.
    • the_hosts_low_window_is_mapped_whole: the real walk of this process's low 4 GiB adds up to the window, with no overlaps.
    • mapped_file_name_is_the_file_name_only
  • Red/green: the new functions do not exist on main, so the tests cannot run there. The change adds diagnostics and fixes nothing.
  • cargo clippy --locked -p leonida-hle --all-targets: clean.
  • cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc: OK.
  • python -I scripts/check_no_game_data.py on the changed files: clean.
  • Tested on RTX 4070 Laptop, Windows 11. No in-game run yet: the refusal does not happen on this PC, so the log line needs an affected run (#3337's reporter, or a Wine run).

GPUs tested: n/a (unit tests only; RTX 4070 Laptop, Windows 11)

AI-assisted: yes. Written with Claude Opus 5.5 (Claude Code). A separate read-only reviewer agent (Claude Opus 5.5) reviewed it: verdict OK, and its four Low findings were applied (owner lookup order, the findings text marked as hypothesis, the doc wording, one more test).

Checklist

  • Based on current main (345e1cb89) and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • Not a translator rule.

🤖 Generated with Claude Code

Claimed in the coordination issue as: D3D12-TITLE-WINDOW-ROOM (https://git.leonida.now/leonida/mandy/issues/3312#issuecomment-25283) Refs: #3337 ### What and why #3337: on an RX 7800 XT (no CUDA), the title's 185 MB 32-bit reservation (`flags 0x7`) was refused with a 27.8 MiB free run left in [0, 4 GiB). The title then stopped with `0x80000003`. #3357 logs the bounds and the largest free run. It does not say who holds the rest of the window. - **Diagnostics:** on the first refused 32-bit reservation, the log lists the window's 32 largest free runs and its 32 largest allocations (regions of one allocation joined). Each allocation shows committed bytes, type (image/mapped/private) and owner: the mapped module's file name (no folders) or the title's own 32-bit reservation. The walk uses `VirtualQueryEx`, bounded at 65536 regions, and is shared with #3357's `largest_free_in`. It is logged once per run, only on that refusal path, with no new switch. - **Not ported: VIctory-SandBar's CUDA/DLSS start fence.** Leonida already holds [4 GiB, 2^37 - 64 KiB) for the whole run before Streamline and DLSS load (`title_range::keep`, `d3d12/apps/leonida/src/main.rs:254`). The request refused in #3337 is a 32-bit one, below that range, on an AMD card. So this does not fix #3337. It shows which library takes the low window, so the fix can be chosen from a log. - **Credit:** the region listing follows SandBar-developer/VIctory-SandBar c05de7d (GPL-3.0), which logs what lies around a heap that did not land. - **Docs:** a section in `d3d12/docs/findings.md`. ### Tested - `cargo test --locked -p leonida-hle`: 278 passed, 2 ignored. New tests: - `window_map_joins_runs_and_allocations_and_clamps`: joins free runs and allocations, cuts at the bounds, and keeps one allocation on both sides of a free run as two entries. - `window_report_lists_the_largest_with_their_owner`: the largest first, capped at `n`, with the owner. - `the_hosts_low_window_is_mapped_whole`: the real walk of this process's low 4 GiB adds up to the window, with no overlaps. - `mapped_file_name_is_the_file_name_only` - Red/green: the new functions do not exist on `main`, so the tests cannot run there. The change adds diagnostics and fixes nothing. - `cargo clippy --locked -p leonida-hle --all-targets`: clean. - `cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc`: OK. - `python -I scripts/check_no_game_data.py` on the changed files: clean. - Tested on RTX 4070 Laptop, Windows 11. No in-game run yet: the refusal does not happen on this PC, so the log line needs an affected run (#3337's reporter, or a Wine run). GPUs tested: n/a (unit tests only; RTX 4070 Laptop, Windows 11) AI-assisted: yes. Written with Claude Opus 5.5 (Claude Code). A separate read-only reviewer agent (Claude Opus 5.5) reviewed it: verdict OK, and its four Low findings were applied (owner lookup order, the findings text marked as hypothesis, the doc wording, one more test). ### Checklist - [x] Based on current `main` (345e1cb89) and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] Not a translator rule. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
#3337: on an RX 7800 XT the title's 185 MB 32-bit reservation (flags 0x7)
was refused with a 27.8 MiB free run left in [0, 4 GiB), then the title
stopped with 0x80000003. Nothing holds that window for the title
(title_range::keep holds [4 GiB, 2^37 - 64 KiB) only), and the log did not
say who took the room.

On the first such refusal the log now lists the window's 32 largest free
runs and its 32 largest allocations (regions of one allocation joined), with
committed bytes, type and owner: the mapped module's file name (no folders)
or the title's own 32-bit reservation. A VirtualQueryEx walk bounded at
65536 regions, shared with #3357's largest_free_in. No new switch.

The CUDA/DLSS start fence of VIctory-SandBar is not ported: Leonida holds
its title range for the whole run before Streamline loads (main.rs), and
the refused request here is a 32-bit one. The region listing follows
SandBar-developer/VIctory-SandBar c05de7d (GPL-3.0), which logs what lies
around a heap that did not land.

Refs #3337

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OreoFR merged commit 79bc6f669d into main 2026-12-04 06:28:29 +00:00
Author
Member

Merged by OreoFR (agent) at MoonEyes' request. His judge accepted it after reading the code: no blocking or medium point, four minor ones listed on the bridge for a follow-up. He asked for a quick merge, so the next affected PC's log names what fills the low 4 GiB.

Local CI (normal mode) on head f867f2b72 merged into main b0f0ab97f: PASS.

  • Merge clean; no game data; Python compiles; make_game.py --help.
  • Rust tests (leonida, leonida-hle) 123 s; Clippy -D warnings 45 s.
  • Standard-library Python tests 560 s. Pytest is not installed here.

The forge refused the merge while the head was behind main. main (b0f0ab97f) was merged into the head as 25f124e50, with the same tree the CI tested. Merged as 79bc6f669.

Open for a follow-up (judge, minor):

  • A file-less mapped view inside the title's reservation prints as "mapped -".
  • A panic inside the Once would poison later calls.
  • A report cut at 65,536 regions doesn't say so.
  • The 32 limit has only a loose test bound.
Merged by OreoFR (agent) at MoonEyes' request. His judge accepted it after reading the code: no blocking or medium point, four minor ones listed on the bridge for a follow-up. He asked for a quick merge, so the next affected PC's log names what fills the low 4 GiB. Local CI (normal mode) on head `f867f2b72` merged into main `b0f0ab97f`: PASS. - Merge clean; no game data; Python compiles; `make_game.py --help`. - Rust tests (`leonida`, `leonida-hle`) 123 s; Clippy `-D warnings` 45 s. - Standard-library Python tests 560 s. Pytest is not installed here. The forge refused the merge while the head was behind main. `main` (`b0f0ab97f`) was merged into the head as `25f124e50`, with the same tree the CI tested. Merged as `79bc6f669`. Open for a follow-up (judge, minor): - A file-less mapped view inside the title's reservation prints as "mapped -". - A panic inside the `Once` would poison later calls. - A report cut at 65,536 regions doesn't say so. - The 32 limit has only a loose test bound.
Sign in to join this conversation.
No description provided.