[PR #1920] RT-STREAM-POOL-KEEP-VA-ALIASES: preserve live mappings when mirroring stream pools #1928

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

📋 Pull Request Information

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

Base: main ← Head: fix/stream-pool-keep-va-aliases


📝 Commits (1)

  • c088fd5 Keep live VA mappings when mirroring a stream pool

📊 Changes

5 files changed (+156 additions, -54 deletions)

View changed files

📝 runtime/shims/d3d12_vulkan_device.cpp (+34 -51)
📝 runtime/src/title_va_alias.h (+63 -3)
📝 runtime/src/title_window_plan.h (+13 -0)
📝 runtime/test/title_va_alias_test.cpp (+36 -0)
📝 runtime/test/title_window_plan_bounds_test.cpp (+10 -0)

📄 Description

Claimed in the coordination issue as: RT-STREAM-POOL-KEEP-VA-ALIASES

What and why

A stream-pool extent was checked for an existing mapping at its first byte. A live mapping could start later on either side of the pair. Publishing the entire extent then evicted that mapping, even if the new request only needed the free area before it. The runtime now limits new extents to the intersection of the CPU and GPU gaps. Registration checks both sides under one lock and publishes the pair together. Reusing the other view's mapping also stops at the next live range.

If a competing mapping appears while the copy is allocated, that mapping takes precedence. The unused backing follows the device's existing allocation lifetime.

This is on the stream-pool path reported during world start. The effect on a retail boot has not been measured.

Tested

  • MSVC on Windows: title_va_alias_test, title_window_plan_test and title_window_plan_bounds_test passed. The new overlap assertion failed against the original alias table.
  • GCC with UBSan on Linux/WSL: title_va_alias_test and title_window_plan_bounds_test passed.
  • A synthetic harness compiled the actual pool resolver body with mocked allocation and memory queries. The original path allocated 1 MiB and displaced a live neighboring alias. The fixed path used the free 64 KiB and preserved it. A mapping arriving during allocation survived without a partial pair being published.
  • python -I -B scripts/run_semantic_tests.py tests/semantic: 6,261 tests across 489 files, zero failures.
  • Full Windows/Vulkan shim build and retail boot were not run.

GPUs tested: n/a (synthetic CPU 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/1920 **Author:** [@lixonik](https://github.com/lixonik) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/stream-pool-keep-va-aliases` --- ### 📝 Commits (1) - [`c088fd5`](https://github.com/ubiquitarianism/leonida/commit/c088fd567f8c5f8d8a3303611b307e74a26f4579) Keep live VA mappings when mirroring a stream pool ### 📊 Changes **5 files changed** (+156 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+34 -51) 📝 `runtime/src/title_va_alias.h` (+63 -3) 📝 `runtime/src/title_window_plan.h` (+13 -0) 📝 `runtime/test/title_va_alias_test.cpp` (+36 -0) 📝 `runtime/test/title_window_plan_bounds_test.cpp` (+10 -0) </details> ### 📄 Description Claimed in the coordination issue as: [RT-STREAM-POOL-KEEP-VA-ALIASES](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167255312) ### What and why A stream-pool extent was checked for an existing mapping at its first byte. A live mapping could start later on either side of the pair. Publishing the entire extent then evicted that mapping, even if the new request only needed the free area before it. The runtime now limits new extents to the intersection of the CPU and GPU gaps. Registration checks both sides under one lock and publishes the pair together. Reusing the other view's mapping also stops at the next live range. If a competing mapping appears while the copy is allocated, that mapping takes precedence. The unused backing follows the device's existing allocation lifetime. This is on the [stream-pool path reported during world start](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7165609001). The effect on a retail boot has not been measured. ### Tested - MSVC on Windows: `title_va_alias_test`, `title_window_plan_test` and `title_window_plan_bounds_test` passed. The new overlap assertion failed against the original alias table. - GCC with UBSan on Linux/WSL: `title_va_alias_test` and `title_window_plan_bounds_test` passed. - A synthetic harness compiled the actual pool resolver body with mocked allocation and memory queries. The original path allocated 1 MiB and displaced a live neighboring alias. The fixed path used the free 64 KiB and preserved it. A mapping arriving during allocation survived without a partial pair being published. - `python -I -B scripts/run_semantic_tests.py tests/semantic`: 6,261 tests across 489 files, zero failures. - Full Windows/Vulkan shim build and retail boot were not run. GPUs tested: n/a (synthetic CPU 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#1928
No description provided.