From f3cd0a5bc017f1f970bd13b6f5be9ea6be617a29 Mon Sep 17 00:00:00 2001 From: Prime <215761102+Prime1997@users.noreply.github.com> Date: Wed, 25 Nov 2026 23:23:49 -0800 Subject: [PATCH] D3D12.X: the sparse windows' line counts mapped tiles the CPU never wrote A title that commits a pool up front gets a video-memory tile for every page at once (Series S profile of a retail title: 70,724 tiles in 2 s). The line says how many of the windows' own tiles never had a CPU write sent to them, so the cost of mapping at commit can be read from a log. No behaviour change. Co-Authored-By: Claude Fable 5.2 --- crates/xcl/src/hle/d3d12x/sparse.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs index 7ada56c6d8..e80e8dc97d 100644 --- a/crates/xcl/src/hle/d3d12x/sparse.rs +++ b/crates/xcl/src/hle/d3d12x/sparse.rs @@ -116,6 +116,20 @@ struct TileEntry { gen: u32, } +/// The mapped tiles of the windows' own (not GPU views), and how many of them hold video memory +/// no CPU write was ever sent to: every committed page still has no `sent` hashes. Such a tile +/// holds zeros unless the GPU wrote to it. +fn never_sent(mapped: &FxHashMap) -> (usize, usize) { + let (mut own, mut unsent) = (0, 0); + for e in mapped.values().filter(|e| e.src == 0) { + own += 1; + if e.sent.iter().all(|p| p.is_none()) { + unsent += 1; + } + } + (own, unsent) +} + /// the last `TileEntry::gen` given out static TILE_GEN: AtomicU32 = AtomicU32::new(0); @@ -4241,6 +4255,8 @@ impl State { let us = SUBMIT_US.fetch_add(t0.elapsed().as_micros() as u64, Ordering::Relaxed) + t0.elapsed().as_micros() as u64; if n.is_power_of_two() && n >= 16 { crate::xlog_info!("sparse windows: {n} submits, {} MB of CPU writes uploaded, {} ms spent, {} tiles mapped", b >> 20, us / 1000, s.mapped.len()); + let (own, unsent) = never_sent(&s.mapped); + crate::xlog_info!("sparse windows: {unsent} of the windows' own {own} mapped tiles ({} of {} MB) never got a byte from the CPU (zeros, or what the GPU wrote)", unsent * TILE >> 20, own * TILE >> 20); let ms = |x: &AtomicU64| x.load(Ordering::Relaxed) / 1000; let c = &s.counts; crate::xlog_info!(