[PR #2370] [MERGED] d3d12, xmem: remove remap release and the console heap mirror (RT-REMOVE-REMAP-RELEASE-AND-HEAP-MIRROR) #2372

Closed
opened 2026-11-26 21:21:01 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2370
Author: @aslan2142
Created: 11/26/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142

Base: main ← Head: remove-remap-release-and-heap-mirror


📝 Commits (1)

  • b0767fd d3d12, xmem: remove remap release and the console heap mirror

📊 Changes

15 files changed (+32 additions, -796 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+6 -20)
📝 runtime/CMakeLists.txt (+0 -22)
📝 runtime/README.md (+0 -3)
📝 runtime/shims/d3d12_com.h (+0 -4)
📝 runtime/shims/d3d12_compute_input_probe.h (+3 -3)
📝 runtime/shims/d3d12_geometry_views.h (+4 -4)
📝 runtime/shims/d3d12_vulkan_device.cpp (+13 -91)
📝 runtime/shims/xmem.cpp (+0 -64)
📝 runtime/shims/xmem.h (+0 -2)
➖ runtime/src/console_heap_copy.h (+0 -98)
📝 runtime/src/title_geometry_watch.h (+1 -1)
➖ runtime/test/console_heap_copy_test.cpp (+0 -168)
➖ runtime/test/d3d12_console_heap_mirror_test.cpp (+0 -216)
📝 runtime/test/geometry_views_test.cpp (+5 -5)
📝 runtime/test/xmem_test.cpp (+0 -95)

📄 Description

Removes two features that came in with #2350 and were made opt-in by #2356 after they broke world runs.

Claimed in the coordination issue as: RT-REMOVE-REMAP-RELEASE-AND-HEAP-MIRROR

Both were additions on top of stopgap mechanisms, not fixes of the mechanisms themselves:

  • Remap release (LEONIDA_GEOMETRY_REMAP_RELEASE): retired geometry copies when the title remapped physical pages. With it on, a world run on the RX 7900 XTX ended in a GPUVM page fault and a lost device (#2356).
  • Console heap mirror (LEONIDA_HEAP_MIRROR, LEONIDA_HEAP_MIRROR_CHECK): a host-RAM mirror of a console resource heap's copy for the release sweep. With it on, a world run hung the GPU (#2356).

With both variables unset, main behaves as it did before this change.

Removed

  • xmem.cpp: RemapReleases, remap_releases_enabled(), the page recording in unmap_range_locked and its four call sites.
  • xmem.h: the test seam rt::xmem::reload_remap_release_setting().
  • xmem_test: test_remap_releases.
  • src/console_heap_copy.h: ConsoleHeap::copy is a plain std::uint8_t* again, written with memcpy/memset. That includes the zeroing site that #2350's merge of #2162 resolved as heap.copy.zero().
  • d3d12_vulkan_device.cpp: heap_mirror_enabled(), heap_mirror_check_enabled(), check_console_heap_mirror(), the check counters and their log line.
  • d3d12_com.h: the test API console_heap_mirror_mismatches().
  • Tests console_heap_copy, d3d12_console_heap_mirror, d3d12_console_heap_mirror_off and d3d12_console_heap_mirror_default, with their CMake entries.
  • The three runtime/README.md rows and the paragraphs in docs/d3d12_vulkan.md.

Kept

  • LEONIDA_GEOMETRY_HOST (geometry copies in system memory, opt-in) and its memory-type assert.
  • The final copy of a retired geometry view (retire_range's final_copy, copied at retirement in the geometry buffers line). An XMemFree of a title heap block reports a release while its memory stays readable, so this copy is still made without remap release. Its comments no longer mention remaps.
  • forget_pool_span and retired with their copy. Every retirement (free, decommit, unmap) still feeds them.
  • The release queue's joining of touching ranges (title_geometry_watch.h). Unmaps report page runs too.
  • LEONIDA_CONSOLE_RELEASE_FILTER. It predates the mirror, and its sweep reads the copy again.
  • Log formats are unchanged except for the removed LEONIDA_HEAP_MIRROR_CHECK lines.

Not addressed here

The root problems behind both features need proper designs. This change does not touch them:

  • Geometry copies are made per view and kept in VRAM.
  • Descriptor heaps are fixed again by a sweep instead of by tracking each slot's writes.

Tests

  • Linux runtime build and ctest on the Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO, Mesa 26.3.1): 111/111 pass. console_heap_copy is gone.
  • Windows suite (clang-cl + xwin cross-build) under Wine on the same iGPU and driver, compared with main 246791612: 418 pass now, 422 before. The difference is the four removed tests. No other test changed state, and xmem and geometry_views pass.
  • tests/test_ci_registration.py, test_ctest_registration.py, test_docs_env_vars.py, the other test_docs_* and CMake list tests, test_text_write_line_endings.py, compileall and check_no_game_data.py on the changed files all pass.
  • A search of the tree finds no remaining variable or helper names.

World runs

RX 7900 XTX, RADV (Mesa 26.3.1), Wine, the settings of the Linux section in docs/running.md:

Build Result
This branch (b0767fd65) Reached the world with no evictions and no GPU page fault, and took 1,900 compute pipelines from the journal. It ended in a graphics-ring timeout 366 s into the run. The breadcrumbs show all three queues idle. The cause is not known
This branch plus #2222, #2359, #2142 and #2163 merged locally 666 s with no stall, no page fault and no ring timeout. It stopped at the title's own breakpoint, where main with both features off also stops
  • One run each, so the two results do not show whether the hang is intermittent or whether one of the four PRs avoids it.
  • main with both variables unset is the same configuration as this branch, and it reached the title's breakpoint in an earlier run.

Not tested

  • No MSVC build. CI covers it.
  • llvmpipe was not run under Wine.

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.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2370 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/26/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `remove-remap-release-and-heap-mirror` --- ### 📝 Commits (1) - [`b0767fd`](https://github.com/ubiquitarianism/leonida/commit/b0767fd6574e5ec7af617e27c87a3401176154b8) d3d12, xmem: remove remap release and the console heap mirror ### 📊 Changes **15 files changed** (+32 additions, -796 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+6 -20) 📝 `runtime/CMakeLists.txt` (+0 -22) 📝 `runtime/README.md` (+0 -3) 📝 `runtime/shims/d3d12_com.h` (+0 -4) 📝 `runtime/shims/d3d12_compute_input_probe.h` (+3 -3) 📝 `runtime/shims/d3d12_geometry_views.h` (+4 -4) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+13 -91) 📝 `runtime/shims/xmem.cpp` (+0 -64) 📝 `runtime/shims/xmem.h` (+0 -2) ➖ `runtime/src/console_heap_copy.h` (+0 -98) 📝 `runtime/src/title_geometry_watch.h` (+1 -1) ➖ `runtime/test/console_heap_copy_test.cpp` (+0 -168) ➖ `runtime/test/d3d12_console_heap_mirror_test.cpp` (+0 -216) 📝 `runtime/test/geometry_views_test.cpp` (+5 -5) 📝 `runtime/test/xmem_test.cpp` (+0 -95) </details> ### 📄 Description Removes two features that came in with #2350 and were made opt-in by #2356 after they broke world runs. Claimed in the coordination issue as: [RT-REMOVE-REMAP-RELEASE-AND-HEAP-MIRROR](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197386652) Both were additions on top of stopgap mechanisms, not fixes of the mechanisms themselves: - **Remap release** (`LEONIDA_GEOMETRY_REMAP_RELEASE`): retired geometry copies when the title remapped physical pages. With it on, a world run on the RX 7900 XTX ended in a GPUVM page fault and a lost device (#2356). - **Console heap mirror** (`LEONIDA_HEAP_MIRROR`, `LEONIDA_HEAP_MIRROR_CHECK`): a host-RAM mirror of a console resource heap's copy for the release sweep. With it on, a world run hung the GPU (#2356). With both variables unset, `main` behaves as it did before this change. ## Removed - `xmem.cpp`: `RemapReleases`, `remap_releases_enabled()`, the page recording in `unmap_range_locked` and its four call sites. - `xmem.h`: the test seam `rt::xmem::reload_remap_release_setting()`. - `xmem_test`: `test_remap_releases`. - `src/console_heap_copy.h`: `ConsoleHeap::copy` is a plain `std::uint8_t*` again, written with `memcpy`/`memset`. That includes the zeroing site that #2350's merge of #2162 resolved as `heap.copy.zero()`. - `d3d12_vulkan_device.cpp`: `heap_mirror_enabled()`, `heap_mirror_check_enabled()`, `check_console_heap_mirror()`, the check counters and their log line. - `d3d12_com.h`: the test API `console_heap_mirror_mismatches()`. - Tests `console_heap_copy`, `d3d12_console_heap_mirror`, `d3d12_console_heap_mirror_off` and `d3d12_console_heap_mirror_default`, with their CMake entries. - The three `runtime/README.md` rows and the paragraphs in `docs/d3d12_vulkan.md`. ## Kept - `LEONIDA_GEOMETRY_HOST` (geometry copies in system memory, opt-in) and its memory-type assert. - The final copy of a retired geometry view (`retire_range`'s `final_copy`, `copied at retirement` in the `geometry buffers` line). An `XMemFree` of a title heap block reports a release while its memory stays readable, so this copy is still made without remap release. Its comments no longer mention remaps. - `forget_pool_span` and `retired with their copy`. Every retirement (free, decommit, unmap) still feeds them. - The release queue's joining of touching ranges (`title_geometry_watch.h`). Unmaps report page runs too. - `LEONIDA_CONSOLE_RELEASE_FILTER`. It predates the mirror, and its sweep reads the copy again. - Log formats are unchanged except for the removed `LEONIDA_HEAP_MIRROR_CHECK` lines. ## Not addressed here The root problems behind both features need proper designs. This change does not touch them: - Geometry copies are made per view and kept in VRAM. - Descriptor heaps are fixed again by a sweep instead of by tracking each slot's writes. ## Tests - Linux runtime build and `ctest` on the Ryzen 9 7950X3D iGPU (RADV RAPHAEL_MENDOCINO, Mesa 26.3.1): 111/111 pass. `console_heap_copy` is gone. - Windows suite (clang-cl + xwin cross-build) under Wine on the same iGPU and driver, compared with `main` `246791612`: 418 pass now, 422 before. The difference is the four removed tests. No other test changed state, and `xmem` and `geometry_views` pass. - `tests/test_ci_registration.py`, `test_ctest_registration.py`, `test_docs_env_vars.py`, the other `test_docs_*` and CMake list tests, `test_text_write_line_endings.py`, `compileall` and `check_no_game_data.py` on the changed files all pass. - A search of the tree finds no remaining variable or helper names. ## World runs RX 7900 XTX, RADV (Mesa 26.3.1), Wine, the settings of the Linux section in `docs/running.md`: | Build | Result | | --- | --- | | This branch (`b0767fd65`) | Reached the world with no evictions and no GPU page fault, and took 1,900 compute pipelines from the journal. It ended in a graphics-ring timeout 366 s into the run. The breadcrumbs show all three queues idle. The cause is not known | | This branch plus #2222, #2359, #2142 and #2163 merged locally | 666 s with no stall, no page fault and no ring timeout. It stopped at the title's own breakpoint, where `main` with both features off also stops | - One run each, so the two results do not show whether the hang is intermittent or whether one of the four PRs avoids it. - `main` with both variables unset is the same configuration as this branch, and it reached the title's breakpoint in an earlier run. ## Not tested - No MSVC build. CI covers it. - llvmpipe was not run under Wine. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:21:01 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#2372
No description provided.