Repository navigation
xmem: keep the space below 4 GiB for the title's 32-bit memory (port of VIctory#1009) - #108
Open
WHOISJARDAS wants to merge 1 commit into
Open
WHOISJARDAS wants to merge 1 commit into
WHOISJARDAS wants to merge 1 commit into
Conversation
A port of Marvisak/VIctory#1009 (NuraadGit, with the bounded retry from MichaelSmithAI). At startup the title asks XMemVirtualAlloc for a 185 MB placeholder below 4 GiB. Windows places the host's own memory bottom up, so the drivers' mapped shader caches, heaps and the image read can fill that space first; the request is refused and the title stops at its own assertion (int3 at +0x19f4f58), with nothing in the log. With the system's bottom-up ASLR turned off (Exploit protection) it happens on every start. The free space below 4 GiB (but the lowest 256 MB) is reserved at the start of `run`; a 32-bit request that finds no room releases guards one at a time and tries again, guarding again what stays free. A request still refused is logged. RX 9070 XT, bottom-up ASLR off, 2.3 GB of the driver's shader cache mapped below 4 GiB: main stopped at the assertion on 4 of 4 starts (3 MB free below 4 GiB, largest hole 64 KiB); with this, 3 of 3 starts reach the menus at 30 fps with 3.8 GB kept for the title. Co-authored-by: NuraadGit <81594937+NuraadGit@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A port of Marvisak/VIctory#1009 by NuraadGit (with MichaelSmithAI's bounded retry), which fixes Marvisak/VIctory#790 upstream and is not in this tree yet. On this machine,
maincannot start the title at all.What was wrong
At startup the title asks
XMemVirtualAllocfor a 185 MB placeholder with the 32-bit address flag (size=193986560 kind=0x42000 flags=0x7), soaddress_rangelimits it to0..4 GiB. Windows places the host's own memory bottom up, so the drivers' mapped shader caches, heap segments and the image read inruncan fill that space first.VirtualAlloc2then fails withERROR_NOT_ENOUGH_MEMORY, nothing is logged, and the title stops at its own assertion:0x80000003at+0x19f4f58, about 1 s after start, right after the D3D12 device is made.A temporary probe in the refusal path (not part of this PR) mapped
0..4 GiBat the failure:%LOCALAPPDATA%\AMD\DxcCache\*.parc, one of 1.5 GB)New detail: on this machine Windows Security, Exploit protection, Randomize memory allocations (Bottom-up ASLR) is Off system-wide (
Get-ProcessMitigation -SystemshowsBottomUp: OFF; the Windows default is On). With it off, every host allocation starts at the lowest free address, so the failure is deterministic. Starting the same unpatched build with bottom-up and high-entropy ASLR forced on for that one process (PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY, no system change) started the title normally. The guards fix it either way.What this changes
Same as Marvisak/VIctory#1009:
xmem::low_guards::install()runs at the start ofrunwhen executing, before the image read, the device and the caches. It reserves the free space below 4 GiB except the lowest 256 MB, which stays with the host.XMemVirtualAllocreleases guards one at a time (smallest that fits first, each tried once) and retries, then guards again whatever stays free in that guard. The normal path is unchanged.low_guards::tests::a_released_guard_is_guarded_again_around_what_took_itanda_refused_retry_leaves_the_guards_in_place.Differences from Marvisak/VIctory#1009: the doc comment doesn't name the game, and a 32-bit request still refused after the retry logs one
warn(this tree logs no refusal at all, which is why this took a probe to find).Tested
AMD Radeon RX 9070 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 9800X3D, 32 GB, Windows 11 Pro 26200, bottom-up ASLR off, diag build, Series X profile, Rust 1.98.1:
main(90b529f)+0x19f4f58space below 4 GiB kept for the title guards=2 mb=3797..3805no room below 4 GiBcargo test --workspace --locked: 498 passed, 0 failed, 7 ignored, including the twolow_guardstestscargo clippy --workspace --all-targets --locked -- -D warningsand the--all-featuresrun: cleancargo xtask policy: okNot tested
NVIDIA and Intel cards; a machine with bottom-up ASLR on (there the failure needs a large driver cache, as in the RTX 2080 and RTX 3060 Ti reports on Marvisak/VIctory#790 and Marvisak/VIctory#1009); Linux/Wine.
AI use
Claude Code (Claude Opus 5.5) found the refusal with a probe, ported and adapted the upstream change and ran the checks. The hardware, the title copy and the runs are mine.
🤖 Generated with Claude Code