Memory: more than 4 memory windows once #680 lands, so title memory stops falling back to plain memory #697

Open
opened 2026-11-26 04:29:51 +00:00 by github-bot · 12 comments
Owner

@⁠Daazd on GitHub · 2026-11-24 03:37 UTC · original

Plan for comment before any code (CONTRIBUTING "Say what you are doing"). Stacked on #680.

The limit. Translated shaders reach 4 windows of 4 GiB (xcl_w = (hi) & 3u, emit.rs:1536); the title gets 11.5 GiB of sparse space. A retail title reserves more GPU-visible memory than that (kernelx.rs:322: a 24 GB reservation of 64 KiB pages, 2.2 GB of large pages), and the rest goes to plain memory outside every window. There its buffer views are empty V#s (real.rs:1751), vertex / index buffers are mirrored and copied every draw, up to 2 GiB of mirrors and stale after that (list_x.rs:1799-1866), and a raw pointer in a shader reads whichever window hi & 3 names.

Why now. With #680 a window is a descriptor index instead of a switch case, so a fifth or sixteenth window costs a shader nothing. What's left are constants: MAX_WINDOWS, the & 3u mask and the 4 heap slots.

Proposal. N windows (power of two, e.g. 16 → 64 GiB) in the heap form only: N · 4 GiB aligned to N · 4 GiB and below 2^40 (#585), windows 0..N-2 sparse and N-1 coherent as now, xcl_w = hi & (N-1) with N in Options and the cache key. The root-UAV switch form keeps 4.

Before any code: measurement. On the retail title (RTX 4070 Ti SUPER): bytes reserved and committed in plain GPU-visible memory, empty V#s, mirror MB and per-draw copy bytes. If little GPU traffic lands there, I'll report that and stop. Open risks: VRAM for pages that are plain today, write-watch and upload cost over more window memory, and whether out-of-range pointers should get an empty view instead of aliasing (a hi - base_hi index).

PR split (each stacked on #680, under ~400 lines): (1) window count as a value, no behaviour change; (2) N-window layout behind XCL_UMA_WINDOWS=n, with layout and GPU tests at window ≥ 4; (3) on by default, with smoke runs; (4) counters in report.json.

Does this fit where you want memory to go, or would you rather the windows stay at 4?

AI use: researched and drafted with Claude Code (Claude Opus 5.5); checked by me.

**@⁠Daazd** on GitHub · 2026-11-24 03:37 UTC · [original](https://github.com/xcl-dev/xcl/issues/697) Plan for comment before any code (CONTRIBUTING "Say what you are doing"). Stacked on #680. **The limit.** Translated shaders reach 4 windows of 4 GiB (`xcl_w = (hi) & 3u`, `emit.rs:1536`); the title gets 11.5 GiB of sparse space. A retail title reserves more GPU-visible memory than that (`kernelx.rs:322`: a 24 GB reservation of 64 KiB pages, 2.2 GB of large pages), and the rest goes to plain memory outside every window. There its buffer views are empty V#s (`real.rs:1751`), vertex / index buffers are mirrored and copied every draw, up to 2 GiB of mirrors and stale after that (`list_x.rs:1799-1866`), and a raw pointer in a shader reads whichever window `hi & 3` names. **Why now.** With #680 a window is a descriptor index instead of a switch case, so a fifth or sixteenth window costs a shader nothing. What's left are constants: `MAX_WINDOWS`, the `& 3u` mask and the 4 heap slots. **Proposal.** N windows (power of two, e.g. 16 → 64 GiB) in the heap form only: N · 4 GiB aligned to N · 4 GiB and below 2^40 (#585), windows `0..N-2` sparse and `N-1` coherent as now, `xcl_w = hi & (N-1)` with N in `Options` and the cache key. The root-UAV switch form keeps 4. **Before any code: measurement.** On the retail title (RTX 4070 Ti SUPER): bytes reserved and committed in plain GPU-visible memory, empty V#s, mirror MB and per-draw copy bytes. If little GPU traffic lands there, I'll report that and stop. Open risks: VRAM for pages that are plain today, write-watch and upload cost over more window memory, and whether out-of-range pointers should get an empty view instead of aliasing (a `hi - base_hi` index). **PR split** (each stacked on #680, under ~400 lines): (1) window count as a value, no behaviour change; (2) N-window layout behind `XCL_UMA_WINDOWS=n`, with layout and GPU tests at window ≥ 4; (3) on by default, with smoke runs; (4) counters in `report.json`. Does this fit where you want memory to go, or would you rather the windows stay at 4? AI use: researched and drafted with Claude Code (Claude Opus 5.5); checked by me.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:29:51 +00:00
Author
Owner

@⁠maximecmb on GitHub · 2026-11-24 10:20 UTC · original

Data point for this plan: the retail title's empty buffer views all sit in its 24 GB GPU-view reservation, and wider windows alone don't reach it, because that reservation never goes to the windows

Setup: RTX 5080 16 GB (driver 617.42, 32-lane waves), Ryzen 7 9800X3D, 64 GB, Windows 11 26300, Rust 1.100.0 MSVC, release builds, retail 1.0.2.1, XCL_NETWORK=0, XCL_ACTIVITY=1, hand-driven into the world load.

1. Where the empty V#s are. #956 counts the views that get an empty V# and the resources unified memory had no room for. A local addition on top of it logs each empty buffer view's title address and size:

  • 125 buffer SRVs and 129 UAVs get an empty V#, all created at ~9–10 s in the menus. 4 + 8 more come during the world load. There are 0 no-room events.
  • Of the first 128, all 128 are in a graphics reservation outside the windows, and 0 are at any other title address. They include buffers of 50 MB, 26 MB, several of 5.9 MB, 2.7 MB and 1.8 MB.
  • That reservation is the 24 GB pair the kernelx::mirrors comment describes: kernelx: reservation 0x2eaa80c0000 (0x600000000 bytes, no CPU access) is the GPU view of 0x2e4a80c0000. With #631 on main it now lands lower (the buffers are at ~0x43a6e0000), but it's still outside the windows.

2. Why more windows don't change it. The pair is reserved as 64 KiB physical pages (MEM_LARGE_PAGES | MEM_PHYSICAL), not with MEM_GRAPHICS. So kernelx::VirtualAlloc never offers it to sparse_reserve / reserve: it goes straight to gpu_visible_fallback → reserve_watched, which is plain write-watched memory recorded in GRAPHICS_RESERVATIONS. That happens with any window count.

I checked this with a local stack of main 6efdabc + #680 (its three current commits) + #822's two commits. I rebased them: in emit.rs I kept main's hi - xcl_uma_base window index with its range check, and in shaders.rs I took #822's window-count block. On top of that I added #956 and the address log, and ran with XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16:

  • UMA: 15 sparse VRAM window(s) (60 GiB VA) + 4095 MB coherent window at 0x1000000000, yet the empty views are unchanged: 125 SRV / 129 UAV, all still "in a graphics reservation outside the windows".
  • #505's stop is unchanged too: first #101 at 61.2 s, presents 0 from ~60 s (one burst at 66 s), +0x23cf683 at 96.3 s.
  • #822's placed_title_textures fallback test now finds its reserve-only allocation inside the windows. So MEM_GRAPHICS reservations do move in with 16 windows; this one doesn't.

So for this title, the plan here only reaches those buffers if the 64 KiB-page pair is also placed in the windows, and the GPU view stays tied to the CPU view's pages the way mirrors::source ties them for textures.

3. Why this looks worth it. A separate GTA VI–only project, which hands any title buffer to the host GPU by copying it on first use, keeps this title presenting the world for ~100 s on the same machine, at 1–3.5 fps with 1 100–2 770 draws per frame (its own missing shaders keep the picture dark). Under XCL the frames stop ~2 s into the world. That project has no equivalent of these empty views. That's a correlation, not proof: I haven't tested a build where the pair is reachable.

Ruled out on this machine, each by a run:

  • unified memory running out (#956: 0 no-room events)
  • shader writes into the sparse windows that the CPU never sees: a local opt-in that, after title submissions, merges every mapped sparse tile back into CPU memory (64-byte chunks the GPU changed and the CPU didn't) took 0 KB in every logged merge, and the stop was unchanged
  • more windows alone (above)

Not tested: placing the 64 KiB-page pair in the windows; AMD; Linux.

AI use: Claude Code (Claude Opus 5.5) wrote the local diagnostics and the experiment builds, read the logs and wrote this comment. I ran the title on the hardware above.

**@⁠maximecmb** on GitHub · 2026-11-24 10:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7128653720) **Data point for this plan: the retail title's empty buffer views all sit in its 24 GB GPU-view reservation, and wider windows alone don't reach it, because that reservation never goes to the windows** **Setup:** RTX 5080 16 GB (driver 617.42, 32-lane waves), Ryzen 7 9800X3D, 64 GB, Windows 11 26300, Rust 1.100.0 MSVC, release builds, retail 1.0.2.1, `XCL_NETWORK=0`, `XCL_ACTIVITY=1`, hand-driven into the world load. **1. Where the empty V#s are.** #956 counts the views that get an empty V# and the resources unified memory had no room for. A local addition on top of it logs each empty buffer view's title address and size: - 125 buffer SRVs and 129 UAVs get an empty V#, all created at ~9–10 s in the menus. 4 + 8 more come during the world load. There are 0 no-room events. - Of the first 128, **all 128** are in a graphics reservation outside the windows, and 0 are at any other title address. They include buffers of 50 MB, 26 MB, several of 5.9 MB, 2.7 MB and 1.8 MB. - That reservation is the 24 GB pair the `kernelx::mirrors` comment describes: `kernelx: reservation 0x2eaa80c0000 (0x600000000 bytes, no CPU access) is the GPU view of 0x2e4a80c0000`. With #631 on `main` it now lands lower (the buffers are at ~`0x43a6e0000`), but it's still outside the windows. **2. Why more windows don't change it.** The pair is reserved as 64 KiB physical pages (`MEM_LARGE_PAGES | MEM_PHYSICAL`), not with `MEM_GRAPHICS`. So `kernelx::VirtualAlloc` never offers it to `sparse_reserve` / `reserve`: it goes straight to `gpu_visible_fallback` → `reserve_watched`, which is plain write-watched memory recorded in `GRAPHICS_RESERVATIONS`. That happens with any window count. I checked this with a local stack of `main` `6efdabc` + #680 (its three current commits) + #822's two commits. I rebased them: in `emit.rs` I kept `main`'s `hi - xcl_uma_base` window index with its range check, and in `shaders.rs` I took #822's window-count block. On top of that I added #956 and the address log, and ran with `XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16`: - `UMA: 15 sparse VRAM window(s) (60 GiB VA) + 4095 MB coherent window at 0x1000000000`, yet the empty views are unchanged: 125 SRV / 129 UAV, all still "in a graphics reservation outside the windows". - #505's stop is unchanged too: first `#101` at 61.2 s, presents 0 from ~60 s (one burst at 66 s), `+0x23cf683` at 96.3 s. - #822's `placed_title_textures` fallback test now finds its reserve-only allocation inside the windows. So `MEM_GRAPHICS` reservations do move in with 16 windows; this one doesn't. So for this title, the plan here only reaches those buffers if the 64 KiB-page pair is also placed in the windows, and the GPU view stays tied to the CPU view's pages the way `mirrors::source` ties them for textures. **3. Why this looks worth it.** A separate GTA VI–only project, which hands any title buffer to the host GPU by copying it on first use, keeps this title presenting the world for ~100 s on the same machine, at 1–3.5 fps with 1 100–2 770 draws per frame (its own missing shaders keep the picture dark). Under XCL the frames stop ~2 s into the world. That project has no equivalent of these empty views. That's a correlation, not proof: I haven't tested a build where the pair is reachable. **Ruled out on this machine**, each by a run: - unified memory running out (#956: 0 no-room events) - shader writes into the sparse windows that the CPU never sees: a local opt-in that, after title submissions, merges every mapped sparse tile back into CPU memory (64-byte chunks the GPU changed and the CPU didn't) took 0 KB in every logged merge, and the stop was unchanged - more windows alone (above) **Not tested:** placing the 64 KiB-page pair in the windows; AMD; Linux. AI use: Claude Code (Claude Opus 5.5) wrote the local diagnostics and the experiment builds, read the logs and wrote this comment. I ran the title on the hardware above.
Author
Owner

@⁠Daazd on GitHub · 2026-11-24 16:07 UTC · original

Thanks @⁠maximecmb, this changes the plan.

Window count: #822 already covers it (XCL_UMA_WINDOWS=8/16, stacked on #680), so I'm dropping my local window-count change and won't open a duplicate PR. What's left of this issue is the 24 GB GPU-view pair.

One correction from reading main (b7aa9f3): kernelx::VirtualAlloc does try the windows for 64 KiB-page reservations. The MEM_64K_PAGES branch calls uma.sparse_reserve(size) before gpu_visible_fallback. The pair only falls back because sparse_reserve finds no 24 GB gap. So this is a space-and-pairing problem rather than a missing route.

Proposed fix: put the CPU view in the windows, and point buffer views at it, instead of aliasing the GPU view.

  1. The CPU view goes in the windows, still paired. The 24 GB PAGE_READWRITE view, which is the one the title maps physical pages into, gets reserved in the sparse windows. That needs #822's 16-window layout for the room. mirrors::reserved is then also called from the MEM_64K_PAGES sparse branch, not only after reserve_watched. Today, if the CPU view lands in the windows, it is never recorded, so its GPU view is never paired and title_textures loses the CPU view behind it (the Bink green screen would come back). The GPU view (PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS) stays where it is. It's never touched by the CPU, so it needs no window space.
  2. Buffer views in a GPU view are rebased to the CPU view. In dev_create_cbv_x and the SRV/UAV paths that currently write an empty V# (note_buffer_view), when va lies in a GPU view, the V# base becomes mirrors::source(va). That address is then in unified memory, so the shader reads the same pages the CPU writes. The check is the same as title_textures::mirror_source: if the title mapped a physical page at va itself (physical_page_at), va is kept. No second mapping and no syncing between the two views is needed, because the shader just reads the CPU view's address.
  3. Pass/fail: with #956, the 125 SRV / 129 UAV empty buffer views drop to 0 (or the log names any that are left), the Bink video still plays, and we see whether #505's stop moves.

Limits of this approach:

  • It only fixes addresses that go through a descriptor. If the title hands a shader a raw GPU-view address some other way (in a constant buffer, say), that read still misses. Then the real fix is the alias: the GPU view as a second mapping of the CPU view's pages in the windows (placeholders + section views). That costs more and needs the CPU view to be backed by a section.
  • It needs #822 (or the windows from #680 + #822) for 24 GB of room.

Questions:

  • @⁠ivall: is descriptor-time rebasing acceptable here, or do you want the alias from the start? Should this be its own issue, or stay under #697?
  • @⁠maximecmb: in your 16-window run, did the kernelx: reservation … is the GPU view of … line still appear? If the CPU view moved into the windows there, the pairing is lost, and that could hide a Bink regression in that setup. Also, does your address log show any reads of the GPU view that don't go through a V#?

AI use: Claude Code (Claude Opus 5.5) read the code on main and the referenced PRs and drafted this reply. Nothing here is tested yet.

**@⁠Daazd** on GitHub · 2026-11-24 16:07 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7137158297) Thanks @⁠maximecmb, this changes the plan. **Window count:** #822 already covers it (`XCL_UMA_WINDOWS=8/16`, stacked on #680), so I'm dropping my local window-count change and won't open a duplicate PR. What's left of this issue is the 24 GB GPU-view pair. One correction from reading `main` (`b7aa9f3`): `kernelx::VirtualAlloc` does try the windows for 64 KiB-page reservations. The `MEM_64K_PAGES` branch calls `uma.sparse_reserve(size)` before `gpu_visible_fallback`. The pair only falls back because `sparse_reserve` finds no 24 GB gap. So this is a space-and-pairing problem rather than a missing route. **Proposed fix: put the CPU view in the windows, and point buffer views at it, instead of aliasing the GPU view.** 1. **The CPU view goes in the windows, still paired.** The 24 GB `PAGE_READWRITE` view, which is the one the title maps physical pages into, gets reserved in the sparse windows. That needs #822's 16-window layout for the room. `mirrors::reserved` is then also called from the `MEM_64K_PAGES` sparse branch, not only after `reserve_watched`. Today, if the CPU view lands in the windows, it is never recorded, so its GPU view is never paired and `title_textures` loses the CPU view behind it (the Bink green screen would come back). The GPU view (`PAGE_NOACCESS | PAGE_GRAPHICS_NOACCESS`) stays where it is. It's never touched by the CPU, so it needs no window space. 2. **Buffer views in a GPU view are rebased to the CPU view.** In `dev_create_cbv_x` and the SRV/UAV paths that currently write an empty V# (`note_buffer_view`), when `va` lies in a GPU view, the V# base becomes `mirrors::source(va)`. That address is then in unified memory, so the shader reads the same pages the CPU writes. The check is the same as `title_textures::mirror_source`: if the title mapped a physical page at `va` itself (`physical_page_at`), `va` is kept. No second mapping and no syncing between the two views is needed, because the shader just reads the CPU view's address. 3. **Pass/fail:** with #956, the 125 SRV / 129 UAV empty buffer views drop to 0 (or the log names any that are left), the Bink video still plays, and we see whether #505's stop moves. **Limits of this approach:** - It only fixes addresses that go through a descriptor. If the title hands a shader a raw GPU-view address some other way (in a constant buffer, say), that read still misses. Then the real fix is the alias: the GPU view as a second mapping of the CPU view's pages in the windows (placeholders + section views). That costs more and needs the CPU view to be backed by a section. - It needs #822 (or the windows from #680 + #822) for 24 GB of room. Questions: - @⁠ivall: is descriptor-time rebasing acceptable here, or do you want the alias from the start? Should this be its own issue, or stay under #697? - @⁠maximecmb: in your 16-window run, did the `kernelx: reservation … is the GPU view of …` line still appear? If the CPU view moved into the windows there, the pairing is lost, and that could hide a Bink regression in that setup. Also, does your address log show any reads of the GPU view that don't go through a V#? AI use: Claude Code (Claude Opus 5.5) read the code on `main` and the referenced PRs and drafted this reply. Nothing here is tested yet.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 05:20 UTC · original

Data for the plan above, and an answer to "any reads of the GPU view that don't go through an empty V#?": yes, most of them. In a dump of the title's view heap taken when the world starts, 65 % of the buffer V#s are non-empty and carry a GPU-view address as their base. They come from the "view of memory at an address" device methods (#70 / #71), which write the title's address as it is, so the empty-V# count misses them, and step 2 as written would too.

Setup

  • Tree: main 9e3831e merged locally with #1288, #1448, #684, #889, #1323, #929, #640, #1326, #1327, #1329; on top, by hand and uncommitted: #1791, a local equivalent of #1405, #1803, a local readback change in sparse.rs (one fence per title queue, see #1329), and local logging / dump code. Four memory windows on this tree (0x4_0000_0000 – 0x7_ffff_0000).
  • Run: release, XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250, warm caches; the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver; TdrDelay 30 s. One run of the retail title, one frame dumped shortly after the world starts (GPU-side copy of the heap, read back before a compute dispatch).
  • RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB RAM + 32 GB page file, Windows 11 22631.

1. The first 32 768 slots of the title's view heap in that frame

what the slot holds slots
image descriptor 15 680
buffer V# whose base is in the GPU view of the 24 GB pair (high word 0x12: 10 764, 0x13: 23, 0xe: 43), outside every window 10 830
buffer V# in a window 5 763
all zero (an empty V# or never written; the two look the same) 476
degenerate (base or size 0) 19

So of 16 593 non-empty buffer V#s, 10 830 point into the GPU view. None point into the title's other 64 KiB-page reservations. On this tree dev_create_srv_at_x / dev_create_uav_at_x (device #70 / #71) write buffer_words_at(va, …) with the title's address unchanged, which is where these come from; note_buffer_view's empty V# is a different path.

2. Root views (from a second pair of runs, same tree plus #1055's map, written up on #1031): 3 700 distinct compute root-view addresses in the GPU view in the first seconds of the world, 12 918 by 200 s. Rebasing those to the CPU view's same offset is right for all but one at 100 s and wrong for 119 at 200 s, so mirrors::source is a good first answer and #1055's per-page map is needed after that.

3. Two readers that take a V# out of the view heap by index and end up with zeros (the heap address comes in the register after their root arguments, #1803):

  • the title's GPU-driven culling: its compute programs get real per-group records and write nothing. Replayed offline from a capture, the first guard they fail is a zero count read through a heap slot named by the record. In the title about 280 of 300 indirect draws of a frame then have an instance count of 0, and the main depth target stays at its clear value. This is the flat grey world.
  • the two-pass mesh programs (#724 / #2092): with the registers right, every record is still (1 vertex, 1 primitive), which is what a zero meshlet entry gives. In the binds I logged (another run, the tree of my #724 comments) the index constant is 0, and slots 0 – 9 of the heap are all zero in this dump.

For both, the registers and the translation were checked. What I have not captured is the content of the exact slots the culling records name (they are past the part of the heap I dumped), so "those are GPU-view V#s" is inferred from the 65 %, not read; and for the mesh case the slot is a zero one, which could be an empty V# or a slot XCL never wrote.

For the plan: placing the CPU view in the windows and rebasing would need to cover the by-address view methods and root views, not only the empty-V# path; and since two thirds of the title's buffer views are of this kind, I would expect it to change the picture, not just #505's stop. I can test a branch on this machine.

Not tested: any fix; 16 windows; AMD; current main.

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the capture, the offline replay and the heap scan) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 05:20 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7153681897) **Data for the plan above, and an answer to "any reads of the GPU view that don't go through an empty V#?": yes, most of them. In a dump of the title's view heap taken when the world starts, 65 % of the buffer V#s are non-empty and carry a GPU-view address as their base. They come from the "view of memory at an address" device methods (#70 / #71), which write the title's address as it is, so the empty-V# count misses them, and step 2 as written would too.** **Setup** - Tree: `main` `9e3831e` merged locally with #1288, #1448, #684, #889, #1323, #929, #640, #1326, #1327, #1329; on top, by hand and uncommitted: #1791, a local equivalent of #1405, #1803, a local readback change in `sparse.rs` (one fence per title queue, see #1329), and local logging / dump code. Four memory windows on this tree (`0x4_0000_0000` – `0x7_ffff_0000`). - Run: release, `XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250`, warm caches; the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver; `TdrDelay` 30 s. One run of the retail title, one frame dumped shortly after the world starts (GPU-side copy of the heap, read back before a compute dispatch). - RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB RAM + 32 GB page file, Windows 11 22631. **1. The first 32 768 slots of the title's view heap in that frame** | what the slot holds | slots | |---|---| | image descriptor | 15 680 | | buffer V# whose base is in the GPU view of the 24 GB pair (high word `0x12`: 10 764, `0x13`: 23, `0xe`: 43), outside every window | 10 830 | | buffer V# in a window | 5 763 | | all zero (an empty V# or never written; the two look the same) | 476 | | degenerate (base or size 0) | 19 | So of 16 593 non-empty buffer V#s, 10 830 point into the GPU view. None point into the title's other 64 KiB-page reservations. On this tree `dev_create_srv_at_x` / `dev_create_uav_at_x` (device #70 / #71) write `buffer_words_at(va, …)` with the title's address unchanged, which is where these come from; `note_buffer_view`'s empty V# is a different path. **2. Root views** (from a second pair of runs, same tree plus #1055's map, written up on #1031): 3 700 distinct compute root-view addresses in the GPU view in the first seconds of the world, 12 918 by 200 s. Rebasing those to the CPU view's same offset is right for all but one at 100 s and wrong for 119 at 200 s, so `mirrors::source` is a good first answer and #1055's per-page map is needed after that. **3. Two readers that take a V# out of the view heap by index and end up with zeros** (the heap address comes in the register after their root arguments, #1803): - the title's GPU-driven culling: its compute programs get real per-group records and write nothing. Replayed offline from a capture, the first guard they fail is a zero count read through a heap slot named by the record. In the title about 280 of 300 indirect draws of a frame then have an instance count of 0, and the main depth target stays at its clear value. This is the flat grey world. - the two-pass mesh programs (#724 / #2092): with the registers right, every record is still (1 vertex, 1 primitive), which is what a zero meshlet entry gives. In the binds I logged (another run, the tree of my #724 comments) the index constant is 0, and slots 0 – 9 of the heap are all zero in this dump. For both, the registers and the translation were checked. What I have not captured is the content of the exact slots the culling records name (they are past the part of the heap I dumped), so "those are GPU-view V#s" is inferred from the 65 %, not read; and for the mesh case the slot is a zero one, which could be an empty V# or a slot XCL never wrote. **For the plan**: placing the CPU view in the windows and rebasing would need to cover the by-address view methods and root views, not only the empty-V# path; and since two thirds of the title's buffer views are of this kind, I would expect it to change the picture, not just #505's stop. I can test a branch on this machine. **Not tested**: any fix; 16 windows; AMD; current `main`. **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the capture, the offline replay and the heap scan) did this and drafted the comment.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 05:37 UTC · original

Follow-up to my comment above, with a test that goes against my own expectation: giving every one of these by-address views a readable copy does not restart the culling on this tree.

Same tree and settings as above, plus #1055's map and a local experiment: when device #70 / #71 create a buffer view at a GPU-view address, the V# gets the address of a copy inside a sparse window, filled from the CPU view's same offset at creation and again at every present. One run, numbers at 106 – 123 s (about 20 s into the world).

The views (counted in the title, not from a dump this time)

  • 94 412 distinct ranges created through #70 in the GPU view by 123 s, 1 156 MB in all, every one an SRV (no buffer UAV through #71 there). 71 % are 4 KiB or less, the largest is 4.5 MiB.
  • For all of them #1055's map names a source page, the source is committed (the CPU has the bytes) and it is never inside a window. So the data exists; the shader just cannot reach it.

The experiment

  • All 94 472 views got a copy (none over a cap, none refused); 81 387 copies were refreshed each frame (747 MB per frame), peak commit 41.8 GB.
  • Indirect draws of the captured frame: 263 of 286 still have an instance count of 0, 23 have work; 807 of 1 016 indirect dispatches have no groups. Without these copies, on the same tree last night: 262 of 267 (and 279 of 295 in a run that had copies for root views and empty views only), with about 800 of 1 000 dispatches without groups. An earlier run with copies for only the first 62 % of the views gave 262 of 270.
  • The main depth target of a later frame is still uniform (one value over the whole dump).

So these views being unreadable is real and large, but it is not, on its own, what keeps the culling empty; my "I would expect it to change the picture" above was too optimistic. What I cannot exclude: the copies were filled from the same offset in the CPU view, and I did not compare their bytes with what the page map says the console would show (the map agreed with same offset on the samples logged). Root views and raw addresses into the GPU view were not covered by this experiment.

Still not captured: the heap slots the culling records actually name. That is the next measurement here.

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the experiment and the runs) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 05:37 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7153969450) **Follow-up to my comment above, with a test that goes against my own expectation: giving every one of these by-address views a readable copy does not restart the culling on this tree.** Same tree and settings as above, plus #1055's map and a local experiment: when device #70 / #71 create a buffer view at a GPU-view address, the V# gets the address of a copy inside a sparse window, filled from the CPU view's same offset at creation and again at every present. One run, numbers at 106 – 123 s (about 20 s into the world). **The views** (counted in the title, not from a dump this time) - 94 412 distinct ranges created through #70 in the GPU view by 123 s, 1 156 MB in all, every one an SRV (no buffer UAV through #71 there). 71 % are 4 KiB or less, the largest is 4.5 MiB. - For all of them #1055's map names a source page, the source is committed (the CPU has the bytes) and it is never inside a window. So the data exists; the shader just cannot reach it. **The experiment** - All 94 472 views got a copy (none over a cap, none refused); 81 387 copies were refreshed each frame (747 MB per frame), peak commit 41.8 GB. - Indirect draws of the captured frame: 263 of 286 still have an instance count of 0, 23 have work; 807 of 1 016 indirect dispatches have no groups. Without these copies, on the same tree last night: 262 of 267 (and 279 of 295 in a run that had copies for root views and empty views only), with about 800 of 1 000 dispatches without groups. An earlier run with copies for only the first 62 % of the views gave 262 of 270. - The main depth target of a later frame is still uniform (one value over the whole dump). So these views being unreadable is real and large, but it is not, on its own, what keeps the culling empty; my "I would expect it to change the picture" above was too optimistic. What I cannot exclude: the copies were filled from the same offset in the CPU view, and I did not compare their bytes with what the page map says the console would show (the map agreed with same offset on the samples logged). Root views and raw addresses into the GPU view were not covered by this experiment. Still not captured: the heap slots the culling records actually name. That is the next measurement here. **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the experiment and the runs) did this and drafted the comment.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 06:30 UTC · original

A correction to the conclusion of my last comment, and the measurement I said was missing. The exact heap slots the culling reads are now captured: all of them are GPU-view V#s. And with the copies in place the first culling program does write in the title; what stays empty is further down the chain.

Same tree, settings and machine as my two comments above (the capture is from the tree without the copies; the in-title probe is from the tree with them).

1. The slots, read from a capture (one frame, 4 dispatches of the first culling program, 81 groups)

  • Each group's record names a view-heap slot for its object list. 81 of 81 slots hold a well-formed buffer V# whose base is in the GPU view of the 24 GB pair; none is null, none is in a window.
  • The translated shader reads a count of 0 there. The CPU view at the same offset holds a count of 1 to 138 for every one of the 81.
  • Replayed offline from the capture (the real program, in the split-wave64 compute pass): as captured it fails its first guard in every lane and writes nothing, as in the title. With the out-of-window reads served from the CPU view's bytes it passes that guard, passes the next one for part of the lanes, and appends to its output list and counters in all 4 dispatches.

2. In the title, with the by-address copies of my last comment and a probe on that program (one run)

  • In 4 of its 8 dispatches of the probed frame the program now changes its counter buffer (17, 4, 11 and 2 words, values from 1 to 157) and its output list. In every run probed without the copies it changed 0 words.
  • The frame's totals are unchanged all the same: 262 of 270 indirect draws with an instance count of 0, 819 of 996 indirect dispatches without groups.

So "does not restart the culling" in my last comment was wrong as stated: the copies restart its first stage, and the indirect draws stay empty because of something downstream that I have not located yet (the other 4 dispatches, which use different buffers, still write nothing). The case for making the GPU view reachable is stronger than my last comment said, and same-offset rebasing is enough to get this first stage going.

Not tested / limits: the capture keeps 64 bytes of each object list on the CPU side, so the offline replay is right for the first objects of a list only; one run each; nothing downstream of the first program.

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the capture, the replay and the runs) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 06:30 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7154861501) **A correction to the conclusion of my last comment, and the measurement I said was missing. The exact heap slots the culling reads are now captured: all of them are GPU-view V#s. And with the copies in place the first culling program does write in the title; what stays empty is further down the chain.** Same tree, settings and machine as my two comments above (the capture is from the tree without the copies; the in-title probe is from the tree with them). **1. The slots, read from a capture** (one frame, 4 dispatches of the first culling program, 81 groups) - Each group's record names a view-heap slot for its object list. 81 of 81 slots hold a well-formed buffer V# whose base is in the GPU view of the 24 GB pair; none is null, none is in a window. - The translated shader reads a count of 0 there. The CPU view at the same offset holds a count of 1 to 138 for every one of the 81. - Replayed offline from the capture (the real program, in the split-wave64 compute pass): as captured it fails its first guard in every lane and writes nothing, as in the title. With the out-of-window reads served from the CPU view's bytes it passes that guard, passes the next one for part of the lanes, and appends to its output list and counters in all 4 dispatches. **2. In the title, with the by-address copies of my last comment and a probe on that program** (one run) - In 4 of its 8 dispatches of the probed frame the program now changes its counter buffer (17, 4, 11 and 2 words, values from 1 to 157) and its output list. In every run probed without the copies it changed 0 words. - The frame's totals are unchanged all the same: 262 of 270 indirect draws with an instance count of 0, 819 of 996 indirect dispatches without groups. So "does not restart the culling" in my last comment was wrong as stated: the copies restart its first stage, and the indirect draws stay empty because of something downstream that I have not located yet (the other 4 dispatches, which use different buffers, still write nothing). The case for making the GPU view reachable is stronger than my last comment said, and same-offset rebasing is enough to get this first stage going. **Not tested / limits**: the capture keeps 64 bytes of each object list on the CPU side, so the offline replay is right for the first objects of a list only; one run each; nothing downstream of the first program. **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the capture, the replay and the runs) did this and drafted the comment.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 07:08 UTC · original

With the GPU view of the 24 GB pair made readable for buffer views and root views (by copies, as an experiment), and the two-pass mesh path on top, the retail title rasterises world geometry here for the first time: the main depth target and the G-buffer hold a character and the scene around it. The presented frame is not right yet.

Setup

  • Tree: main 689f2db merged locally with #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640 (ported), #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits from wondercrash/xcl (150e635, 761ada5, 9b70233), then #541 (6bd8f64), the rebased #724 branch at 3442b58, #1887 and #1803; a local readback change in sparse.rs (one fence per title queue, see #1329); local diagnostics.
  • Local additions for this test: (a) the two-pass compute pass gets #1803's heap addresses, and its first register stays 16 (see #724); (b) readable copies, each in a sparse window and filled from the CPU view's same offset: for buffer views created by address in a GPU view (device #70), for buffer views that would get an empty V#, and for root views outside the windows (also in the two-pass stages), refreshed at each present. No per-page map (#1055) on this tree.
  • Run: release, XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250 XCL_PAGE_BUDGET_MB=6144, warm caches; the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver; TdrDelay 30 s. One clean run (numbers below), and one earlier run that a local memory guard ended at 117 s after its frame was logged (consistent numbers).
  • RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB RAM + 32 GB page file, Windows 11 22631.

Measured, about 15 s into the world

  • Indirect mesh draws of one frame: 241, of which 115 now arrive with groups (562 groups), plus 12 direct DispatchMesh with groups. Before, the indirect ones had 0 groups, because the culling that fills their argument records wrote nothing.
  • Two-pass record headers read by those calls: 861 of 1 003 carry geometry, with real meshlet sizes such as (127 vertices, 116 primitives) and (128, 84). Before: every header was (1, 1) (see #724).
  • Main depth target (2560×1440, D32S8), three consecutive frames: 91 %, 100 % and 100 % of the sampled texels differ from the clear value, with values spread up to 0.17, 1.0 and 0.54. Before, in every run dumped: one value over the whole target. The G-buffer colour targets are filled as well. Looking at the dumps, depth shows a character's head and shoulders and a wall edge, and one G-buffer target shows the same character and scene geometry.
  • The presented frame of the same moment is still close to uniform. I have not looked at what happens between the G-buffer and the present yet.

What this does and does not show

  • It shows that the unreadable GPU view was what kept the world empty on this path: culling and mesh programs both take their data from it, through by-address views and root views.
  • It does not show which of the three kinds of copy are needed (all were on), nor that same-offset is right for all of them; about half of the indirect mesh draws still have 0 groups, which may be ordinary culling or inputs still missing.
  • The copies are an experiment, not a design: about 75 000 of them, 1.4 GB, with about 750 MB refilled from the CPU every frame, and writes through them do not go back to the title. Commit peaked at 43.6 GB; without the lower page budget the run does not fit in this machine's 64 GB of commit.

For the plan above: rebasing GPU-view addresses to a CPU view placed in the windows (for the by-address views and root views too), or real aliasing, should give the same result without the copies. I can test such a branch here.

Not tested: any of this without #541 / #724; AMD; current main; more than these two runs.

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 07:08 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7155524209) **With the GPU view of the 24 GB pair made readable for buffer views and root views (by copies, as an experiment), and the two-pass mesh path on top, the retail title rasterises world geometry here for the first time: the main depth target and the G-buffer hold a character and the scene around it. The presented frame is not right yet.** **Setup** - Tree: `main` `689f2db` merged locally with #1329 (+ #1326, #1327), #1448, #1323, #889, #684, #929, #640 (ported), #1850, #765, #1982, #1405, #1464, three allocator-lifetime commits from `wondercrash/xcl` (`150e635`, `761ada5`, `9b70233`), then #541 (`6bd8f64`), the rebased #724 branch at `3442b58`, #1887 and #1803; a local readback change in `sparse.rs` (one fence per title queue, see #1329); local diagnostics. - Local additions for this test: (a) the two-pass compute pass gets #1803's heap addresses, and its first register stays 16 (see #724); (b) readable copies, each in a sparse window and filled from the CPU view's same offset: for buffer views created by address in a GPU view (device #70), for buffer views that would get an empty V#, and for root views outside the windows (also in the two-pass stages), refreshed at each present. No per-page map (#1055) on this tree. - Run: release, `XCL_UMA_SHADOW=1 XCL_HEAP_WINDOWS=1 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_WAIT_RELEASE_MS=250 XCL_PAGE_BUDGET_MB=6144`, warm caches; the title's own stall watchdog neutralised, compute programs of 4 MB of DXIL or more not handed to the driver; `TdrDelay` 30 s. One clean run (numbers below), and one earlier run that a local memory guard ended at 117 s after its frame was logged (consistent numbers). - RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB RAM + 32 GB page file, Windows 11 22631. **Measured, about 15 s into the world** - Indirect mesh draws of one frame: 241, of which 115 now arrive with groups (562 groups), plus 12 direct `DispatchMesh` with groups. Before, the indirect ones had 0 groups, because the culling that fills their argument records wrote nothing. - Two-pass record headers read by those calls: 861 of 1 003 carry geometry, with real meshlet sizes such as (127 vertices, 116 primitives) and (128, 84). Before: every header was (1, 1) (see #724). - Main depth target (2560×1440, D32S8), three consecutive frames: 91 %, 100 % and 100 % of the sampled texels differ from the clear value, with values spread up to 0.17, 1.0 and 0.54. Before, in every run dumped: one value over the whole target. The G-buffer colour targets are filled as well. Looking at the dumps, depth shows a character's head and shoulders and a wall edge, and one G-buffer target shows the same character and scene geometry. - The presented frame of the same moment is still close to uniform. I have not looked at what happens between the G-buffer and the present yet. **What this does and does not show** - It shows that the unreadable GPU view was what kept the world empty on this path: culling and mesh programs both take their data from it, through by-address views and root views. - It does not show which of the three kinds of copy are needed (all were on), nor that same-offset is right for all of them; about half of the indirect mesh draws still have 0 groups, which may be ordinary culling or inputs still missing. - The copies are an experiment, not a design: about 75 000 of them, 1.4 GB, with about 750 MB refilled from the CPU every frame, and writes through them do not go back to the title. Commit peaked at 43.6 GB; without the lower page budget the run does not fit in this machine's 64 GB of commit. For the plan above: rebasing GPU-view addresses to a CPU view placed in the windows (for the by-address views and root views too), or real aliasing, should give the same result without the copies. I can test such a branch here. **Not tested**: any of this without #541 / #724; AMD; current `main`; more than these two runs. **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment.
Author
Owner

@⁠ettehn on GitHub · 2026-11-25 07:44 UTC · original · edited 2026-11-25 07:51 UTC

Synthetic mesh readback for GPU-view rebasing. I combined #2092 (47c7cc1), #1803 (cb00751, with its heap-base packing wired into the two-pass path), and #1055 (f532d33). The mesh compute pass reads a V# from the heap through s23. The test resolves backing addresses with #1055 and explicitly writes the descriptor between completed dispatches.

  • Remap: writing the V# once made it keep reading the old vertices after the GPU view moved to another physical page. Refreshing it from the updated mapping read the three new vertices.
  • Cross-page buffer: three 16-byte vertices started at offset 64 KiB - 16 in a view backed by pool pages 0 and 2. I filled pool page 1 with decoys. Rebasing to the first resolved address read one correct vertex and two decoys. Gathering the two mapped spans in view order into a contiguous read-only buffer read all three correctly.

RTX 5070 Ti Laptop, driver 32.0.16.2124, Windows 11 25H2 (26200.9974), Ryzen 9 8945HX, Rust 1.97.1 MSVC, DXC 1.8.2502.11. With XCL_ADAPTER=nvidia XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=0, cargo test --locked --offline -j 2 -p xcl --lib gpu_mesh_mode -- --nocapture --test-threads=1 ran 2 passed, 0 failed, 0 skipped. This is a synthetic SRV readback. Retail frequency, in-flight mapping changes, UAV writes, and performance were outside the test.

Test implementation and verification assisted by OpenAI Codex (GPT-6).

Reserved-buffer alias follow-up. On the same RTX 5070 Ti Laptop, a 5-tile D3D12 reserved buffer exposed pool tiles 0, 2 as one logical range and 0, 1, 2 at separate offsets. The initial cross-boundary read returned 11, 22. A single-thread compute shader then wrote 33, 44 via a root UAV across the alias boundary. The original offsets read back 33, 99, 44, with the intervening decoy tile unchanged. After the first queue fence completed, I changed alias tile 1 to pool tile 1 with UpdateTileMappings. The next submission read back 33, 99 from the same alias range.

cargo test --locked --offline -j 2 -p xcl --lib gpu_reserved_buffer_alias_spans_noncontiguous_tiles -- --nocapture --test-threads=1 with XCL_ADAPTER=nvidia ran 1 passed, 0 failed, 0 skipped. This checks D3D12 tile aliasing and ordered remap in isolation. XCL runtime integration, overlapping cross-queue use, and a retail title are still untested. Verification assisted by OpenAI Codex (GPT-6).

**@⁠ettehn** on GitHub · 2026-11-25 07:44 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7156194202) · edited 2026-11-25 07:51 UTC **Synthetic mesh readback for GPU-view rebasing.** I combined #2092 (`47c7cc1`), #1803 (`cb00751`, with its heap-base packing wired into the two-pass path), and #1055 (`f532d33`). The mesh compute pass reads a V# from the heap through `s23`. The test resolves backing addresses with #1055 and explicitly writes the descriptor between completed dispatches. - **Remap:** writing the V# once made it keep reading the old vertices after the GPU view moved to another physical page. Refreshing it from the updated mapping read the three new vertices. - **Cross-page buffer:** three 16-byte vertices started at offset `64 KiB - 16` in a view backed by pool pages **0 and 2**. I filled pool page 1 with decoys. Rebasing to the first resolved address read one correct vertex and two decoys. Gathering the two mapped spans in view order into a contiguous read-only buffer read all three correctly. RTX 5070 Ti Laptop, driver 32.0.16.2124, Windows 11 25H2 (26200.9974), Ryzen 9 8945HX, Rust 1.97.1 MSVC, DXC 1.8.2502.11. With `XCL_ADAPTER=nvidia XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=0`, `cargo test --locked --offline -j 2 -p xcl --lib gpu_mesh_mode -- --nocapture --test-threads=1` ran **2 passed, 0 failed, 0 skipped**. This is a synthetic SRV readback. Retail frequency, in-flight mapping changes, UAV writes, and performance were outside the test. Test implementation and verification assisted by OpenAI Codex (GPT-6). **Reserved-buffer alias follow-up.** On the same RTX 5070 Ti Laptop, a 5-tile D3D12 reserved buffer exposed pool tiles `0, 2` as one logical range and `0, 1, 2` at separate offsets. The initial cross-boundary read returned `11, 22`. A single-thread compute shader then wrote `33, 44` via a root UAV across the alias boundary. The original offsets read back `33, 99, 44`, with the intervening decoy tile unchanged. After the first queue fence completed, I changed alias tile 1 to pool tile 1 with `UpdateTileMappings`. The next submission read back `33, 99` from the same alias range. `cargo test --locked --offline -j 2 -p xcl --lib gpu_reserved_buffer_alias_spans_noncontiguous_tiles -- --nocapture --test-threads=1` with `XCL_ADAPTER=nvidia` ran **1 passed, 0 failed, 0 skipped**. This checks D3D12 tile aliasing and ordered remap in isolation. XCL runtime integration, overlapping cross-queue use, and a retail title are still untested. Verification assisted by OpenAI Codex (GPT-6).
Author
Owner

@⁠claudetools-gh on GitHub · 2026-11-25 14:42 UTC · original

@⁠CharlyRien @⁠adiologydev a question about the shader side of this, and a data point: with the mesh stack and the #2308 stack on, the title gets into its 3D intro here and runs the mesh work, but the presented frame has only the 2D layers (titles, subtitles). #2308's description says shaders still can't read the GPU view outside the memory windows, so I take it that is the missing piece. Is anyone writing it, and in which form?

Setup: RTX 5070 Ti 16 GB, Ryzen 7 9700X, 62 GB, Windows 11 26300, release. #2057 + main afc5ee8 + #2092 / #541 / #1803 / #1887 (+ heap addresses passed to both two-pass stages, as in the #2092 comments) + #2270 + #2306 + #2293 / #2294 / #2307 / #1055 / #2308. XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=0 XCL_WATCH_HOT=0 XCL_PSO_WAIT_MS=50 XCL_NETWORK=0. One run.

  • queue CopyPageMappingsBatchX: … pages mapped so far: 1023 showing a physical page by 7 s, so the GPU view's pages are being mapped for real.
  • 178 two-pass MS pipelines translated, two-pass DispatchMesh and two-pass ExecuteIndirect calls logged, no mesh pipeline refused in the AS slot.
  • Local video memory stayed at 10–12 GB of a 15 GB budget with #2306 (it was 15.8–19.3 GB without it, over the budget).
  • The intro starts at ~100 s; the frames XCL dumps after that (XCL_FRAME_DUMP) are dark with the intro's text, as on screen.

I'm adding a local probe of the large depth / colour targets at the dumped frames, to see whether geometry reaches them as in CharlyRien's experiment above, and will post what it shows. If the GPU-view rebasing (by-address views and root views into the windows) is being written somewhere, I'd be glad to test it on this card.

AI-assisted.

**@⁠claudetools-gh** on GitHub · 2026-11-25 14:42 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7165690393) @⁠CharlyRien @⁠adiologydev a question about the shader side of this, and a data point: **with the mesh stack and the #2308 stack on, the title gets into its 3D intro here and runs the mesh work, but the presented frame has only the 2D layers (titles, subtitles).** #2308's description says shaders still can't read the GPU view outside the memory windows, so I take it that is the missing piece. Is anyone writing it, and in which form? **Setup:** RTX 5070 Ti 16 GB, Ryzen 7 9700X, 62 GB, Windows 11 26300, release. #2057 + `main` `afc5ee8` + #2092 / #541 / #1803 / #1887 (+ heap addresses passed to both two-pass stages, as in the #2092 comments) + #2270 + #2306 + #2293 / #2294 / #2307 / #1055 / #2308. `XCL_PAGE_ALIAS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=0 XCL_WATCH_HOT=0 XCL_PSO_WAIT_MS=50 XCL_NETWORK=0`. One run. - `queue CopyPageMappingsBatchX: … pages mapped so far: 1023 showing a physical page` by 7 s, so the GPU view's pages are being mapped for real. - 178 two-pass MS pipelines translated, `two-pass DispatchMesh` and `two-pass ExecuteIndirect` calls logged, no mesh pipeline refused in the AS slot. - Local video memory stayed at 10–12 GB of a 15 GB budget with #2306 (it was 15.8–19.3 GB without it, over the budget). - The intro starts at ~100 s; the frames XCL dumps after that (`XCL_FRAME_DUMP`) are dark with the intro's text, as on screen. I'm adding a local probe of the large depth / colour targets at the dumped frames, to see whether geometry reaches them as in CharlyRien's experiment above, and will post what it shows. If the GPU-view rebasing (by-address views and root views into the windows) is being written somewhere, I'd be glad to test it on this card. AI-assisted.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 14:56 UTC · original

@⁠claudetools-gh short answer: not a clean rebasing from me. What I run is a local workaround by copies, and today's measurements say it is necessary but not yet enough. On #505 MacieGx wrote that he maps that range as extra memory windows filled on demand and that a PR will follow (#505); I have not seen it yet, so that is probably the form to wait for.

Setup for everything below: RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB, Windows 11 22631, release, HLSL path. Tree: main 689f2db + #1329, #1448, #1323, #889, #684, #929, #640, #1850, #765, #541, #724 (rebased, 3442b58), #1887, #1803, #1982, #1405, #1464, #1989 (197b104), #2229 (039a363), plus local changes (the copies described here, a depth-twin copy at each use, a frame capture). XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0 XCL_PAGE_BUDGET_MB=2048. Not #1055 / #1102, which matters for point 4.

  1. What put geometry in the targets in my comment above: a readable copy, inside the memory windows, of every buffer the title makes a by-address view of (device methods #70 / #71) when its address is in the GPU view, with the descriptor rewritten to point at the copy, refreshed at each present; the same for root views. Capped at 500 MB here, because the title makes such views of about 1 030 MB and the machine is short of memory.

  2. Measured today, off the game: I captured the two-pass mesh draws of one world frame (489 draws, 177 with groups) with everything they read, and replay them through XCL's own translation; the replay gives the game's depth on 98.6 % of the words it changes and the same vertex and primitive counts for every record. In the game, with the cap, 92 of the 168 draws that have groups (another frame) write one vertex and one primitive per record, and all 92 have one buffer of their mesh table in the GPU view without a copy. Replaying with only the buffers those tables name made readable (350 buffers, 2 MB for the frame) gives real meshlets for all 92, for example 4 vertices → 456 and 8 → 1 016.

  3. So a cheaper form than a blanket copy exists: at the bind of each two-pass stage, look at the table entries the stage really uses (the per-stage used-resource table of the container, #2217), and give a copy to those that are buffer descriptors pointing into a GPU view. In the title that was 65 536 copies over a 160 s run, 2 to 9 MB a frame, none refused. It is not enough: in the replay one draw still covers 3.1 M texels with those buffers readable, and in the title the depth target of some frames is one screen-sized surface. Some other input of the mesh programs is still read as zero; I have not found which.

  4. Textures: of the 170 block-compressed textures the pixel shaders of those draws name through their material records, 167 are all zero on the GPU, 154 of them never evicted. Their title address is in the GPU view and in this tree the CPU view of those pages is not readable, so XCL has nothing to upload. Your tree has the page-mapping PRs, so your probe of the targets should tell whether that part is solved there.

If the copies of points 1 and 3 are useful to you as a stopgap, say so and I will cut them out as a patch. They are local, tangled with the capture code, and not PR quality.

AI use: Claude Code (Claude Fable 5.2 coordinating; Claude Fable 5.2 and Opus 5.5 agents wrote the copies, the capture and the replay and ran them). I looked at the depth images of the in-title run and checked the replay's summary lines; the per-draw numbers are from the agents' notes.

**@⁠CharlyRien** on GitHub · 2026-11-25 14:56 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7166043198) @⁠claudetools-gh short answer: not a clean rebasing from me. What I run is a local workaround by copies, and today's measurements say it is necessary but not yet enough. On #505 MacieGx wrote that he maps that range as extra memory windows filled on demand and that a PR will follow (https://git.gtahub.st/github/xcl-dev--xcl/issues/505); I have not seen it yet, so that is probably the form to wait for. **Setup** for everything below: RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, 32 GB, Windows 11 22631, release, HLSL path. Tree: `main` `689f2db` + #1329, #1448, #1323, #889, #684, #929, #640, #1850, #765, #541, #724 (rebased, `3442b58`), #1887, #1803, #1982, #1405, #1464, #1989 (`197b104`), #2229 (`039a363`), plus local changes (the copies described here, a depth-twin copy at each use, a frame capture). `XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0 XCL_PAGE_BUDGET_MB=2048`. Not #1055 / #1102, which matters for point 4. 1. **What put geometry in the targets in my comment above:** a readable copy, inside the memory windows, of every buffer the title makes a by-address view of (device methods #70 / #71) when its address is in the GPU view, with the descriptor rewritten to point at the copy, refreshed at each present; the same for root views. Capped at 500 MB here, because the title makes such views of about 1 030 MB and the machine is short of memory. 2. **Measured today, off the game:** I captured the two-pass mesh draws of one world frame (489 draws, 177 with groups) with everything they read, and replay them through XCL's own translation; the replay gives the game's depth on 98.6 % of the words it changes and the same vertex and primitive counts for every record. In the game, with the cap, 92 of the 168 draws that have groups (another frame) write one vertex and one primitive per record, and all 92 have one buffer of their mesh table in the GPU view without a copy. Replaying with only the buffers those tables name made readable (350 buffers, 2 MB for the frame) gives real meshlets for all 92, for example 4 vertices → 456 and 8 → 1 016. 3. **So a cheaper form than a blanket copy exists:** at the bind of each two-pass stage, look at the table entries the stage really uses (the per-stage used-resource table of the container, #2217), and give a copy to those that are buffer descriptors pointing into a GPU view. In the title that was 65 536 copies over a 160 s run, 2 to 9 MB a frame, none refused. **It is not enough:** in the replay one draw still covers 3.1 M texels with those buffers readable, and in the title the depth target of some frames is one screen-sized surface. Some other input of the mesh programs is still read as zero; I have not found which. 4. **Textures:** of the 170 block-compressed textures the pixel shaders of those draws name through their material records, 167 are all zero on the GPU, 154 of them never evicted. Their title address is in the GPU view and in this tree the CPU view of those pages is not readable, so XCL has nothing to upload. Your tree has the page-mapping PRs, so your probe of the targets should tell whether that part is solved there. If the copies of points 1 and 3 are useful to you as a stopgap, say so and I will cut them out as a patch. They are local, tangled with the capture code, and not PR quality. **AI use**: Claude Code (Claude Fable 5.2 coordinating; Claude Fable 5.2 and Opus 5.5 agents wrote the copies, the capture and the replay and ran them). I looked at the depth images of the in-title run and checked the replay's summary lines; the per-draw numbers are from the agents' notes.
Author
Owner

@⁠claudetools-gh on GitHub · 2026-11-25 15:01 UTC · original

Follow-up to my question above, with the target probe I mentioned: on this tree the world draws are recorded, but nothing reaches the main depth target or the G-buffer. So the 3D is lost before rasterisation, not between the G-buffer and the present, unlike in CharlyRien's experiment with the readable copies.

Same machine, tree and settings as above, plus XCL_DIRECT_SPLIT_INSTRUCTIONS=0 and a local probe (XCL_TARGET_PROBE=1): at each dumped frame it copies the largest render / depth targets used that frame back to the CPU, samples every 8th pixel, and logs how many draws had the target bound and how many samples differ from its last clear value. One run; the frame below is in the 3D intro, ~159 s in, ~2 fps at that point.

target format draws bound differ from clear distinct values
2560×1440 depth D32_FLOAT_S8X24 (19) 254 0 % (clear 0) 1
2560×1440 colour R8G8B8A8 (28) 73 0 % (clear 0,0,0,0) 1
2560×1440 colour R16G16_FLOAT (34), clear −10 000 74 not decoded –
3840×2160 colour (the composited frame) R8G8B8A8 2 100 % 284

So 254 draws (mesh and indirect included) with the depth target bound leave it at its clear value of 0 everywhere, and the G-buffer target likewise. That is the "(1, 1) records" state you described before the GPU view was made readable: the culling and mesh programs run on inputs they can't see, emit nothing, and only the 2D layers reach the 4K composite. It points at the shader-side reads of the GPU view (by-address views and root views outside the windows) as the remaining piece, rather than at anything after the G-buffer.

A side effect that may matter for frame rate: in the same stretch the GPU is busy almost all the time (≈1.8–2.2 s of GPU time per 2 s, from XCL_GPU_PROFILE), and most of it is a few small compute programs with very long single dispatches: 24de2aef6c31d55e (32 threads, ~63 500 groups, up to 158 ms a call), b78fa10b425b8e54 (up to 355 ms for one 160×90 dispatch; one of the two programs refused in the #675 / #505 reports), 1b5466f261a70cde (226–245 ms), d79af1d04922a49b (up to 119 ms for 2–4 groups). If their loop counts or indices also come from memory the shaders can't see, they may be iterating over garbage, as in the a542b07e605c8fd7 timing on #1452. I haven't checked their code yet.

AI-assisted.

**@⁠claudetools-gh** on GitHub · 2026-11-25 15:01 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7166182258) Follow-up to [my question above](https://git.gtahub.st/github/xcl-dev--xcl/issues/697), with the target probe I mentioned: **on this tree the world draws are recorded, but nothing reaches the main depth target or the G-buffer**. So the 3D is lost before rasterisation, not between the G-buffer and the present, unlike in CharlyRien's experiment with the readable copies. Same machine, tree and settings as above, plus `XCL_DIRECT_SPLIT_INSTRUCTIONS=0` and a local probe (`XCL_TARGET_PROBE=1`): at each dumped frame it copies the largest render / depth targets used that frame back to the CPU, samples every 8th pixel, and logs how many draws had the target bound and how many samples differ from its last clear value. One run; the frame below is in the 3D intro, ~159 s in, ~2 fps at that point. | target | format | draws bound | differ from clear | distinct values | |---|---|---|---|---| | 2560×1440 depth | D32_FLOAT_S8X24 (19) | 254 | 0 % (clear 0) | 1 | | 2560×1440 colour | R8G8B8A8 (28) | 73 | 0 % (clear 0,0,0,0) | 1 | | 2560×1440 colour | R16G16_FLOAT (34), clear −10 000 | 74 | not decoded | – | | 3840×2160 colour (the composited frame) | R8G8B8A8 | 2 | 100 % | 284 | So 254 draws (mesh and indirect included) with the depth target bound leave it at its clear value of 0 everywhere, and the G-buffer target likewise. That is the "(1, 1) records" state you described before the GPU view was made readable: the culling and mesh programs run on inputs they can't see, emit nothing, and only the 2D layers reach the 4K composite. It points at the shader-side reads of the GPU view (by-address views and root views outside the windows) as the remaining piece, rather than at anything after the G-buffer. A side effect that may matter for frame rate: in the same stretch the GPU is busy almost all the time (≈1.8–2.2 s of GPU time per 2 s, from `XCL_GPU_PROFILE`), and most of it is a few small compute programs with very long single dispatches: `24de2aef6c31d55e` (32 threads, ~63 500 groups, up to 158 ms a call), `b78fa10b425b8e54` (up to 355 ms for one 160×90 dispatch; one of the two programs refused in the #675 / #505 reports), `1b5466f261a70cde` (226–245 ms), `d79af1d04922a49b` (up to 119 ms for 2–4 groups). If their loop counts or indices also come from memory the shaders can't see, they may be iterating over garbage, as in the `a542b07e605c8fd7` timing on #1452. I haven't checked their code yet. AI-assisted.
Author
Owner

@⁠GreemSC on GitHub · 2026-11-25 15:14 UTC · original

@⁠claudetools-gh on "in which form", for @⁠CharlyRien and @⁠adiologydev too: the VIctory forks that now draw a lit, textured world (Belobug on an RX 9070 XT, DexNom on an RX 7900 XTX, ~3–4 fps per PortWatch; Belobug's README still says "not playable yet") read title memory from shaders in two ways. Their own docs and commits, not reproduced here; GPL-3.0, so ideas only, no code:

  1. A directory for raw addresses. "A directory with one entry per 64 KiB of title address space leads a shader to the layer's host copy of that memory; loads, stores, atomic add/sub and float min/max go through it. Before a dispatch the host makes ready the memory its root views and root constants name." A page with no host copy reads zero, and a store to it is dropped. (victory-fork docs/fork-ray-tracing.md)
  2. Card copies of large title buffers, with shader writes found by hashing on the card, plus a guard over every view of a physical page: a copy had been guarded at one address only, and a five-minute run counted 0.8–1.0 million writes through another view (8dd30ab).

Fixes on the same line that match the symptom here:

  • "Meshlet culling read its scene buffers as the wrong kind of view, so the world drew almost nothing; fixed." (victory-fork README)
  • Descriptor records the title copies into its heap as bytes are mirrored before each submission (~40,000 a frame), and a buffer view off a copy's elements gets bytes of its own. With room kept on the card for the first frame's bursts, 98 buffer copies (945 MB) were made where earlier runs made 1, and "the first room renders right" (a26859f).
  • "Light packed by the game's compute shaders was read back through empty copies (sky, probes, fog); fixed for every mip level and layer." (same README)

AI use: Claude Code (Claude Opus 5.5) read the forks' docs and commits and wrote this; nothing here was run on XCL.

**@⁠GreemSC** on GitHub · 2026-11-25 15:14 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7166525601) @⁠claudetools-gh on "in which form", for @⁠CharlyRien and @⁠adiologydev too: the VIctory forks that now draw a lit, textured world (Belobug on an RX 9070 XT, DexNom on an RX 7900 XTX, ~3–4 fps per [PortWatch](https://portwatch-vi.xyz/); Belobug's README still says "not playable yet") read title memory from shaders in two ways. Their own docs and commits, not reproduced here; GPL-3.0, so ideas only, no code: 1. **A directory for raw addresses.** "A directory with one entry per 64 KiB of title address space leads a shader to the layer's host copy of that memory; loads, stores, atomic add/sub and float min/max go through it. Before a dispatch the host makes ready the memory its root views and root constants name." A page with no host copy reads zero, and a store to it is dropped. ([victory-fork docs/fork-ray-tracing.md](https://github.com/fxceless/victory-fork/blob/main/docs/fork-ray-tracing.md)) 2. **Card copies of large title buffers**, with shader writes found by hashing on the card, plus a guard over every view of a physical page: a copy had been guarded at one address only, and a five-minute run counted 0.8–1.0 million writes through another view ([`8dd30ab`](https://github.com/fxceless/victory-fork/commit/8dd30ab472)). Fixes on the same line that match the symptom here: - "Meshlet culling read its scene buffers as the wrong kind of view, so the world drew almost nothing; fixed." ([victory-fork README](https://github.com/fxceless/victory-fork)) - Descriptor records the title copies into its heap as bytes are mirrored before each submission (~40,000 a frame), and a buffer view off a copy's elements gets bytes of its own. With room kept on the card for the first frame's bursts, 98 buffer copies (945 MB) were made where earlier runs made 1, and "the first room renders right" ([`a26859f`](https://github.com/fxceless/victory-fork/commit/a26859fc5f)). - "Light packed by the game's compute shaders was read back through empty copies (sky, probes, fog); fixed for every mip level and layer." (same README) AI use: Claude Code (Claude Opus 5.5) read the forks' docs and commits and wrote this; nothing here was run on XCL.
Author
Owner

@⁠claudetools-gh on GitHub · 2026-11-25 16:41 UTC · original

Follow-up to my probe result above: with the title's by-address buffer views that point into the GPU view redirected to UMA copies, world geometry reaches the depth target and the G-buffer here for the first time. Partial (9 % of the samples), but the cause is confirmed on this card and tree.

Same machine, tree and settings as above, plus two local switches (an experiment, not a design):

  • XCL_GPUVIEW_TRACE=1: counts #70 / #71 buffer views and root views by where their address points. By ~170 s: 13 530 buffer views in a GPU view, 0 in the alias space, 0 elsewhere (15 860 inside UMA); root views 0 outside (4 485 inside). So on this title it is the #70 / #71 views, not root views.
  • XCL_GPUVIEW_MIRROR=1: at #70 / #71, a view whose address is in a GPU view gets a copy inside UMA (64 KiB-aligned, the view's size, capped at 64 MiB), filled page by page from the CPU-side bytes (mirrors::mapped_source, else mirrors::source), and the V# gets the copy's address. Read-only copies are refreshed before each submit (changed 4 KiB blocks only); a UAV copy is filled once. Copies are reused when a range fits inside one. By ~170 s: 1 528 copies, 159 MB, 12 002 reuses, 221 overlapping another, 0 failed.

The probe at an intro frame (~545 s; the title is slow there, under 1 fps):

target without the copies (earlier run) with the copies
2560×1440 depth (D32S8), draws bound 254 1 547
… samples off the clear value (0) 0 % (1 value) 9.0 % (5 212 distinct, max 0.00117)
2560×1440 G-buffer colour (RGBA8), draws bound 73 1 155
… samples off the clear value 0 % (1 value) 9.0 % (3 055 distinct, mean RGB 0.044 / 0.035 / 0.050)

On screen the frame changed from flat grey to a pale, blown-out teal image with shapes in it, which matches what @⁠MacieGx described for an under-lit world with auto-exposure at its floor.

Known gaps of this experiment, which may explain the 9 %: overlapping ranges get separate copies; addresses stored inside buffers are not rewritten; UAV copies are never written back or refilled; views over 64 MiB are cut; texture views made by #70 / #71 are not covered. A proper form is what @⁠MacieGx described (the GPU view as extra windows filled on demand) or a per-64 KiB directory the shaders resolve through; I'll keep this as a local stopgap until one of those lands, and am glad to test it.

AI-assisted.

**@⁠claudetools-gh** on GitHub · 2026-11-25 16:41 UTC · [original](https://github.com/xcl-dev/xcl/issues/697#issuecomment-7168372454) Follow-up to [my probe result above](https://git.gtahub.st/github/xcl-dev--xcl/issues/697): **with the title's by-address buffer views that point into the GPU view redirected to UMA copies, world geometry reaches the depth target and the G-buffer here for the first time.** Partial (9 % of the samples), but the cause is confirmed on this card and tree. Same machine, tree and settings as above, plus two local switches (an experiment, not a design): - `XCL_GPUVIEW_TRACE=1`: counts #70 / #71 buffer views and root views by where their address points. By ~170 s: **13 530 buffer views in a GPU view, 0 in the alias space, 0 elsewhere** (15 860 inside UMA); root views 0 outside (4 485 inside). So on this title it is the #70 / #71 views, not root views. - `XCL_GPUVIEW_MIRROR=1`: at #70 / #71, a view whose address is in a GPU view gets a copy inside UMA (64 KiB-aligned, the view's size, capped at 64 MiB), filled page by page from the CPU-side bytes (`mirrors::mapped_source`, else `mirrors::source`), and the V# gets the copy's address. Read-only copies are refreshed before each submit (changed 4 KiB blocks only); a UAV copy is filled once. Copies are reused when a range fits inside one. By ~170 s: 1 528 copies, 159 MB, 12 002 reuses, 221 overlapping another, 0 failed. The probe at an intro frame (~545 s; the title is slow there, under 1 fps): | target | without the copies (earlier run) | with the copies | |---|---|---| | 2560×1440 depth (D32S8), draws bound | 254 | 1 547 | | … samples off the clear value (0) | 0 % (1 value) | **9.0 %** (5 212 distinct, max 0.00117) | | 2560×1440 G-buffer colour (RGBA8), draws bound | 73 | 1 155 | | … samples off the clear value | 0 % (1 value) | **9.0 %** (3 055 distinct, mean RGB 0.044 / 0.035 / 0.050) | On screen the frame changed from flat grey to a pale, blown-out teal image with shapes in it, which matches what @⁠MacieGx described for an under-lit world with auto-exposure at its floor. Known gaps of this experiment, which may explain the 9 %: overlapping ranges get separate copies; addresses stored inside buffers are not rewritten; UAV copies are never written back or refilled; views over 64 MiB are cut; texture views made by #70 / #71 are not covered. A proper form is what @⁠MacieGx described (the GPU view as extra windows filled on demand) or a per-64 KiB directory the shaders resolve through; I'll keep this as a local stopgap until one of those lands, and am glad to test it. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.