mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #2356] [MERGED] d3d12, xmem: remap release and console heap mirror only on request (RT-GEOMETRY-REMAP-AND-HEAP-MIRROR-OPT-IN) #2359
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2359
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2356
Author: @aslan2142
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:geometry-remap-release-opt-in📝 Commits (3)
1f7cbefxmem: a remap retires geometry copies only with LEONIDA_GEOMETRY_REMAP_RELEASE=14a6a8a6xmem: read LEONIDA_GEOMETRY_REMAP_RELEASE once, with a test seam to read it again248b58cd3d12: the console heap's host-RAM mirror only with LEONIDA_HEAP_MIRROR=1📊 Changes
9 files changed (+74 additions, -23 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+17 -6)📝
runtime/CMakeLists.txt(+5 -1)📝
runtime/README.md(+2 -2)📝
runtime/shims/d3d12_vulkan_device.cpp(+4 -3)📝
runtime/shims/xmem.cpp(+16 -6)📝
runtime/shims/xmem.h(+2 -0)📝
runtime/src/console_heap_copy.h(+2 -1)📝
runtime/test/d3d12_console_heap_mirror_test.cpp(+5 -4)📝
runtime/test/xmem_test.cpp(+21 -0)📄 Description
Fixes two regressions that #2350 brought in. Since then, a world run loses the device within about a minute. Both features responsible are now off unless asked for:
LEONIDA_GEOMETRY_REMAP_RELEASE=1turns on retiring geometry copies when pages are remapped.LEONIDA_HEAP_MIRROR=1turns on the host-RAM mirror of a console heap's copy.Claimed in the coordination issue as: RT-GEOMETRY-REMAP-AND-HEAP-MIRROR-OPT-IN
What regressed
World runs on merged
main(RX 7900 XTX, RADV, Wine, the same settings otherwise):evicted 0and no fault.Why: remap release
36771ec53) made a remap of physical pages (XMemMapPhysicalPageswith pages, the scatter call,CopyPageMappingsBatchX) retire the geometry copies over every page that gets another frame.d3d12_com.cpp,GraphicsCommandList::address). A list recorded before the retirement but executed in anExecuteCommandListsthat starts after it is not one of the replayskAfterExecuteswaits for, so it reads the freed copy.Why: heap mirror
746059011) is what the filtered release sweep (LEONIDA_CONSOLE_RELEASE_FILTER=1) reads to decide which V# slots still name a released buffer.write()andzero(). I found no write that bypasses them.LEONIDA_HEAP_MIRROR=1 LEONIDA_HEAP_MIRROR_CHECK=1, which logs every slot where the mirror and the copy differ.The fix
remap_releases_enabled()inxmem.cppreturns true only whenLEONIDA_GEOMETRY_REMAP_RELEASEis1. The value is read once, and a test seam,rt::xmem::reload_remap_release_setting(), reads it again. With it off, copies follow the new pages through the refresh, as they did before #2350. Freeing, decommitting and unmapping pages still retire copies.heap_mirror_enabled()ind3d12_vulkan_device.cppreturns true only whenLEONIDA_HEAP_MIRRORis1. With it off, the sweep reads the copy itself, as it did before the mirror.runtime/README.md,docs/d3d12_vulkan.mdandsrc/console_heap_copy.hgive both defaults and why.Tests
xmem_test(test_remap_releases): a remap releases nothing when the variable is unset or0; the existing checks run with1.d3d12_console_heap_mirror_testexpects a mirror only withLEONIDA_HEAP_MIRROR=1:d3d12_console_heap_mirrorsets1, withLEONIDA_HEAP_MIRROR_CHECK=1.d3d12_console_heap_mirror_offsets0.d3d12_console_heap_mirror_default, with the variable unset.main's runtime, the new default checks in both tests fail.cteston llvmpipe: 112/112 pass.main:d3d12_console_heap_mirror_default, which passes.xmem_test, whichmainpassed twice. Reading the value once fixed that: two full runs since with no change.tests/test_docs_env_vars.py,tests/test_ci_registration.pyandscripts/check_no_game_data.pyon the changed files: pass.Not tested
main, which is equivalent.AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.