[PR #1878] RT-QUEUE31-CPU-SOURCE-ALIAS: preserve CPU-backed pages in batch remaps #1890

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1878
Author: @lixonik
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/queue31-cpu-source-alias


📝 Commits (1)

  • 5108a02 Resolve batch page-copy sources through their CPU aliases

📊 Changes

2 files changed (+17 additions, -6 deletions)

View changed files

📝 runtime/shims/xmem.cpp (+9 -6)
📝 runtime/test/xmem_test.cpp (+8 -0)

📄 Description

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.

🔄 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/1878 **Author:** [@lixonik](https://github.com/lixonik) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/queue31-cpu-source-alias` --- ### 📝 Commits (1) - [`5108a02`](https://github.com/ubiquitarianism/leonida/commit/5108a02e3a85fd1102219516b54a996c975675c4) Resolve batch page-copy sources through their CPU aliases ### 📊 Changes **2 files changed** (+17 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/xmem.cpp` (+9 -6) 📝 `runtime/test/xmem_test.cpp` (+8 -0) </details> ### 📄 Description Claimed in the coordination issue as: [RT-QUEUE31-CPU-SOURCE-ALIAS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164244324) ### 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1890
No description provided.