Repository navigation
Conversation
…addresses On the console a physical page mapped at several addresses is one page. XCL keeps a page at one address at a time and copies it when the title maps it elsewhere (`move_away`), so the other addresses go stale; a retail title maps its streamed pages into a pool, into the CPU view of a 24 GB reservation and into that reservation's GPU view (xcl-dev#1031). `kernelx::sections` is the base for real aliasing: a block of physical pages is one pagefile-backed SEC_RESERVE section, and a page is mapped as a view of its 64 KiB slice into a placeholder (MapViewOfFile3 with MEM_REPLACE_PLACEHOLDER). Every view of a slice is the same memory and a page takes commit once, when it is committed through any view. Unmapping leaves a placeholder for the next view. Ordinary reserved memory (write-watched if asked) can replace part of a placeholder and go back to one. Nothing calls it yet. Measured in a standalone program on Windows 11 26200 over 200 000 pages: map 2.2 us, unmap 2.75 us, commit 0.9 us a page. GetWriteWatch refuses a range that holds a view (error 87), and one call cannot span two neighbouring reservations either.
The upload of title memory to video memory (`d3d12x::sparse`) and the textures kept in step with title memory learn what the CPU wrote from the write watch, and a view of a section (`kernelx::sections`) cannot be write-watched: GetWriteWatch refuses any range that holds one. `kernelx::guards` keeps the views of a physical page read-only. The first write through any of them faults; a vectored handler makes that view writable, notes the page and lets the write go on. `take_dirty` hands over the pages of every view of each page written – a write through one view is a write to all of them – and guards those views again before their bytes are read, so a later write is caught again and an earlier one is in what is read. Kernel calls do not fault into the handler, they fail: `lazy::ensure`, which XCL already calls before a kernel call or its own code writes title memory, opens the guards there first and counts the write. A view committed by the lazy handler is writable and counts as written. Both take no lock until a view has been watched. Nothing watches a view yet.
… fault A guarded view of a physical page (`kernelx::guards`) is read-only until it is written. Code of XCL's own that writes there faults into the guard and goes on, but a kernel call does not fault: ReadFile into such a view fails. `lazy::ensure` opened the views first, yet the submit thread's `take_dirty` could guard them again before the write – between DirectStorage's check of its destination and the copy, or before the kernel wrote a ReadFile buffer. `guards::open` now returns `Opened`, which keeps its views writable until it is dropped; `take_dirty` uploads a pinned view but does not guard it again, and the end of the write counts as a write. `lazy::ensure` returns it and its callers hold it across their write: the routed ReadFile for a synchronous read, and the destination checks of DirectStorage and the CPU-side bottom-of-pipe writes. An overlapped ReadFile writes after the call returns: its views stay open until its OVERLAPPED is no longer STATUS_PENDING, which `take_dirty` reads without faulting (the title may free it once done). A retail title reads 271 MB that way into the CPU view of its 24 GB reservation 8.5 s after start. `guards::written` counts a page as written through all its views when XCL writes it by page number. Nothing watches a view yet, so nothing changes without views.
…s mapped at Without it XCL keeps a physical page at one address at a time and copies it when the title maps it elsewhere; the console shows the page at every address it is mapped at. A retail title maps its streamed pages into a pool, into the CPU view of a 24 GB reservation and into that reservation's GPU view (xcl-dev#1031). With `XCL_PAGE_ALIAS=1` (`kernelx::alias`): - a block of physical pages is a section (`kernelx::sections`) with a view of its own, through which XCL reads and writes pages by number (DirectStorage); the title never maps a page there; - the title's reservations of 64 KiB pages with no commit (its CPU view, GPU view and pool) are placeholders, and a page mapped there is a view of its slice, guarded (`kernelx::guards`) so that a write through one view is uploaded at all of them; `title_textures` adds those pages to what the write watch found; - a page mapped anywhere else (a placeholder region the title made in a sparse window) is moved there and back with its bytes, as before. Pages are committed on first use as before (`kernelx::lazy`); whether a page is committed is a bit per page: asking Windows walked the rest of a fresh block, and a title mapping 100 000 new pages one at a time took 20 s longer to its first frame. Measured in a traced run of a retail title: 3 blocks (11 360, 2 960 and 99 776 pages), 131 072 map calls in 150 s, nearly all single pages into its plain reservations, none at a page's home, no commit inside them.
…lias-null-scatter
The alias path must forward a null page array as an unmap, as the conventional path does after xcl-dev#495. Advancing the null pointer makes the second entry look like an array at address 0x8. Test a two-entry scatter unmap, surviving aliases, swapped remapping, and release through the section-backed path from xcl-dev#2307. Assisted-by: Codex (model version not exposed)
|
Retail world test of #3074 + #3075 with Setup
Results
Caveats
|
|
@bmjask mind reviewing this when you get a chance? We've got independent retail validation now, with noticeable rendering and stability improvements. |
The queue's CopyPageMappingsBatchX maps pool pages into GPU views; on the console a GPU-view page then shows the physical page mapped at its pool page at the time of the call. xcl-dev#1055 decodes the calls and keeps a record of them; with physical pages aliasing (`kernelx::alias`) the GPU view is a reservation of views, so the decoded mappings are made for real: each GPU-view page becomes a view of the physical page mapped at its pool page now, or is unmapped (kind 2, or nothing mapped at the pool page). Textures in the GPU view then read the page at their own address (`title_textures` prefers an address with a physical page mapped), and a write through any view of the page is uploaded at all of them. Without the switch nothing changes: the call is recorded as in xcl-dev#1055. (cherry picked from commit 64ad64c) Lab port: fitted onto the follow-ups of xcl-dev#3074/xcl-dev#3075, which this commit's parent (xcl-dev#2307) did not have: apply_page_mappings holds the mapping lock for the call and passes it to map_one (now a Result), with the pool page looked up under it; a pool page whose view outlived its freed page counts as an empty pool page instead of ending the call midway (test added). The textures on the mapped pages are named to title_textures through the lab's per-page changed list (mirrors::note_changed, after the pages are in place) instead of upstream's note_gpu_view_mapping, which bumps the generation and has every texture's source read again: the title's calls come by the hundred. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… stand down, and the log says which is at work Lab port of the upstream alias stack (xcl-dev#2293, xcl-dev#2294, xcl-dev#2307, xcl-dev#2308, xcl-dev#3074, xcl-dev#3075). The lab's two stopgaps for a physical page at more than one address keep the page at ONE address and move it (bring_page / bring_range, XCL_PAGE_BRING) or its video memory (sparse::share_page, XCL_PAGE_SHARE=1). With real aliases a page is at every address the title mapped it at, outside the sparse windows, and an address it is not at was unmapped by the title: both stand down when XCL_PAGE_ALIAS=1. With the switch not set they are as they were. One line at start-up (the first time the switch is asked) names which of the three is at work; with aliases, a line at the first view and at each power of two from 1024 on says how many pages are shown at how many addresses and how many of them at more than one (guards::view_counts). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Triage note: this no longer merges with current Why I am asking rather than just noting it: we have run fifteen mergeable candidates on the retail title on an RTX 5070 Ti, and every one still stops presenting at 50–80 s (device removed, surfacing ~88 s later on the next allocation). The PRs whose descriptions actually match that symptom are the ones that no longer apply — this is one of them. A rebase would make it testable again, and we will run it and report the numbers. If it has been superseded by merged work, saying so is enough and it can be closed. AI use: an agent posted this triage note. |
|
Stacked on #2307 (section-backed physical page aliases, still open); only the top commit AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head 785d7dc, diff read, not a merge-check; conflicts with main,
Fine: the fix itself ( AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
Stacked on #2307, which carries #2293 and #2294 by @adiologydev. Review the final commit,
785d7dc5533edc8577c9a8e8e221acd40d980d23, against the clean integration parent3878609d850826fa51813477ffa7482081fb2383. The prerequisite commits are the original upstream commits. Focused diffOn
main, #495 by @notdxbi treats a nullXMemMapPhysicalPagesScatterarray as an unmap for each address. Integrating #2307 onto current main preserves the legacy branch's null handling, but the section-backed branch still advances the null pointer. Starting at the second entry,map_aliasedtries to read a page number at address0x8. An archived retail crash with matching PDBs resolves tomap_aliased <- XMemMapPhysicalPagesScatter.What is in it
map_aliasedpath already interprets it as an unmap.Tested
Windows 11 build 26200, Ryzen 7 8845HS, 16 GiB RAM, NVIDIA RTX 4060 Laptop GPU 8 GiB, driver
32.0.16.1656, Rust1.98.1MSVC.On
785d7dc5533edc8577c9a8e8e221acd40d980d23withXCL_PAGE_ALIAS=1, the focused filters for kernelx alias, sections and guards, DirectStorage physical pages, and concurrent-decommit texture reads gave 23 passed, 0 failed, 0 ignored, 0 capability skips.The existing byte-exact GPU mirror upload fixture passed in conventional mode. Alias mode fails its write-watch setup assertion before readback, matching the prior Windows report on the prerequisite. Prerequisite test report
After building the test-title fixtures with
cargo build --workspace,cargo test --workspace --no-fail-fast -- --test-threads=4exited 0. The harness reported 1,486 pass statuses, 0 failures, and 47 ignored. It emitted 27 explicit skip notices separately (21 missing wave64, 3 unsupported per-lane forms, 1 Developer Mode requirement, 1 missing heap-window capability, and 1 default-mode skip of the new opt-in test, which passed separately).Regression run
The clean release builds are main
6089122a1c96dff16e93b6fdf04c8ed20cfb6102and candidate785d7dc5533edc8577c9a8e8e221acd40d980d23. No fresh smoke block was generated. The clean Series S preflight expired at 3205 MiB free RAM and 13200 MiB free commit. The guarded runner requires 6,600 MiB RAM and 18,000 MiB free commit at startup. The last idle check still showed 4129 MiB RAM and 13941 MiB free commit. Series X was deferred.Historical evidence from a different integration, using the same executable in both Series S modes, reached 4,200 DirectStorage requests and 262 MiB with zero storage errors in both. System commit growth was 9,426 MiB in conventional mode and 1,985 MiB with section aliasing, a difference of 7,441 MiB. Both runs later crashed. The conventional crash was a texture read during concurrent decommit. The alias crash was the null scatter path covered here. This historical measurement belongs to the alias architecture and accompanying integration.
Not tested
AI use
Codex (GPT-6 family, exact runtime variant unavailable) recovered and compared the patches, wrote the follow-up and regression test, ran local validation, and drafted this description.