XMem: title memory below 128 GiB, the by-address directory's reach (#218) #1041

Manually merged
github merged 1 commit from github-bot/gh-1041 into main 2026-11-29 08:21:57 +00:00 AGit
Owner

@⁠Mumogg on GitHub · 2026-11-28 11:52 UTC · original
Mumogg:fix/xmem-below-128gib → main · +21 −1 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

Fixes the vehicle body panels that vanish a second after they are drawn (and the matching "pages that had no copy" reads), reported in #218.

Cause

Shaders that reach title memory by address look pages up in a directory of MEMORY_PAGES = 2^21 pages × 64 KiB = 128 GiB. XMemVirtualAlloc allowed addresses up to 40 bits, so on some starts the host placed several GB of the title's pools above 128 GiB. Every access there was capped to page 0x1fffff and read as 0: panels, and sometimes faces, disappear.

Change

address_range caps 64-bit title allocations below 2^37 (TITLE_TOP_BITS), the directory's reach. 32-bit requests are unchanged. The title's pools fit below that many times over. It is one constant plus a min. New unit test: title_memory_stays_within_the_by_address_directory.

This is separate from 108a897, which keeps physical page numbers within 21 bits. This one is about where the virtual pools are placed.

Tested

RTX 5070 Ti 16 GB, Linux + Wine/GE-Proton (vkd3d-proton), 1440p:

  • 9 of 9 runs with missing panels had title pools above 0x2000000000; 3 of 3 good runs were below it.
  • With the cap: 0 reads of page 0x1fffff in 5 runs, including a full session on 63b902f + this commit. The same build without it had 106 such reads in a comparable run.
  • victory-hle xmem tests: 23 passed (Windows target run under Wine).

It is not tested on native Windows; there, address placement may not reach 128 GiB as often.

Found and written with AI assistance (Claude Code). I checked the log evidence and ran the builds myself.

🤖 Generated with Claude Code

**@⁠Mumogg** on GitHub · 2026-11-28 11:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1041) `Mumogg:fix/xmem-below-128gib` → `main` · +21 −1 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC Fixes the vehicle body panels that vanish a second after they are drawn (and the matching "pages that had no copy" reads), reported in #218. ### Cause Shaders that reach title memory by address look pages up in a directory of `MEMORY_PAGES` = 2^21 pages × 64 KiB = **128 GiB**. `XMemVirtualAlloc` allowed addresses up to 40 bits, so on some starts the host placed several GB of the title's pools **above 128 GiB**. Every access there was capped to page `0x1fffff` and read as 0: panels, and sometimes faces, disappear. ### Change `address_range` caps 64-bit title allocations below 2^37 (`TITLE_TOP_BITS`), the directory's reach. 32-bit requests are unchanged. The title's pools fit below that many times over. It is one constant plus a `min`. New unit test: `title_memory_stays_within_the_by_address_directory`. This is separate from 108a897, which keeps *physical* page numbers within 21 bits. This one is about where the *virtual* pools are placed. ### Tested RTX 5070 Ti 16 GB, Linux + Wine/GE-Proton (vkd3d-proton), 1440p: - 9 of 9 runs with missing panels had title pools above `0x2000000000`; 3 of 3 good runs were below it. - With the cap: 0 reads of page `0x1fffff` in 5 runs, including a full session on `63b902f` + this commit. The same build without it had 106 such reads in a comparable run. - `victory-hle` xmem tests: 23 passed (Windows target run under Wine). It is not tested on native Windows; there, address placement may not reach 128 GiB as often. Found and written with AI assistance (Claude Code). I checked the log evidence and ran the builds myself. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Shaders that reach title memory by address look pages up in a directory of
MEMORY_PAGES (2^21 x 64 KiB = 128 GiB). XMemVirtualAlloc allowed up to 40 bits,
so on some starts Wine placed ~7.5 GB of the title's pools above 128 GiB: every
access there capped to page 0x1fffff ("pages that had no copy", read 0), and
vehicle body panels vanished a second after they were drawn (#218).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit df0893b44c3c99b76dbe9fa32e0d96e122039ec2)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:32:02 +00:00
Author
Owner

@⁠Exopus-0x65f7ad0 on GitHub · 2026-11-28 12:59 UTC · original

A data point from native Windows, since the PR says it has not been tested there.

Setup: Windows 11 (build 26300), RTX 5060 Ti 8 GB, 16 GB RAM. Base: 63b902f plus a few local commits that do not touch xmem, so this run is without the cap. README launcher defaults, 5 starts today that each reached gameplay in the prison opening.

5 starts
highest title address in any address= / start= field of the logs 0x12b8500000 (~75 GiB); the other four peak at 0xdd2b00000–0xea3e90000 (~55–58 GiB)
pages that had no copy (per-frame value in the title memory by address lines) 0.0 in every line (47 to 52 lines per run)
any 0x1fffff in the log none

So on native Windows, D3D12 never placed the pools above 0x2000000000 in these runs, which matches your guess. The cap would have been a no-op there, so it looks safe to take for Windows users too.

Caveat: these are only the addresses that show up in the log fields, not a full map of XMemVirtualAlloc results. If you want a stricter check, I can run a build that logs the highest address XMemVirtualAlloc returns.

**@⁠Exopus-0x65f7ad0** on GitHub · 2026-11-28 12:59 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1041#issuecomment-7239609843) A data point from native Windows, since the PR says it has not been tested there. **Setup:** Windows 11 (build 26300), RTX 5060 Ti 8 GB, 16 GB RAM. Base: `63b902f` plus a few local commits that do not touch `xmem`, so this run is **without** the cap. README launcher defaults, 5 starts today that each reached gameplay in the prison opening. | | 5 starts | |---|---| | highest title address in any `address=` / `start=` field of the logs | `0x12b8500000` (~75 GiB); the other four peak at `0xdd2b00000`–`0xea3e90000` (~55–58 GiB) | | `pages that had no copy` (per-frame value in the `title memory by address` lines) | 0.0 in every line (47 to 52 lines per run) | | any `0x1fffff` in the log | none | So on native Windows, D3D12 never placed the pools above `0x2000000000` in these runs, which matches your guess. The cap would have been a no-op there, so it looks safe to take for Windows users too. Caveat: these are only the addresses that show up in the log fields, not a full map of `XMemVirtualAlloc` results. If you want a stricter check, I can run a build that logs the highest address `XMemVirtualAlloc` returns.
Author
Owner

@⁠Mumogg on GitHub · 2026-11-28 13:27 UTC · original

Thanks, that's exactly the check that was missing. On Windows the pools stayed far below 128 GiB, so the cap does nothing there, and on Linux/Wine it is what keeps the panels. (AI-assisted reply.)

**@⁠Mumogg** on GitHub · 2026-11-28 13:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1041#issuecomment-7239943291) Thanks, that's exactly the check that was missing. On Windows the pools stayed far below 128 GiB, so the cap does nothing there, and on Linux/Wine it is what keeps the panels. (AI-assisted reply.)
Author
Owner

@⁠Vaporisateur on GitHub · 2026-11-28 14:39 UTC · original

Tried this on Windows 11 with an RTX 3080 10 GB (Series X profile, DLSS Quality), diagnostics build of v2026.11.28.01 plus this PR (and #1007), one 8.5-minute session in the first chapter's streets: the green vehicles are still there.

  • Several parked cars and a pickup fully neon green from about 2 to 4 minutes into play, and again near the end.
  • Same thing as #218 describes over time: a car that was green early came back textured later, while the car parked right next to it stayed green.
  • I found no sign of title memory above 128 GiB on this machine, though I only have indirect evidence: every texture address the logs mention across four sessions (with and without this PR) is below 55 GiB, and "pages that had no copy" stays at 0.0 per frame in all of them, including the sessions with green cars.

So on Windows with this setup the green cars look like a different path than the one this PR closes. Happy to run a build with more logging if there is something specific to look at.

**@⁠Vaporisateur** on GitHub · 2026-11-28 14:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1041#issuecomment-7240831113) Tried this on Windows 11 with an RTX 3080 10 GB (Series X profile, DLSS Quality), diagnostics build of v2026.11.28.01 plus this PR (and #1007), one 8.5-minute session in the first chapter's streets: **the green vehicles are still there.** - Several parked cars and a pickup fully neon green from about 2 to 4 minutes into play, and again near the end. - Same thing as #218 describes over time: a car that was green early came back textured later, while the car parked right next to it stayed green. - I found no sign of title memory above 128 GiB on this machine, though I only have indirect evidence: every texture address the logs mention across four sessions (with and without this PR) is below 55 GiB, and "pages that had no copy" stays at 0.0 per frame in all of them, including the sessions with green cars. So on Windows with this setup the green cars look like a different path than the one this PR closes. Happy to run a build with more logging if there is something specific to look at.
Author
Owner

@⁠Mumogg on GitHub · 2026-11-28 15:22 UTC · original

Thanks for testing. Since your title memory never went above 128 GiB, the green cars you saw have a second cause that this PR doesn't touch. This one only fixes the placement that Wine produces. One more thing we found on Linux: with the title's ray tracing on (VICTORY_BVH_BUILDER=1), cars also turn green about 35 s in, because the by-address pages made from shader faults hit a run-wide cap (FAULTS_ALL = 2048 in memory.rs). fxceless's 3e573d25 turns that into a recycled budget. If your diagnostics log has made=0 fault warnings, or a "faults in all" count stuck at 2048 when the cars go green, that's the same cap. If it doesn't, it's something else. (AI-assisted reply.)

**@⁠Mumogg** on GitHub · 2026-11-28 15:22 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1041#issuecomment-7241412189) Thanks for testing. Since your title memory never went above 128 GiB, the green cars you saw have a second cause that this PR doesn't touch. This one only fixes the placement that Wine produces. One more thing we found on Linux: with the title's ray tracing on (VICTORY_BVH_BUILDER=1), cars also turn green about 35 s in, because the by-address pages made from shader faults hit a run-wide cap (`FAULTS_ALL` = 2048 in memory.rs). fxceless's 3e573d25 turns that into a recycled budget. If your diagnostics log has `made=0` fault warnings, or a "faults in all" count stuck at 2048 when the cars go green, that's the same cap. If it doesn't, it's something else. (AI-assisted reply.)
github manually merged commit c6bb4fb001 into main 2026-11-29 08:21:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1041
No description provided.