XMem: the title's reservations in its window go where our own walk of it finds room (#3765) #3767
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3767"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by sansj24k on 2026-11-30T06:28:05Z.
Fixes #3765 (and likely #2737, the same white window on a second start).
What was wrong
The issue's reporter took a kernel dump of the hang. A constrained
XMemVirtualAlloc(one withMEM_ADDRESS_REQUIREMENTS) leaves the address search to the kernel. On a second start with a saved pipeline library, thousands of pipelines start early beside the title's 3.9 GB placeholder. The search for that placeholder then ran for 27 s innt!MiFindEmptyAddressRange/RtlFindClearBitsExwhile holding the process's address-space lock.dxgmms2waited on that lock while holding its recycle-heap mutex, other GPU allocations queued behind it, and the PC could not start new programs until it was powered off.What this changes
In
XMemVirtualAlloc, for constrained reservations only:VirtualQueryEx. The walk stops at the first free region that holds the size from an aligned start (64 KiB, or 2 MiB when asked).VirtualAlloc2is given that address, with no address requirements, so the kernel has nothing to search.MEM_TOP_DOWNrequests stay with the kernel.VICTORY_XMEM_OWN_SEARCH=0restores the old behaviour. The setting is logged once at its first use.The root cause, the dump and the fix are the reporter's. They tested the fix on their PC with the same reproduction: two second starts with saved caches (1844 and 2271 early pipelines) got through, where the unpatched build hung 3 of 3 times. This PR is that fix alone. It leaves out the other changes in their patch (watchdog default, priorities, job object, escape key, launcher hang watch), since those change defaults and are separate decisions.
Checks
our_own_search_takes_the_first_aligned_room_in_the_window: the first-fit rules.our_own_search_places_reservations_in_the_window: real reservations on this process.XMemVirtualAlloctest now goes through the new path and passes.cargo test -p victory-hle: 424 pass. The one failure,a_read_by_range_waits_only_for_a_remapping_that_meets_it, is a timing test that fails the same way onmain(#3621 moves it into its own process).cargo clippy -p victory-hle --all-targets --no-deps -- -D warningsreports only the errors already onmain, ingameinput.rsandlifecycle.rs.Overlap
#3738, #3126, #3242 and #2133 also edit
XMemVirtualAlloc. Whichever lands second will need a small rebase around theallocateclosure.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by victorious-gh on 2026-11-30T06:31:46Z.
My claude agent reviewed the pr and approved that this is the same fix it had applied for me. :) if someone else experiencing the issue could test it that would be great.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by sdpiter on 2026-11-30T14:59:05Z.
Tested this on GTA VI (b99f876b74d4a77f…), RTX 4070 Ti 12 GB, Ryzen 5700G, 32 GB, Windows 11 26300, driver 32.0.16.2140.
Built
fix/xmem-own-search(0ee9f6cf) from source (rustc 1.100.1, release), then warmed the cache:83881 pipelines known, 83881 made in 2094 s (1 have no host pipeline, 0 ended their process), fingerprintf13c3a2e45b330c0.Two consecutive starts — no hang. First run reached the world, closed with WM_CLOSE, exit 0; second run started again on the saved pipeline cache (8847 lines of log, window up at 3 fps / ~300 ms, 14k draws), closed cleanly, exit 0. Before this patch the second start on this machine hung the whole desktop, so for us the fixed address-space search does what it says.
Two other things I hit on the way, both not from this patch:
VICTORY_NATIVE_1440P=1withrunkills the title ~2 min in:unhandled exception 0x80000003 at victory-image-…dll+0x2219650(breakpoint inside title code), right afterdisplay refresh rates … [60]/frame interval interval=33.333ms, then Breakpad uploads a 27 MB dump.Same crash with a control build of
main(c71899d9, no patch, same env, same cache) → independent of #3767. Without the switch it boots fine (title sees 3840x2160).play --res 1440(our F1 settings file hasVICTORY_MENU_DLSS=quality, so DLSS ends up on) stalls at1 draws/frameright afterdisplay 3440x1440 SDR, scene 2293x960 through the title's FidelityFX path: log stops dead (compile memory: process 9536 MB private), and the whole PC becomes unresponsive for minutes. That is the known DLSS freeze for us on this base, so it says nothing about the xmem fix — with DLSS off (as in the two runs above) repeated starts are fine.Logs: warm + both starts + the 0x80000003 dump attempt, if useful. Cache fingerprint above; happy to retest any build you point at.