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

Open
opened 2026-11-25 17:43:21 +00:00 by KOLESNiii · 0 comments
KOLESNiii commented 2026-11-25 17:43:21 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-25T17:43:21Z.


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://github.com/xcl-dev/xcl/issues/2389#issuecomment-7170173282.

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.

<!-- greyfinch-sync:ivall/xcl:issue:6610266544 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2394). Originally posted by [KOLESNiii](https://github.com/KOLESNiii) on 2026-11-25T17:43:21Z. --- > **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://github.com/xcl-dev/xcl/issues/2389#issuecomment-7170173282. 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.*
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#2384
No description provided.