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

Manually merged
github merged 1 commit from gh-pr/2370/head into gh-pr/2370/base 2026-11-26 16:17:40 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-26 16:15 UTC · original
aslan2142:remove-remap-release-and-heap-mirror → main · +32 −796 · 15 files · 1 commits · merged 2026-11-26 16:15 UTC

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).

**@⁠aslan2142** on GitHub · 2026-11-26 16:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2370) `aslan2142:remove-remap-release-and-heap-mirror` → `main` · +32 −796 · 15 files · 1 commits · merged 2026-11-26 16:15 UTC 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) 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).
Both came in with #2350 as additions on top of stopgap mechanisms, broke world runs (remap release: a GPUVM page
fault and a lost device; the mirror: a GPU hang) and were made opt-in by #2356. They go completely; with both
variables unset, main behaves as before.

Remap release (LEONIDA_GEOMETRY_REMAP_RELEASE, from 36771ec53):
- xmem.cpp: RemapReleases, remap_releases_enabled() and the page recording in unmap_range_locked; the four call
  sites (XMemMapPhysicalPages, the scatter call, both copy_page_mappings).
- xmem.h/xmem.cpp: the test seam rt::xmem::reload_remap_release_setting().
- xmem_test: test_remap_releases (and the title_geometry_watch.h include only it used).
- README row, the docs/d3d12_vulkan.md paragraph; comments that named it.

Console heap mirror (LEONIDA_HEAP_MIRROR, LEONIDA_HEAP_MIRROR_CHECK, from 746059011):
- src/console_heap_copy.h goes. ConsoleHeap::copy is a plain std::uint8_t* again, written with memcpy/memset as
  before the mirror, including the zeroing site that #2350's merge of #2162 resolved as heap.copy.zero(); the
  compute-input probe reads it directly again. Without the mirror, view() was the copy itself, so nothing changes.
- heap_mirror_enabled(), heap_mirror_check_enabled(), check_console_heap_mirror(), the per-heap check counters and
  log line, and the test API console_heap_mirror_mismatches() (d3d12_com.h).
- Tests console_heap_copy, d3d12_console_heap_mirror, _off and _default with their CMake entries; README rows and
  the docs/d3d12_vulkan.md sentences.

Kept, because other paths use them or main's behaviour with the variable unset depends on them:
- LEONIDA_GEOMETRY_HOST and its DeviceState memory-type assert (dc9ef1a0b).
- The final copy at retirement (GeometryViews::retire_range's final_copy, "copied at retirement" in the geometry
  buffers line): XMemFree of a title heap block (free_title_block) reports a release while the block's memory stays
  committed and readable, so that copy is still made without remap release. Comments now say that instead of
  naming remaps; geometry_views_test case 15 stays.
- forget_pool_span and "retired with their copy" in the title memory line: any retirement (free, decommit, unmap)
  feeds it.
- The release queue's joining of touching ranges (title_geometry_watch.h): unmaps report page runs too;
  geometry_views_test case 16 stays.
- LEONIDA_CONSOLE_RELEASE_FILTER, which predates the mirror; its sweep reads the copy again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:17:39 +00:00
github manually merged commit b0767fd657 into gh-pr/2370/base 2026-11-26 16:17:40 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 16:15 UTC · original

Merging. This is a self-merge.

  • Why now: the two features came in with #2350 and broke world runs (GPU page fault; GPU hang). #2356 only turned them off. This removes the code, so the fixes of the mechanisms themselves start from a clean base.
  • Tested on main 246791612 + this PR (b0767fd65):
    • Linux runtime ctest: 111/111 pass.
    • Windows suite under Wine: 418 pass against 422 on main. The difference is the four removed tests; no other test changed state.
    • World runs on the RX 7900 XTX (RADV): see the table in the description. One run from this build ended in a ring timeout of unknown cause at 366 s; a second, with four open PRs on top, ran 666 s to the title's own breakpoint.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

**@⁠aslan2142** on GitHub · 2026-11-26 16:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2370#issuecomment-7197399730) Merging. This is a self-merge. - **Why now:** the two features came in with #2350 and broke world runs (GPU page fault; GPU hang). #2356 only turned them off. This removes the code, so the fixes of the mechanisms themselves start from a clean base. - **Tested on `main` `246791612` + this PR** (`b0767fd65`): - Linux runtime `ctest`: 111/111 pass. - Windows suite under Wine: 418 pass against 422 on `main`. The difference is the four removed tests; no other test changed state. - World runs on the RX 7900 XTX (RADV): see the table in the description. One run from this build ended in a ring timeout of unknown cause at 366 s; a second, with four open PRs on top, ran 666 s to the title's own breakpoint. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)
This discussion has been locked. Commenting is limited to contributors.
No description provided.