Repository navigation
RT-STREAM-POOL-KEEP-VA-ALIASES: preserve live mappings when mirroring stream pools - #1920
Conversation
|
Native Windows/Intel verification of #1920 (7cb6962) together with #1926, on main b0f3d39 plus local integration fixes:
Combined integration, not an isolated A/B of this PR. No successful retail load or performance improvement claimed. The full existing_heap fixture still has a pre-existing first-render-target device-loss failure on this Intel setup, reproduced before these changes; the focused cases above were run separately. No game data included. AI-assisted with OpenAI Codex. |
7cb6962 to
c088fd5
Compare
|
Retail data for this path, from the RT-TITLE-WINDOW-RETIRE work (RTX 5080, NVIDIA 621.24, Windows 11, The bug, measured. 15-minute run with What bounding alone does. With extents bounded by the free span in both views (the same rule as this PR), overlaps and orphans went to 0, but a request whose bytes run past the free span gets a mapping shorter than itself: What held. Giving such a request one mapping over the request plus every window it reaches (each taken whole, in both views, the replaced windows retired after the next submission), and having That work is on |
DadaCap identified the short-mapping case in the review of PR ProjectLeonida#1920. Reuse and allocation now require full coverage, preserving both live aliases when a request spans a boundary.
c088fd5 to
d78b0e9
Compare
|
@DadaCap Thanks for measuring the overlaps and catching the short mapping. I rebased #1920 onto Please open On Windows 11 / MSVC with an RTX 5070 (610.88), all eight focused CTests passed, including the new synthetic seam cases and window write-back. The two portable tests also passed with GCC/UBSan. Vulkan validation layers were unavailable on this machine. AI-assisted. |
|
@lixonik thanks, will do. I'm porting the covering, retirement and write-back changes onto |
|
@lixonik the follow-up is open: #2465 ( |
|
Short A/B of this PR against main on one machine: same recipe, same pipeline cache folder, only the runtime executable changes (my recipe-diff tool reports exactly one difference). n=1 per side. One run per side, so this is not conclusive. Reading (marked):
Limits: one machine, one run per side, short recipe. AI-assisted (Claude Code, Claude Opus 5.5) |
|
Follow-up to my RUN above, with more runs on the same machine (RTX 4060 8 GB, NVIDIA 610.88, Windows 11, main ec91d69, same short recipe and same warm cache folder):
(*) read from that run's log at 19:05 and also recorded by my stop guard; the log was later removed by a disk cleanup on my side. Two later runs without #1920 also entered the world at 165 s. So the 30 s earlier world entry I reported for #1920 is within what this machine shows across runs, and I do not attribute it to the PR. The display stop is the same with and without #1920. n=1 per row; I have not repeated #1920 itself. AI-assisted (Claude Code, Claude Opus 5.5) |
…t still goes back (RT-TITLE-WINDOW-RETIRE) On top of #1920, which keeps stream-pool extents inside the free span in both views and makes TitleVaAliases::add_twin refuse an overlap. Other ranges still replace a window's ranges whole by design: a slot-133 buffer the title places over the window's pages, a BVH input's exact copy, an upload alias. The window was then left in title_windows and pool_spans, refreshed at every submission and charged to LEONIDA_TITLE_WINDOWS_MB, with nothing left to reach it. A retail run showed most of the windows' memory growth to be such orphans; the title released none of the windows' pages, so retiring a window with its pages never fired. A window no range answers from any more is retired after the next submission's refresh: the alias table's listener records removed ranges' copies, and the touched windows TitleVaAliases::answers_into finds unreached leave pool_spans and the budget at once. Its memory is freed only once nothing can still reach it. A command list resolves its root views when they are recorded (GraphicsCommandList:: address), so a list recorded before the retirement and executed, or executed again, after it still names the window; so does the copy of the lists a held batch (a Wait before its Signal) or the async worker keeps. Each backend CommandList, and each copy, now carries the epoch its recording began in (src/command_list_epochs.h); a retired window takes its ticket only once no list older than its retirement is alive and the replays in progress then have recorded their submissions, and is freed when that ticket has completed. Until then the copy stays a target of its pages' tracker, still refreshed, and what the GPU wrote in it goes back to the title's pages: with its submissions' write-back, and once more when it is freed. The second is needed because a list's ranges are noted when it is recorded, so a held batch's can go back, tagged with a later submission's ticket, before the batch has run. A retired copy goes back only where no live copy changed the bytes, and every copy is compared, 256 bytes at a time, with the title's bytes as they were before any copy went back: a copy that still held them used to overwrite another's result when it came later in the tracker. Tests: d3d12_title_window_orphans. A window a slot-133 buffer replaced is retired, its bytes returned and its memory freed. A writing batch held on a fence on another queue, recorded before the next submission's refresh retires its window, keeps the window alive past a completed submission, and once it has run and its list is reset, its 64 words reach the title's pages and the window is freed. Without the retirement the window stays (3 -> 3 windows); without the list epochs it is freed while the held batch still names it; without the last copy back 0 of 64 words arrive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
…over them, not a zero-size view (RT-TITLE-WINDOW-RETIRE) #1920 stops a new pool extent at the next mapping in either view and, in d78b0e9, refuses a mapping shorter than the request: such a request gets a zero-size view (loads 0, stores dropped). That keeps the views from reaching past their copies, which the first version of this fix did not, but a refusal is a regression for requests main served: a V# or a root view (64 KiB, kRootViewBytes) that crosses from one extent into the next, or starts inside one and ends past it. Stream-pool extents sit next to each other, so these are common. Retail runs (local, RTX 5080): our first version, which gave such requests a short mapping, crashed in the title in one run (m176); with one mapping over the request instead, runs m177-m179 ran without one. The crash's cause was not established. At #1920's two refusals of a request longer than what would serve it (the extent clipped by clip_title_pool_extent, or the mapping holding its first byte), resolve_pool_memory now tries, after #1920's reuse, cover_pool_request: one mapping over the request and every window it reaches, each whole, in both views (title_pool_cover). It is entered with the new TitleVaAliases::replace_twin, since add_twin refuses an overlap; the windows it replaces are retired at the next submission like any window nothing answers from (previous commit), and their bytes are not charged to the budget twice meanwhile. With a range in the way that is not a window (a slot-133 buffer, a geometry copy), or pages that are not readable, #1920's refusal stands. #1920's own refusal when the window cannot be made or entered is unchanged. TitleVaAliases::resolve and resolve_title_memory already ask again for a range that ends before the view (#1920); vsharp_address did not, so a V# whose base lies in a short range was refused without asking: it now asks resolve_title_memory first. Tests: #1920's pass unchanged (their seam cases cross a range that is not a window, which still gets a zero-size view). title_window_plan: the cover takes a window whole in both views, refuses a buffer in the way and past the cap, and replace_twin enters it where add_twin refuses. d3d12_title_window_orphans: a 64 KiB CBV across two extents' seam gets one 448 KiB mapping, a valid V# and the right words on the GPU, and the two extents are retired at the next submission; without the cover its V# base is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
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
title_va_alias_test,title_window_plan_testandtitle_window_plan_bounds_testpassed. The new overlap assertion failed against the original alias table.title_va_alias_testandtitle_window_plan_bounds_testpassed.python -I -B scripts/run_semantic_tests.py tests/semantic: 6,261 tests across 489 files, zero failures.GPUs tested: n/a (synthetic CPU tests)
AI-assisted.
Checklist
mainand merges cleanly.