Skip to content

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

Open
lixonik wants to merge 1 commit into
ProjectLeonida:mainfrom
lixonik:fix/queue31-cpu-source-alias
Open

lixonik wants to merge 1 commit into
ProjectLeonida:mainfrom
lixonik:fix/queue31-cpu-source-alias

Conversation

@lixonik

@lixonik lixonik commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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.

@moffington

Copy link
Copy Markdown
Contributor

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 cpu: handle reserved XMem backing during CLZERO emulation #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-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 26, 2026
@lixonik
lixonik force-pushed the fix/queue31-cpu-source-alias branch from 9c6a3dc to 5108a02 Compare November 26, 2026 20:15
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants