D3D12.X: buffer mirrors in sparse windows are written each draw and uploaded again #2394

Open
opened 2026-11-26 05:29:49 +00:00 by github-bot · 0 comments
Owner

@⁠KOLESNiii on GitHub · 2026-11-25 17:43 UTC · original

Low priority (measured). The mirror pages are 78 % of the write-watch dirty pages, but the sparse chunk hashes drop them as unchanged, so they are not uploaded again. The cost is only extra pages in the look and its chunk scan. #2393 (skip unchanged copies) removes it as well. See #2389.

Part of #2389.

When the title has sparse windows, mirror_of puts a new mirror in sparse memory first (super::sparse::alloc, crates/xcl/src/hle/d3d12x/list_x.rs:3524 on main 3f4495a). It falls back to the coherent window only when that fails. Each draw's sync then writes into sparse-window pages from the CPU. As far as I can tell from the code, the next submit's write-watch look (title_textures::refresh_once → sparse::before_execute) finds those pages dirty, scans them and uploads them to the tiles' video memory. Every draw's copy is therefore copied a second time, and it adds pages to the look that #582 is about.

Proposal: allocate mirrors in a committed coherent window (Uma::alloc), which the GPU reads in place, and use sparse memory only when the coherent window has no room. Before changing it, confirm with #2391's counters and XCL_ACTIVITY that mirror pages really show up among the sparse dirty pages.

Found by code reading with Claude Code (Claude Opus 5.5); not verified on a run yet.

**@⁠KOLESNiii** on GitHub · 2026-11-25 17:43 UTC · [original](https://github.com/xcl-dev/xcl/issues/2394) > **Low priority (measured).** The mirror pages are 78 % of the write-watch dirty pages, but the sparse chunk hashes drop them as unchanged, so they are **not** uploaded again. The cost is only extra pages in the look and its chunk scan. #2393 (skip unchanged copies) removes it as well. See https://git.gtahub.st/github/xcl-dev--xcl/issues/2389. Part of #2389. When the title has sparse windows, `mirror_of` puts a new mirror in sparse memory first (`super::sparse::alloc`, `crates/xcl/src/hle/d3d12x/list_x.rs:3524` on `main` 3f4495a). It falls back to the coherent window only when that fails. Each draw's sync then writes into sparse-window pages from the CPU. As far as I can tell from the code, the next submit's write-watch look (`title_textures::refresh_once` → `sparse::before_execute`) finds those pages dirty, scans them and uploads them to the tiles' video memory. Every draw's copy is therefore copied a second time, and it adds pages to the look that #582 is about. **Proposal:** allocate mirrors in a committed coherent window (`Uma::alloc`), which the GPU reads in place, and use sparse memory only when the coherent window has no room. Before changing it, confirm with #2391's counters and `XCL_ACTIVITY` that mirror pages really show up among the sparse dirty pages. *Found by code reading with Claude Code (Claude Opus 5.5); not verified on a run yet.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:29:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.