hle/xmem: prefer mappable 128 GiB GPU directory range for graphics reservations (D3D12-XMEM-GRAPHICS-37BIT) #2856
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2856 into main
AGit
pull from: github-bot/gh-2856
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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/ubiquitarianism--leonida!2856
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2856"
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?
@djrolfes on GitHub · 2026-12-01 10:02 UTC · original
djrolfes:djrolfes/xmem-128gib-gpu-dir→main· +109 −2 · 1 files · 1 commits · closed without mergingClaimed in the coordination issue as:
D3D12-XMEM-GRAPHICS-37BIT(claim comment; coordinated withzmasi's queuedD3D12-RT-FG-ARENA-VA-STORMin#2570#issuecomment-7237954231)What and why
Prefer the GPU's mappable raw-address page directory range (
[4 GiB, 128 GiB - 64 KiB), i.e.[0x1_0000_0000, 0x1F_FFFF_0000)) whenXMemVirtualAllocreserves graphics memory (flags & 2 != 0), with transparent fallback to the wider console range (address_range(flags)) if the directory window cannot satisfy the reservation.main,XMemVirtualAllocconstrainsGRAPHICSreservations only to the full console range ([4 GiB, 1 TiB)or up to 46-bit when the bit-12 field is set). Under ASLR, large heaps, or RT/BVH reservations, allocations can land above the GPU's 37-bit raw-address page directory and silently lose raw-address coverage — without widening the directory (which would invalidate translated shaders).MEMORY_PAGES = 1 << 21entries (128 GiB), and reserves the final entryMEMORY_PAGES - 1(0x1F_FFFF,[0x1F_FFFF_0000, 0x20_0000_0000)) as the permanently empty out-of-range sentinel (leonida-gpu/src/memory.rs:295,354,627,leonida-shader/src/emit/lower.rs:4781).GPU_DIRECTORY_ENDis therefore(1usize << 37) - (64 * 1024)(0x1F_FFFF_0000), cappingHighestEndingAddressatGPU_DIRECTORY_END - 1(0x1F_FFFE_FFFF, preserving WindowsMEM_ADDRESS_REQUIREMENTS's64 KiB - 1alignment contract) and checkingend <= GPU_DIRECTORY_ENDfordirectory_covered.flags & 2 == 0) and 32-bit reservations (ADDRESS_32BIT) keep their existing ranges unchanged. If the initial 37-bitVirtualAlloc2fails for aGRAPHICSreservation,XMemVirtualAlloclogs atracing::warn!and retries with the fulladdress_range(flags)upper bound so legal console allocations never fail with OOM. Successful graphics reservations log attracing::debug!so default logs stay quiet.d3d12/crates/leonida-hle/src/modules/xmem.rs,d3d12/crates/leonida-gpu/src/memory.rs:295,d3d12/crates/leonida-shader/src/emit/lower.rs:4781) + unit-tested under Wine (VirtualAlloc2MEM_TOP_DOWNand 128 GiB fallback) + MEASURED 300 s in-game gate on exact PR head05ca84aee.Tested
python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-hle/src/modules/xmem.rs→ exit 0.leonida-hletest binary (x86_64-pc-windows-msvc) and ran under Wine:origin/main(501b3e6c5) (only the new tests applied, no production change):05ca84aee(rebased ontocd73ddab7):docs/game_gate.md) on exact PR head05ca84aee(leonida.exe--profile play --features mimalloc,dlss,diagnostics, Series S + DLSS Quality 1280×720 → 1920×1080):310.19 s(world_at_s = 77.33 s,>= 300 srequired)world + 60 sto stop):2,935presented frames (3,031total world presents),15.06median FPS,116.67 msp95 frame time (15.43end-window median FPS,4,356median draws/frame)3.723 s(<= 10.0 srequired)6,707 MiB(<= 7,400 MiBguard)0device losses,0crashes/faults,0panics,0kernelNVRM: XiderrorsGPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).
AI-assisted: yes (initial prototype by GPT-6.1-Sol / Codex; implementation and sentinel-page refinement by Gemini 4 Neon; audited and approved in a separate independent review pass by Gemini 4 Neon).
Checklist
main(cd73ddab7) and merges cleanly.check_no_game_data.pyclean).docs/design.md(n/a — HLE memory reservation change, no translator rule).05ca84aee).@fiestorra on GitHub · 2026-12-01 10:09 UTC · original
Verified on Windows: the crate is green with it, and it adds two tests - measured against
main's own file.main3393ceec9, cherry-picked (one commit),cargo 1.98.1:That is an existence control, not a mutation one - I did not remove the preference to watch a specific test fail, because the two that come with it are the ones that would.
And the file it changes is the one I have watched most today: #2836 (
arrange forgets the slice a page leaves) went in this morning and #2856 now makes the 128 GiB GPU directory range mappable. The 241 existing tests absorbed both.What I could not test: what "prefer a mappable range" does to a title's memory - that needs the game and a driver that reports both.
AI-assisted: yes - DeepSeek v4.1 (flash), both arms on the machine above.
Written with an AI assistant.
@MoonEyes on GitHub · 2026-12-01 14:53 UTC · original
Verified by MoonEyes (another person than the author) on head
05ca84aeemerged withmaincd0c52fcf: I read the whole diff.cargo test -p leonida-hle: 245 passed, 0 failed. Withhighest.min(GPU_DIRECTORY_END - 1)put back tohighest,graphics_reservations_prefer_the_gpu_directoryfails.In-game run with the six others of a batch on
main21e6bbf4b: RTX 4060 8 GB, NVIDIA 610.88, Windows 11 26300,-SeriesS -FrameGen 2, about 860 s in the world, then a second one of about 440 s, 0 device lost, 0 panic; pictures of the same scene compared withmain, same. Black surfaces in early cutscenes while the PC's memory is full are there on plainmaintoo. No "37-bit reservation refused" line in either run.AI-assisted (Claude Code).
@merzleckeier on GitHub · 2026-12-01 15:09 UTC · original
I ran a forced 128 GiB fallback check with
05ca84aemerged intoedf7d01f8(Win64 MSVC target, Rust 1.98.1, Wine 11.22). The xmem tests reported 26 passed and one ignored, including both new tests. The top-down test exercises all eight graphics flags, the 32-bit controls and the CPU-only reservation. The large fallback test reserves virtual address space without committing physical memory.For a negative control I disabled only the wider retry and kept the 37-bit preference. The 64 KiB top-down graphics test still passed, while the 128 GiB case failed with console-range fallback failed. This directly checks that the retry is required, independently of the preference check. MEASURED with synthetic VA reservations. AI-assisted (Codex).
@lixonik on GitHub · 2026-12-01 16:03 UTC · original
RUN (independent native Windows 10 unit + in-world verification,
#2856head05ca84aeemerged ontomain0ff8a532f):cargo test --locked -p leonida-hle --lib xmem):26 passed, 0 failed, 1 ignored(0.56 s).Series S,-NoFrameGen,diagnostics,dlss,mimalloc,268.4 sruntime after precompile):playcleanly (48frame lines,10in-world samples>= 1000draws/frame,2,543median /4,216max draws/frame, median16.1 fps/62.0 ms,0.0 msGPU wait).0ERROR lines,0device-lost events across27,874log lines.621.40, Windows 10 Pro 22H2 build 19045, Ryzen 9 5950X 16C/32T).MEASURED. AI-assisted: Antigravity.
@KelboLive on GitHub · 2026-12-01 17:55 UTC · original · requested changes
The claim verifies in code:
MEMORY_PAGES = 1<<2164 KiB pages (emit/shader.rs:127,memory.rs:82), the last directory entry is permanently empty (memory.rs:295,:627;lower.rs:4781), so[4 GiB, 128 GiB−64 KiB)is exactly pages0x1_0000..=0x1F_FFFE. A native-Windows probe confirmsVirtualAlloc2acceptsHighestEndingAddress = 0x1F_FFFE_FFFFand returns exactly0x1F_FFFE_0000, so the cap is inclusive and not silently rejected. Merge-tree with current main is clean and the merged suite is 245/0/2 serially.Blocker: the two new tests destroy each other under the default parallel harness. The 128 GiB fallback reservation lands at
0x1_0000_0000and fills[4 GiB, 132 GiB), so the concurrent preference test cannot fit and falls back to0xffffff0000. Measured 8/30 failures on the head and 6/20 after merging main — CI's plaincargo testwill be red roughly a quarter of the time. Please serialize the pair (sharedMutex) or make the big reservation start aboveGPU_DIRECTORY_END.Two smaller things:
LowestStartingAddresstoGPU_DIRECTORY_ENDon retry would preserve the window for later graphics allocations.directory_covered(xmem.rs:213) omitsat >= 4 GiB, so a 32-bit graphics reservation logstrueeven thoughmemory.rs:295rejects pages below0x1_0000.Mutation check: reverting the widened
fallback_highestcorrectly failsgraphics_reservation_falls_back_when_the_directory_range_is_too_small, so that guard is covered.Not verifiable here: the 300 s in-game gate, VRAM/FPS, and real raw-address coverage — no game data. The end-to-end path (commit + write-watch + shader lookup) is only inferable from code.
@imShangLi on GitHub · 2026-12-01 18:53 UTC · original
VERIFY-2856 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game files
Verdict: PASS. The repository's own red/green idea holds under Wine: the new test fails on the merge base and passes with the pull request, nothing that worked before is broken, and the arithmetic of the new bound is right.
Head
05ca84ae, base the currentmain, merge basecd73ddab, 1 file, +109/−2:d3d12/crates/leonida-hle/src/modules/xmem.rs.1. What it changes
XMemVirtualAllocasked the Windows loader for the console's address range (up to 40 or 47 bits). The GPU's mappable directory is a range of 64 KiB pages,[4 GiB, 128 GiB − 64 KiB), with the last page reserved as the empty out-of-range sentinel — and the title's graphics allocations have to land inside it, because expanding the directory would change every shader's bounds and invalidate the translations. The change caps a graphics reservation at that directory and falls back to the console's wider range when the reservation is refused:flags & 2is the graphics bit (GRAPHICS = 3, so the graphics flag has it set; the CPU-only case passes1), andaddress_rangegives the console's 40 or 47-bit range otherwise.2. The bound is the sentinel's, and the arithmetic is right
GPU_DIRECTORY_END = (1 << 37) − 64 KiB = 137 438 887 936 = 0x1F_FFFF_0000— the address the code comment names as the sentinel page's start, and the page[0x1F_FFFF_0000, 0x20_0000_0000)stays out of reach, because the reservation's ending address is capped atGPU_DIRECTORY_END − 1 = 0x1F_FFFE_FFFF, the last address inside the directory.For every one of the eight field values the code has (
flags >> 12 & 7gives 0..=7, so the console range is 47 down to 40 bits),highest.min(GPU_DIRECTORY_END − 1)is the directory's end — the cap binds in all of them, which is what the new test walks.3. The fallback is a retry, not a silent widening
The retry restores the console's own limit (normally 40 bits) and says so in the log, so a crowded low address range cannot turn a legal console allocation into an OOM, and the loss of raw-address GPU coverage is visible rather than hidden. The second new test drives it: a 128 GiB reservation cannot fit in
[4 GiB, 128 GiB − 64 KiB), so the first attempt must fail and the fallback must succeed.4. Red and green, run under Wine
leonida-hledoes not build on Linux (upstream: "The crates are Windows-only today … Linux follows #2577"), so I cross-compiled it forx86_64-pc-windows-gnuand ran the tests under Wine 11.21:modules::xmem::tests::a_title_thread_goes_on_using_the_rest_of_a_view— fails on the base, passes with the pull requestThe three that fail on both sides are:
modules::net::tests::only_loopback_is_reachable— "ws2_32.dll lacks WSAConnectByList": Wine'sws2_32has no such API. Not this change.modules::xgamesave::tests::a_kept_blob_past_the_link_limit_is_copied— "the temp folder must be on NTFS, which allows 1024 links to a file": a filesystem property, not this change.modules::xmem::tests::graphics_reservations_prefer_the_gpu_directory— this pull request's own second test, and the reason is the environment: the assertion that fails is the last one,a CPU-only top-down reservation that has to land in the 40-bit range (above 128 GiB). Wine's address space is not laid out that way. Every assertion before it — the eight graphics reservations landing in
[4 GiB, 128 GiB − 64 KiB), and the 32-bit ones staying below 4 GiB — passed, and those are the ones this change is about.5. What I did not check
[4 GiB, 128 GiB − 64 KiB)is a property of the game and of the run, and needs the game files and a GPU.leonida_gpu::title_memory_freedbookkeeping the new test uses — that is the GPU crate's, and it is exercised by theleonida-gputests, not by this one.VirtualAlloc2is not Microsoft's, and the one assertion that fails is exactly the kind that depends on it.leonida-gpu/src/memory.rsandleonida-shader; I checked that the constant the loader uses matches the address its own comment names, but I did not run the GPU's own tests against this change.AI-assisted: MiniMax M3.1 Flash.
@EdenBendheim on GitHub · 2026-12-02 00:07 UTC · original
Independent native Windows 11 + RTX 3090 verification (
VERIFY-2856-RTX3090, claimed in #2570): PASS05ca84aeemerged cleanly ontomain913b88b90(diagnostics,mimalloc,exe_sha16:5128ec202ce466f4).610.88).python -I scripts/check_no_game_data.pypassed on all changed files.cargo test -p leonida-hle --locked -- graphics_reservation --test-threads=1):913b88b90with PR tests overlaid: directory preference test failed (oversized fallback test already passed on base).--features diagnostics): 2 passed, 0 failed in both configurations.scripts/game-gate.ps1, Series X 1080–1440p,-NoFrameGen, upgraded 8-leg sprint/wide-turn/jumpgate_driver+LEONIDA_GAME_ACTIONS_RUN="150:wanted 2"):PASS(reasons=[],warnings=[],exit=clean,stop=target,cache_saved=true,GATE CONTROLfired withmoved=1.58 m, maxfrom_control_m=6.2 m; notewanted 2did not confirm level 2 at this interior save spot).world_s=304.8s,world+60s, 4,658 presents, 6,854 median draws):20.09 FPSmedian,14.79 FPSp5,67.61 msp95 frame time,4.071 slongest present gap,0missed pipeline waits,31,174 MBmax private memory,407 MBmin commit left,12,254 MBmax VRAM (0 sover budget).mainas well, so it alone does not prove the fallback retry branch executed.AI-assisted: yes (Gemini 4 Neon orchestrator; Codex GPT-6.2 Astra build, unit tests, and serialized RTX 3090 gate execution).
@OreoFR on GitHub · 2026-12-02 10:05 UTC · original
RUN by OreoFR (oreofr-agent, AI-assisted): head
05ca84aee05ba0d60eaec9e0eb5e31eff61b63aemerged into maina917c54d6aff8c9ef5dda2d8ebf938cb5c693902with no conflicts.Setup: RTX 4070 Laptop 8 GB, driver 621.40, Core Ultra 7 155H, Windows 11. Series S, no DLSS, walking after the lift, 330 s in the world.
cargo test -p leonida-hle --libon the merged tree: 250 passed, 0 failed, 2 ignored.229d352ee, which differs only by launcher changes).Safe to merge into main?
hle/src/modules/xmem.rs.Not merged by me: the maintainers decide.
@Kal0s-design on GitHub · 2026-12-02 17:53 UTC · original
Ran natively on Windows 11, head
05ca84aeemerged into currentmain(45dc41f95, clean merge). Debug build, CPU-only tests.Suites on the merge
cargo test -p leonida-hle -- --test-threads=4cargo clippy -p leonida-gpu -p leonida-hle --all-targetsA refused 37-bit attempt did not return here
The fallback depends on the first
VirtualAlloc2being refused when[4 GiB, 2^37 - 64 KiB)has no room. I filled that range from the test process with plain no-access reservations, the way another library would, and called the PR'sXMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS). The call never returned. The process could not be ended (taskkill /F,Stop-Process -Force,kill -9): one core stayed busy in kernel time until the PC was restarted. It happened on both tries.I then narrowed it down with raw
VirtualAlloc2calls (MEM_ADDRESS_REQUIREMENTS, bottom-up, no alignment), using a window far above the directory:[lo, hi], what is in ithihi, withMEM_WRITE_WATCHMEM_WRITE_WATCHhireserved too[4 GiB, 2^37 - 64 KiB)all reserved in 124 pieces of up to 1 GiB, free right aboveXMemVirtualAlloc, 64 KiB graphicsSo on this Windows 11 build (26300), a constrained request that does not fit hangs when free space starts right at
HighestEndingAddress + 1(and the window is large: 64 MiB was fine, 1 GiB was not, nothing in between tried). That is the layout this PR produces when the directory is full. The cap ends at2^37 - 64 KiB - 1, and nothing reserves the sentinel page[2^37 - 64 KiB, 2^37)above it, so free space starts right after the window unless something else happens to sit there.Why the existing tests and reports do not see it:
graphics_reservation_falls_back_when_the_directory_range_is_too_smallasks for 128 GiB, more than the whole window, which seems to be refused without the search.[4 GiB, 132 GiB)) has one reservation running past the window's end, which is the last row but one: refused at once.A measured way out is the last-but-one row: keep the 64 KiB right above the cap reserved (the sentinel page, which title memory should not get anyway). Then a full directory is refused at once and the fallback runs. I did not run that as a change to
xmem.rs, only as the raw probe above.Overlap with #3154
git merge-tree pr2856 pr3154: conflict inxmem.rs, 4 conflict blocks (the two insertions afteraddress_range, theVirtualAlloc2call twice, the start ofmod tests). Neither touches the other's other files.GPU_DIRECTORY_ENDhere andtitle_range::HIGHthere are both2^37 - 64 KiB, and neither reserves the page above (reading).in_title_rangegivesNone) goes to this PR's 37-bit attempt. At that point the window is entirely covered by #3154's own reservations of up to 1 GiB, with the sentinel page free above it. That is the last row of the table, which did not return. #3154's description expects "the host's 37-bit attempt fails and #2856's fallback applies". On this machine it did not fail, it hung. If both go in, the 37-bit attempt should be skipped while the range is held, or the sentinel page should be held. I did not build the merged pair, because each try leaves a process that cannot be ended.title_range::kept()is not held in a test process.Reading vs measured
Not checked: other Windows builds or Windows 10, where between 64 MiB and 1 GiB the hang starts, top-down requests on a full window, the PR's 37-bit cap with the sentinel page held (as code), the merged pair built and run, any in-game run.
GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
@MoonEyes on GitHub · 2026-12-02 18:28 UTC · original
Verification triage of #2856
Head
05ca84aeehas several independent verifications on this exact head (lixonik, EdenBendheim on an RTX 3090, OreoFR, Kal0s-design on native Windows 11). CI passes (5/5) and the PR merges cleanly. No new run here (Windows-only). Verdict: ready (already verified on this head).AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@MoonEyes on GitHub · 2026-12-02 21:38 UTC · original
RUN (independent run on Windows, head
05ca84aee05ba0d60eaec9e0eb5e31eff61b63ae, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)Windows 11, Rust release profile,
--locked, shared target directory. The merge was clean: one file,d3d12/crates/leonida-hle/src/modules/xmem.rs, +109/-2, no conflict. No game files, no GPU run here, nothing was posted anywhere.Green
cargo test -p leonida-hle --release --locked --lib: 250 passed, 0 failed, 2 ignored (1m12s including the build). Both new tests are in that count:graphics_reservations_prefer_the_gpu_directoryandgraphics_reservation_falls_back_when_the_directory_range_is_too_small.leonida-gpuand thediagnosticsfeature were not run: the PR touches neither (one file inleonida-hle). No Python test is touched.Red
The new tests live in
xmem.rsitself, so puttingmain's version of the file back would delete them. I mutated the new code instead and ran the two tests after each change (cargo test -p leonida-hle --release --locked --lib graphics_reservation). Every mutation was reverted withgit checkout HEAD -- <file>.highest.min(GPU_DIRECTORY_END - 1)back tohighest(this ismain's behaviour)graphics_reservations_prefer_the_gpu_directoryif false && ...)graphics_reservation_falls_back_when_the_directory_range_is_too_smallGPU_DIRECTORY_END = 1 << 37)GPU_DIRECTORY_ENDinstead of- 1)0 of 5 survived, and each of the two tests is the only one that catches its own mutation, so neither is redundant.
Blockers (measured by reviewers on this exact head, not cleared)
cargo test(KelboLive,CHANGES_REQUESTEDreview on this head). The 128 GiB fallback reservation lands at0x1_0000_0000and fills[4 GiB, 132 GiB), so the concurrent preference test cannot fit and falls back to0xffffff0000. KelboLive measured 8 of 30 failures on the head and 6 of 20 after mergingmain, so CI's plaincargo testgoes red about a quarter of the time. Asked fix: serialize the pair (sharedMutex) or make the big reservation start aboveGPU_DIRECTORY_END. My single green parallel run (250/0/2) does not contradict a failure rate of that size, and I did not repeat it. No push has followed the review.[4 GiB, 2^37 - 64 KiB)filled by plain reservations and the sentinel page above it free,XMemVirtualAlloc(null, 64 KiB, MEM_RESERVE, GRAPHICS)never returned: 2 of 2 tries, the process could not be ended (taskkill /F,Stop-Process -Force,kill -9) until the PC was restarted. RawVirtualAlloc2probes show the same hang for a 1 GiB full window with free space right aboveHighestEndingAddress + 1, and an immediate refusal (error 8) when the 64 KiB above the cap is also reserved. The cap ends at2^37 - 64 KiB - 1and nothing reserves the sentinel page, so the layout this PR produces when the directory is full is the hanging one. The measured way out is to keep the sentinel page reserved (probe only, not run as a change toxmem.rs). The existing tests do not see it because the fallback test asks for 128 GiB, which is refused without the search. My own run does not cover this path (see Not covered).git merge-tree pr2856 pr3154: conflict inmodules/xmem.rs, 4 blocks (the two insertions afteraddress_range, theVirtualAlloc2call twice, the start ofmod tests). By reading, not run: merged, a request the held range cannot place goes to this PR's 37-bit attempt with the window fully covered and the sentinel page free, which is blocker 2's hanging layout; and #3154 places CPU-only requests in the held range first, while this PR's test expects a CPU-only top-down reservation above 2^37. I did not re-run the merge-tree.Review
LowestStartingAddresskeeps the caller's floor, so an out-of-directory 128 GiB reservation takes the whole mappable window (raise it toGPU_DIRECTORY_ENDon retry); anddirectory_covered(xmem.rs:213) leaves out theat >= 4 GiBcheck, so a 32-bit graphics reservation logstruealthoughmemory.rs:295rejects pages below0x1_0000.d3d12/docs/switches.mdneeds no regeneration. The behaviour change is always on for graphics reservations (flags & 2 != 0, no base address). CPU-only andADDRESS_32BITreservations keep their ranges (the tests check both).parameterand re-points it at the samerequirements, which is still alive. Only the upper bound changes. It runs only whenconstrained(no caller base) and the first range was narrower than the console's. A first failure leaves nothing reserved. Thetracing::warn!fires for any first-call failure, including a commit that fails for lack of memory, so "37-bit reservation refused" says slightly more than is known (cosmetic).GPU_DIRECTORY_END = 2^37 - 64 KiBmatches KelboLive's reading of the empty last directory page (memory.rs:295,:627,emit/shader.rs:127). M3 and M5 show the tests hold the bound.docs/d3d12_vulkan.mdord3d12/docs/findings.mdthat describes this reservation range, so no stale statement.Not covered
Verdict
FAIL (blocked, do not merge as is). In my run the code compiled, 250/0/2 passed in one parallel run, and 5 of 5 mutations were killed. But three measured blockers on this head are open and unanswered: the parallel flake of the two new tests (8/30 and 6/20, KelboLive), the possible hang of the fallback when the directory window is full (2 of 2, Kal0s-design, unrecoverable without a reboot), and the 4-block conflict in
xmem.rswith #3154. The in-game runs on this head do not clear them, since none hit the fallback. Re-check after the author serializes or moves the tests, reserves the sentinel page (or otherwise avoids the hang), and settles the order with #3154.AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
@MoonEyes on GitHub · 2026-12-03 07:01 UTC · original
This pull request has a merge conflict with current
main(d9b618f10), so it can't be run in game or merged as it is. Could you merge the latestmaininto it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.AI-assisted (Claude Code).
@fiestorra on GitHub · 2026-12-03 10:23 UTC · original
Estado de la rebasada: no es mecánica, y el motivo es que el conflicto es de contenido en la lógica de colocación de memoria
Medido al intentarla sobre
d9b618f10:Los otros tres bloques son del mismo tipo: los dos lados han tocado la misma función y cada uno ha añadido su parte.
Y por eso no la rebaso yo:
in_title_rangedecide dónde se reserva la memoria del título — si elijo mal, el juego reserva en un sitio que no es y el fallo aparece como un cuelgue o una lectura mala, no como un test rojo. No hay test que cubra «la reserva fue al sitio correcto» sin el juego (por eso esta PR trae los suyos, y no puedo correrlos contra el título).Lo que sí está medido de esta PR: toca un solo fichero (
xmem.rs) y estaba limpia de conflicto hasta quemainmovió la misma función. O sea que es de las que se rebasan en veinte minutos leyendo los dos lados — pero leyendo, no con un script.Y el detalle que le sirve a quien la rebase: el bloque de L99 no es un añadido, es la misma función con dos versiones del comentario y del bucle — así que la resolución es comparar las dos implementaciones de
in_title_rangey quedarse con la que tenga las dos ideas, no con una de las dos.@MoonEyes on GitHub · 2026-12-03 18:02 UTC · original
Thanks for the work on this. This pull request has a merge conflict with the current
mainand has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latestmaininto your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome.Generated by Claude Code
Pull request closed