You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D3D12.X: queue #31 (newer layout) is CopyPageMappingsBatchX – the retail title's streamed pages never reach its GPU views #1031
Queue method #31 of the newer layout (#29 of the older) is a page-mapping batch. The retail title uses it to map its streamed pages into GPU views. XCL stubs it, so tens of thousands of textures in GPU views read the wrong memory.
What the method is
CopyPageMappingsBatchX(count, batches, pool, pool_pages, flags):
a batch is 24 bytes: u64 destination, u32 range count, and a pointer to the ranges at +16;
a range is u32 kind, start, count;
kind 0: count pool pages from start; 1: pool page start at each of count destination pages; 2: unmapped; 3: left as it is;
pages are 64 KiB.
The layout comes from VIctory's crates/victory-gpu/src/queue.rs, which implements it. That file is GPL-3.0; I read it as a reference only and took no code. The decode below matches it on the retail title.
Measured
Retail title 1.0.2.1, main077ce40 plus a local decoder in the queue stub (not posted), RTX 4080, one world-loading run.
First call at 4.2 s.pool is one region of pool_pages 0x185c0 = 6,236 MB, the "TileHeap …/6236 MB" in the title's crash context. It is not a GPU view.
Every destination is in a GPU view (kernelx::mirrors), e.g. 0x1eb70950000, the GPU view of 0x1e570950000.
In the first 257 calls:
33,008 destination pages mapped, all kind 1 (one pool page each);
2,306 unmapped (kind 2);
no kind 0 or 3.
For 0 of those 33,008 pages is mirrors::source(destination) equal to pool + start × 64 KiB, the page the console maps there. title_textures reads these textures from the CPU view at the same offset instead. The run logged 32,768+ textures in GPU views.
So streamed world textures are read from memory the title never meant for them. This may be part of the black or wrong world (#878, #781). I don't claim it causes the #505 stall.
Plan, to avoid duplicate work
Three PRs, stacked:
kernelx: a per-page map for GPU views, fed by the queue method (decoded with bounds checks against count and pool_pages), and mirrors answering per page. Unit tests; textures unchanged, logging only.
title_textures: read and watch a texture in a GPU view page by page through that map, gathering its pages into the upload. Re-upload when a page's mapping changes (gpu_view_map_gen).
Unmapped pages read as zeros.
Is anyone already on this method? And is a page map read by title_textures the model you'd want here, rather than real aliasing of the pages (placeholders)?
AI use: Claude Code (Claude Opus 5.5) read VIctory's description, wrote the local decoder, ran the title on my machine and wrote this.
Correction to the measurement above: the stub is wrong for part of the pages, not all of them.
My "0 of 33,008" compared addresses, not pages:
XCL keeps each physical page at one address at a time (kernelx, move_away).
The title maps each streamed page into the pool, and most of them into the CPU view behind the GPU view too.
XCL then moves the page to the CPU view, so the GPU view's identity mirror (mirrors::source) can be the right page after all.
I followed the page itself this time. A local tracker (not in #1055) records the page last placed at each pool address and where XCL keeps that page now. Retail title, main67a3735 + #1055, RTX 4080, 256 calls, 34,872 mapped GPU-view pages:
the pool page's physical page is now…
pages
at the CPU view's same offset: the identity mirror reads the right page
19,808
still at the pool address: the CPU view's same offset is not committed
15,064
somewhere else, or never placed
0
So about 43% of the mapped pages are read wrong, and what XCL reads for them is not committed: those parts of the textures go up as zeros. For one-run textures, the pool page holds data in 1,094 of 2,183 cases where the identity read finds nothing. That would fit "black after loading" (#878), though I have not shown that link.
What changes in the plan.#1055 will record the physical page that each GPU-view page shows, not the pool address, so the next PR can read wherever XCL keeps that page. I'm updating #1055 and its description.
AI use: Claude Code (Claude Opus 5.5) wrote the tracker, ran the title on my machine and wrote this.
A second machine's census, plus what the issue does not cover yet: the buffers that translated shaders read in the GPU view. Short version: the batches look the same here (same-offset wrong for 56 – 59 % of mapped pages at 100 s), but buffer and root views in the GPU view are almost all right by same offset when the world starts and only drift later, so for them the first problem is #697 (the GPU view is outside the memory windows), not the stub.
Run: release, XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250, warm caches. Local switches: the title's own stall watchdog is neutralised; compute programs of 4 MB of DXIL or more are not handed to the driver. Windows TdrDelay 30 s. Two runs of the retail title: one stopped at 106 s, one ran to 203 s. The world starts at 88 – 94 s and then presents 1.3 – 1.5 frames per second.
pages by kind: one pool page / unmapped / consecutive / left
57 750 / 11 398 / 0 / 0
55 501 / 9 847 / 0 / 0
GPU-view pages mapped now
46 358
45 659
same offset right / wrong
18 798 / 27 560 (59 %)
19 907 / 25 752 (56 %)
Every destination is in the GPU view of the title's largest reservation. The pool is one separate 64 KiB-page reservation (pool_pages 0x185c0, as above); here it is outside every unified-memory window too.
Of the 27 560 wrong pages in run 1, XCL still keeps the physical page at the pool address for 26 556 and in a unified-memory window for 1 004; 26 218 of the wrong pages have committed bytes at their source.
Over time (run 1): 26 % wrong at 60 s, 54 % at 90 s, 59 % at 100 s. At 200 s (run 2, 958 calls): 21 419 right / 24 423 wrong, with 21 390 pages unmapped.
2. Readers other than textures (not covered by #1102, which resolves pages in title_textures only)
Every buffer view the title creates (whole-resource SRV / UAV) and every root view address it binds, checked page by page against the recorded map:
views with pages in the GPU view
at 100 s (run 1)
at 100 s (run 2)
at 200 s (run 2)
compute root views (distinct addresses)
3 700: 3 699 right, 0 wrong, 1 unmapped
2 314: 2 312 right, 0 wrong, 2 unmapped
12 918: 12 472 right, 119 wrong, 327 unmapped
graphics root views
–
–
82: 66 right, 13 wrong, 3 unmapped
buffer SRVs / UAVs
6 / 6, all right
4 / 4, all right
8 / 8: 6 right, 1 wrong, 1 unmapped each
So when the world starts, same offset would give these views the right page; a per-page map starts to matter for them a minute or two later. What they read today is zeros for another reason: the GPU view is outside the windows, so translated shaders see nothing there whatever the mapping says (#697). A fix for #697 that makes GPU-view addresses reachable would need to resolve them through #1055's map rather than by same offset, or it will be right at first and then wrong for a growing share.
One caveat on "right": I did not count how many of the right pages have committed bytes in XCL. One address I probed was right by same offset in run 2 but its CPU-view page had never been touched (no bytes anywhere in XCL), and in run 1 the same address was a wrong page with data at the pool address.
Two groups are never destinations of a batch in either run: the 125 SRVs / 127 UAVs in the title's third 64 KiB-page reservation (the GPU-written buffers of #697), and the root views outside both the windows and the GPU view (7 171 addresses in run 1).
Not tested: #1102 (textures) itself; whether resolving through the map changes the picture; AMD; current main. The second run lost the device (0x887a0005) at 203.6 s as every long run does here, with or without #1803; nothing in this census ties that to the batches.
AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the port, the census logging and the runs) did this and drafted the comment.
Plan, before any code: real aliasing of physical pages (one page, every address it is mapped at), as an answer to the question above. Taking it on unless someone already is or you'd rather not go that way.
Why. XCL keeps a physical page at one address at a time and copies it when the title maps it elsewhere (kernelx::move_away). The console shows the page at every address it is mapped at. Xeltax's census above, done by page, has 15,064 of 34,872 GPU-view pages still at their pool address while the identity mirror reads the CPU view, and #1055 records the right page without anything reading it. Each copy-based reader (textures #1102, buffer views on #697) has to redo the lookup, and stays stale when the title writes through another view.
Measured feasibility (a standalone test program, not XCL; RTX 5090 machine, Ryzen 9 7950X, Windows 11 26200):
Physical pages as 64 KiB slices of one pagefile-backed SEC_RESERVE section, each committed once. A page mapped into a placeholder at two addresses is the same memory: a write at one reads back at the other.
Write-watched ordinary memory can replace part of a placeholder (VirtualAlloc2 with MEM_REPLACE_PLACEHOLDER | MEM_WRITE_WATCH), so a sparse window can hold both. GetWriteWatch refuses a range that contains views (error 87), so the watch scans the write-watched reservations, not the whole window.
Per 64 KiB page: map 2.2 µs, unmap 2.75 µs, commit 0.9 µs, VirtualProtect 0.5 µs, over 200 000 pages (no copy; today's remap copies 64 KiB).
Protection is per view, so CPU writes to a view can be caught by a guard (as kernelx::lazy does for first use) and marked dirty on the page, for all its views.
Split (each its own PR, stacked, under ~400 lines; behind XCL_PAGE_ALIAS=1 until the last):
Preparation, no change in behaviour: physical pages get a section and a page → section offset table; a helper for placeholder reservations. Unit tests.
kernelx: with the switch, mapping a page maps the section's slice at the address (no move_away, no copy); unmapping keeps the placeholder. The title's 64 KiB-page reservations become placeholders. Tests: a write through one mapping reads back at the others, remap, unmap, free.
sparse: one video-memory tile per physical page, and every address of the page in a window maps that tile (UpdateTileMappings to the same heap tile), so the GPU sees the aliases too and a page is uploaded once.
Dirty tracking by page for views in the windows: a guard on each view, the first write marks the page dirty for all its views; DirectStorage and kernel reads into pages mark it too.
Room for both 24 GB views in the windows (heap windows, more sparse windows than today's 3), then the switch on by default, with smoke runs and in-world numbers.
Parts 1–3 already make the GPU view read the right pages on the CPU, and part 3 has title_textures read a texture in a GPU view at its own address instead of through mirrors::source; 4–6 are what buffer and root views in the GPU view (#697) need. I'll post numbers from in-world runs on an RTX 5090 with each part.
AI use: Claude Code (Claude Opus 5.5) wrote the feasibility test and this plan; I checked it.
Activity
Xeltax commentedon Nov 24, 2026
Correction to the measurement above: the stub is wrong for part of the pages, not all of them.
My "0 of 33,008" compared addresses, not pages:
kernelx,move_away).mirrors::source) can be the right page after all.I followed the page itself this time. A local tracker (not in #1055) records the page last placed at each pool address and where XCL keeps that page now. Retail title,
main67a3735+ #1055, RTX 4080, 256 calls, 34,872 mapped GPU-view pages:So about 43% of the mapped pages are read wrong, and what XCL reads for them is not committed: those parts of the textures go up as zeros. For one-run textures, the pool page holds data in 1,094 of 2,183 cases where the identity read finds nothing. That would fit "black after loading" (#878), though I have not shown that link.
What changes in the plan. #1055 will record the physical page that each GPU-view page shows, not the pool address, so the next PR can read wherever XCL keeps that page. I'm updating #1055 and its description.
AI use: Claude Code (Claude Opus 5.5) wrote the tracker, ran the title on my machine and wrote this.
kernelx: a mapped GPU-view page shows the physical page, where XCL ke…
kernelx: queue CopyPageMappingsBatchX records the physical page each …
D3D12.X: a texture in a GPU view reads the pages the page-mapping met…
kernelx: page mappings reach GPU views; a held release keeps its memory
CharlyRien commentedon Nov 25, 2026
A second machine's census, plus what the issue does not cover yet: the buffers that translated shaders read in the GPU view. Short version: the batches look the same here (same-offset wrong for 56 – 59 % of mapped pages at 100 s), but buffer and root views in the GPU view are almost all right by same offset when the world starts and only drift later, so for them the first problem is #697 (the GPU view is outside the memory windows), not the stub.
Setup
main9e3831emerged locally with kernelx: Sleep does not count the time a bind waits for a pipeline build #1288, Recompiler: compact cases share code whose branch targets differ #1448, XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684, D3D12.X: compute pipelines are built ahead of their first bind #889, D3D12.X: XCL_GPU_CULPRIT names the dispatches a stalled queue has not done #1323, D3D12.X: newer list layout #139 Reset goes through title_list::reset #929, D3D12.X: an optional page budget evicts CPU-filled title textures LRU #640, D3D12.X: prepare for the unified memory copy path #1326, Tests: skip predication_e2e when the host runs predicated copies #1327, D3D12.X: the committed window gets a copy in video memory #1329; on top, by hand and uncommitted: D3D12.X: an ExecuteIndirect reads the arguments written before it #1791, a local equivalent of DirectStorage: read a physical-page list again when its request runs #1405, D3D12.X: shaders that index the heaps themselves get the heaps' addresses #1803, the decode-and-record part of kernelx: queue CopyPageMappingsBatchX records the physical page each GPU-view page shows #1055 (its lines, plus the older layout's slot 29 routed to it), a localtitle_texturesfix (described on DirectStorage: read a physical-page list again when its request runs #1405), a local readback change insparse.rs(one fence per title queue, see D3D12.X: the committed window gets a copy in video memory #1329), local DXC compile-time switches, and local logging. The census itself is local logging keyed on kernelx: queue CopyPageMappingsBatchX records the physical page each GPU-view page shows #1055's map: per destination page, where XCL keeps the named physical page now, and whether that is the CPU view's same offset.XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250, warm caches. Local switches: the title's own stall watchdog is neutralised; compute programs of 4 MB of DXIL or more are not handed to the driver. WindowsTdrDelay30 s. Two runs of the retail title: one stopped at 106 s, one ran to 203 s. The world starts at 88 – 94 s and then presents 1.3 – 1.5 frames per second.1. Same shape as measured above
pool_pages 0x185c0, as above); here it is outside every unified-memory window too.2. Readers other than textures (not covered by #1102, which resolves pages in
title_texturesonly)Every buffer view the title creates (whole-resource SRV / UAV) and every root view address it binds, checked page by page against the recorded map:
So when the world starts, same offset would give these views the right page; a per-page map starts to matter for them a minute or two later. What they read today is zeros for another reason: the GPU view is outside the windows, so translated shaders see nothing there whatever the mapping says (#697). A fix for #697 that makes GPU-view addresses reachable would need to resolve them through #1055's map rather than by same offset, or it will be right at first and then wrong for a growing share.
One caveat on "right": I did not count how many of the right pages have committed bytes in XCL. One address I probed was right by same offset in run 2 but its CPU-view page had never been touched (no bytes anywhere in XCL), and in run 1 the same address was a wrong page with data at the pool address.
Two groups are never destinations of a batch in either run: the 125 SRVs / 127 UAVs in the title's third 64 KiB-page reservation (the GPU-written buffers of #697), and the root views outside both the windows and the GPU view (7 171 addresses in run 1).
3. For the rebase of #1055
mainthe hunk that no longer applies is theVirtualFreeone inkernelx.rs(the code UMA: support 8/16 heap windows (5/13 coherent) with 3-sparse (12 GiB) cap #1998 changed).Not tested: #1102 (textures) itself; whether resolving through the map changes the picture; AMD; current
main. The second run lost the device (0x887a0005) at 203.6 s as every long run does here, with or without #1803; nothing in this census ties that to the batches.AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the port, the census logging and the runs) did this and drafted the comment.
adiologydev commentedon Nov 25, 2026
Plan, before any code: real aliasing of physical pages (one page, every address it is mapped at), as an answer to the question above. Taking it on unless someone already is or you'd rather not go that way.
Why. XCL keeps a physical page at one address at a time and copies it when the title maps it elsewhere (
kernelx::move_away). The console shows the page at every address it is mapped at. Xeltax's census above, done by page, has 15,064 of 34,872 GPU-view pages still at their pool address while the identity mirror reads the CPU view, and #1055 records the right page without anything reading it. Each copy-based reader (textures #1102, buffer views on #697) has to redo the lookup, and stays stale when the title writes through another view.Measured feasibility (a standalone test program, not XCL; RTX 5090 machine, Ryzen 9 7950X, Windows 11 26200):
SEC_RESERVEsection, each committed once. A page mapped into a placeholder at two addresses is the same memory: a write at one reads back at the other.VirtualAlloc2withMEM_REPLACE_PLACEHOLDER | MEM_WRITE_WATCH), so a sparse window can hold both.GetWriteWatchrefuses a range that contains views (error 87), so the watch scans the write-watched reservations, not the whole window.VirtualProtect0.5 µs, over 200 000 pages (no copy; today's remap copies 64 KiB).kernelx::lazydoes for first use) and marked dirty on the page, for all its views.Split (each its own PR, stacked, under ~400 lines; behind
XCL_PAGE_ALIAS=1until the last):kernelx: with the switch, mapping a page maps the section's slice at the address (nomove_away, no copy); unmapping keeps the placeholder. The title's 64 KiB-page reservations become placeholders. Tests: a write through one mapping reads back at the others, remap, unmap, free.CopyPageMappingsBatchXapplies its batches with the same mapping, on kernelx: queue CopyPageMappingsBatchX records the physical page each GPU-view page shows #1055's decoder (I'll build on kernelx: queue CopyPageMappingsBatchX records the physical page each GPU-view page shows #1055 rather than redo it), kind 1 (one pool page repeated) included.sparse: one video-memory tile per physical page, and every address of the page in a window maps that tile (UpdateTileMappingsto the same heap tile), so the GPU sees the aliases too and a page is uploaded once.Parts 1–3 already make the GPU view read the right pages on the CPU, and part 3 has
title_texturesread a texture in a GPU view at its own address instead of throughmirrors::source; 4–6 are what buffer and root views in the GPU view (#697) need. I'll post numbers from in-world runs on an RTX 5090 with each part.AI use: Claude Code (Claude Opus 5.5) wrote the feasibility test and this plan; I checked it.