xmem: hold the 32-bit window [2 GiB, 4 GiB), tell a refused 2 MiB commit as the retry error, working-set statistics at the console's size (XMEM-LOW-WINDOW, XMEM-FALLBACK-STATS) #3444
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3444
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/xmem-low-window"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Two commits, one per item; each has its own switch.
What
title_range::keepnow also holds the free places of [2 GiB, 4 GiB) with no access, at the sameplace as the title's range (before Streamline, DLSS and the drivers load).
XMemVirtualAllocplaces a request withthe 32-bit flag and no base in it, the lowest place that fits; a request it cannot place goes to the host below 4 GiB
as before, with a warning. If part of the window was taken before the start, the rest is held and one log line says
how much.
LEONIDA_XMEM_LOW_WINDOW=0holds nothing there. Per console behaviour a 32-bit request gets an address inthat window and nothing else of the process lies there; here images, heaps and drivers did (#3337: 185 MB refused with
a 27.8 MiB free run left, then the title stopped). The window is plain reservations like the title's range, not one
placeholder (the range's header says why a placeholder does not fit write-watched memory).
per console behaviour the title's allocator then retries with 64 KiB pages, where any other code is a failed
allocation (the
0x8007000Eplayers saw). The host's error is kept for every refused request (the logging after itchanged it; a test read 0).
LEONIDA_XMEM_FALLBACK_ERROR=0: as before.XMemGetWorkingSetStatisticswrites the 0x78 bytes of the console's structure (it wrote 0x50), readsthe first argument as a mask of partitions (0x20000001: the title's), and the use is what the title holds (its
commits, the host heap behind
XMemAlloc, its physical pages), never more than the limit, instead of the wholeprocess's commit. Peak, page count and kernel pool are told; the bandwidth-optimal limit and use are both zero.
LEONIDA_XMEM_STATS_V2=0: the old 0x50 bytes and figures.In-game run
Game gate (
scripts/game-gate.ps1) on a test branch that merges four changes over maina558375458: this PR together with the FFX jitter, XMem low window and descriptor-record changes and a periodic preload save.-SeriesS -PrecompileUsed, RTX 4060 8 GB, driver 32.0.16.1088, Windows 11, build with diagnostics. PASS, 314 s in the world, no device loss, median 17.7 fps, VRAM peak 6 390 MB for a 6 776 MB budget. Warningfault_after_stop(access violations in the runtime after the gate stopped the run, clean exit): the same 8 faults appear on a run of another branch, so most likely not from this change (not yet compared with main).cargo test --locked -p leonida-gpu -p leonidaon that test branch: 742 + 62 + 5 passed, 0 failed.Seen in the log:
32-bit window held: [2 GiB, 4 GiB) reserved ... held_mb=2048, and no0x8007000E. Not measured yet: the statistics line before and after, and an AMD card.Tested
cargo test -p leonida-hle --locked(286 passed, 2 ignored),cargo test -p leonida-gpu --locked title_range,cargo clippyclean on the touched files,python -I tests/test_d3d12_switches.py,switches.mdregenerated,check_no_game_data.pyon the touched files.AI-assisted
Written with Claude Opus 5.5 (Claude Code); reviewed twice by a separate Claude Opus 5.5 reviewer instance (the used counter that never went down, among other points, is fixed). Two minor points left: a 0-size decommit not at the base removes 1 byte from the count, and the count drops even when
VirtualFreefails, as before.🤖 Generated with Claude Code
Merging, with Moon's written OK as maintainer (two maintainers only: the CONTRIBUTING rule against merging one's own PR is waived for this series). Branch updated with main
5238ce44fb, no conflict. The merged tree (cce2dde5) is the one tested locally:cargo test --locked -p leonida-gpu -p leonida -p leonida-hleall passed,tests/test_d3d12_switches.pyOK,check_no_game_data.pyclean. In-game gate in the description (PASS, 314 s, no device loss, 32-bit window held). AI-assisted (Claude Opus 5.5).