From a3fdbde4e84327f7f44096a3b930b7cbc5bdae8d Mon Sep 17 00:00:00 2001 From: bmjask <> Date: Thu, 26 Nov 2026 15:43:49 -0800 Subject: [PATCH] D3D12.X: model immutable sparse upload plans Keep only the immutable observation and planned-page identities that survive into the coordinated sparse batch implementation. Temporary plan ownership and commit wrappers are omitted. Assisted-by: Codex (GPT-5.6-sol) --- crates/xcl/src/hle/d3d12x/sparse.rs | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/crates/xcl/src/hle/d3d12x/sparse.rs b/crates/xcl/src/hle/d3d12x/sparse.rs index 1e01061a38..8af9010ffa 100644 --- a/crates/xcl/src/hle/d3d12x/sparse.rs +++ b/crates/xcl/src/hle/d3d12x/sparse.rs @@ -388,6 +388,45 @@ impl WorkClaimLedger { } } +/// Point-in-time identities needed to prove that planning and a later serialized upload commit +/// still refer to the same sparse page. `source` names the observed CPU page by chunk hash rather +/// than retaining a raw pointer across the unlocked interval. Title writes are outside sparse +/// state/upload exclusion, so a future commit must own or revalidate the bytes it actually copies. +#[derive(Clone, Debug, Eq, PartialEq)] +#[allow(dead_code)] +struct UploadPageObservation { + page: usize, + pool: (u32, u32), + hole: bool, + sent: Option<[u64; CHUNKS]>, + source: [u64; CHUNKS], +} + +#[derive(Clone, Debug, Eq, PartialEq)] +#[allow(dead_code)] +struct PlannedUploadPage { + page: usize, + tile: usize, + pool: (u32, u32), + reasons: WorkReasons, + zero: bool, + dirty: bool, + dirty_ranges: Vec<(usize, usize)>, + sent: Option<[u64; CHUNKS]>, + source: [u64; CHUNKS], +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[allow(dead_code)] +enum UploadPlanInvalid { + StateGeneration, + MappingEpoch, + MissingPage, + Mapping, + SentHashes, + SourceHashes, +} + #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub(super) enum PreparationOutcome { Ready,