mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #2065] Cache repeated title VA alias lookups (RT-TITLE-VA-POSITIVE-LOOKUP-CACHE) #2073
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2073
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2065
Author: @alexandersato0830
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:codex/title-va-positive-cache📝 Commits (1)
83e9133Cache repeated title VA alias lookups per thread📊 Changes
2 files changed (+87 additions, -15 deletions)
View changed files
📝
runtime/src/title_va_alias.h(+41 -15)📝
runtime/test/title_va_alias_test.cpp(+46 -0)📄 Description
Claimed in the coordination issue as: RT-TITLE-VA-POSITIVE-LOOKUP-CACHE
Depends on: #1699 (overlapping test include hunk; the runtime change applies independently).
What and why
Repeated lookups in one title VA range acquire a shared lock and search the map each time. Cache one positive mapping per thread after two uncached lookups in the same range. A cache hit checks range bounds, the table's invalidation counter and its instance identity. Other requests still query the live map. Original finding
The draft records the lookup tradeoff so it can be evaluated with runtime traces. The retail lookup mix and frame-time impact remain unmeasured.
Tested
490f5b9plus this patch. All ten targeted CTests passed, includingtitle_va_alias,d3d12_title_va, shadow and geometry views, the window cap, and descriptor copy and table rebound on/off paths. The new regression checks range bounds, deletion, replacement across threads, and reuse of the same storage for a new table. Removing either guard made the test fail./O2. One executable compared the original and patched header, interleaving five timed samples per case. Each sample made five passes over 524,288 precomputed inputs. The tests used 32, 1,024 and 4,096 64 KiB ranges. Hot queries moved to a new range every 1,000 lookups, and mixed queries replaced every fifth lookup with a uniformly random one. The random controls included all mapped addresses and 50% addresses in gaps.shader_vaandrange_of, the median hot lookups took 66–77% less time and the mixed lookups 34–39% less time. Random cases took 1.6–10.5% more time, an increase of 1.2–2.3 ns per query in this run. Most of the relative penalty occurred at 32 ranges. The benchmark compared returned addresses on the same input stream.git diff --checkand the source-only check.GPUs tested: NVIDIA RTX 4080, driver 621.01, Windows 11.
AI-assisted: yes.
main.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.