RT-QUEUE31-CPU-SOURCE-ALIAS: preserve CPU-backed pages in batch remaps #1878

Open
github-bot wants to merge 1 commit from github-bot/gh-1878 into main AGit
Owner

@⁠lixonik on GitHub · 2026-11-25 13:53 UTC · original
lixonik:fix/queue31-cpu-source-alias → main · +17 −6 · 2 files · 1 commits · open

Claimed in the coordination issue as: RT-QUEUE31-CPU-SOURCE-ALIAS

What and why

CopyPageMappingsBatchX looked up pool pages only at the GPU address. When a GPU-only source page was backed through its paired CPU view, the batch treated it as a hole. It could return success while leaving the destination unmapped. This is on the streaming path used during story load.

The batch and single-range copies now share the source lookup. It checks the direct mapping first and falls back to the paired CPU view for legacy paired ranges. An unmapped source with no CPU backing is still a hole.

Tested

  • Built the real xmem_test with MSVC, using the production xmem.cpp and registry. With the new regression and the old implementation, the batch returned success but the source bytes were missing at the destination. The full suite passed after the patch (482 checks) and with write watching disabled (462 checks).
  • The focused regression passed under both LEONIDA_SLOT31_RUNS=0 and =1. The full optional-mode run passed on retry (482 checks); earlier runs hit intermittent memory-accounting and concurrent-view assertions. Retail world load was not tested.
  • python -I -B scripts/run_semantic_tests.py tests/semantic passed 6,261 tests across 489 files.

GPUs tested: n/a (synthetic XMem tests)

AI-assisted.

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
**@⁠lixonik** on GitHub · 2026-11-25 13:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1878) `lixonik:fix/queue31-cpu-source-alias` → `main` · +17 −6 · 2 files · 1 commits · open Claimed in the coordination issue as: [RT-QUEUE31-CPU-SOURCE-ALIAS](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `CopyPageMappingsBatchX` looked up pool pages only at the GPU address. When a GPU-only source page was backed through its paired CPU view, the batch treated it as a hole. It could return success while leaving the destination unmapped. This is on the [streaming path used during story load](https://github.com/ubiquitarianism/leonida/blob/main/docs/linux_proton.md#where-it-stops). The batch and single-range copies now share the source lookup. It checks the direct mapping first and falls back to the paired CPU view for legacy paired ranges. An unmapped source with no CPU backing is still a hole. ### Tested - Built the real `xmem_test` with MSVC, using the production `xmem.cpp` and registry. With the new regression and the old implementation, the batch returned success but the source bytes were missing at the destination. The full suite passed after the patch (482 checks) and with write watching disabled (462 checks). - The focused regression passed under both `LEONIDA_SLOT31_RUNS=0` and `=1`. The full optional-mode run passed on retry (482 checks); earlier runs hit intermittent memory-accounting and concurrent-view assertions. Retail world load was not tested. - `python -I -B scripts/run_semantic_tests.py tests/semantic` passed 6,261 tests across 489 files. GPUs tested: n/a (synthetic XMem tests) AI-assisted. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:09:37 +00:00
Author
Owner

@⁠moffington on GitHub · 2026-11-25 15:17 UTC · original

Independently reviewed 9c6a3dc on Linux/Wine with clang-cl 23.1.3 and Windows SDK 10.0.26100.

  • All 8 focused XMem, CPU emulation, CLZERO and D3D12 placed-resource tests passed on both base and head.
  • Applying the new regression test alone to the base reproduced the missing destination mapping. The patched implementation passed with LEONIDA_SLOT31_RUNS=0 and =1.
  • The intermittent test_split_view_race failure reproduced once in five runs on both base and head, confirming it is not newly introduced by this PR.
  • With LEONIDA_XMEM_SEC_COMMIT=0, both revisions exhibited the same two Wine commit-visibility failures.
  • Combined locally with #826 (ffdb44446): clean merge and 8/8 focused tests passed.

Source review confirmed direct-mapping precedence, independent-page isolation and preservation of unmapped-hole behavior.

No actionable PR-introduced defects found. Native Windows and retail world loading were not tested.

Advisory approval.

**@⁠moffington** on GitHub · 2026-11-25 15:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1878#issuecomment-7166617300) Independently reviewed `9c6a3dc` on Linux/Wine with clang-cl 23.1.3 and Windows SDK 10.0.26100. - All 8 focused XMem, CPU emulation, CLZERO and D3D12 placed-resource tests passed on both base and head. - Applying the new regression test alone to the base reproduced the missing destination mapping. The patched implementation passed with `LEONIDA_SLOT31_RUNS=0` and `=1`. - The intermittent `test_split_view_race` failure reproduced once in five runs on both base and head, confirming it is not newly introduced by this PR. - With `LEONIDA_XMEM_SEC_COMMIT=0`, both revisions exhibited the same two Wine commit-visibility failures. - Combined locally with #826 (`ffdb44446`): clean merge and 8/8 focused tests passed. Source review confirmed direct-mapping precedence, independent-page isolation and preservation of unmapped-hole behavior. No actionable PR-introduced defects found. Native Windows and retail world loading were not tested. Advisory approval.
github-bot force-pushed github-bot/gh-1878 from 9c6a3dcb78 to 5108a02e3a 2026-11-26 20:19:43 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1878/head:github-bot/gh-1878'
git switch 'github-bot/gh-1878'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1878'
git switch 'github-bot/gh-1878'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1878'
git switch 'github-bot/gh-1878'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1878'
git switch 'main'
git merge --squash 'github-bot/gh-1878'
git switch 'main'
git merge --ff-only 'github-bot/gh-1878'
git switch 'main'
git merge 'github-bot/gh-1878'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.