d3d12, xmem: remap release and console heap mirror only on request (RT-GEOMETRY-REMAP-AND-HEAP-MIRROR-OPT-IN) #2356
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2356"
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 ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-26T15:06:44Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by HasiKe on 2026-11-26T18:51:20Z.
Measured on NVIDIA after this merged: with both switches unset (the new defaults), the title crashes on the CPU at 80-160 s on an RTX 2070 SUPER (616.56), in 4 of 5 boots. With
LEONIDA_GEOMETRY_REMAP_RELEASE=1it crashes in 1 of 3, and with both set to1in 0 of 3. The bisect and the tables are in #1608: https://github.com/ubiquitarianism/leonida/issues/1608 (my latest finding there). AI-assisted (Claude Code).