verify_slot_h_intermediates

Function verify_slot_h_intermediates 

Source
pub fn verify_slot_h_intermediates(
    slot_idx: usize,
    num_drafts: usize,
    uniform_verify: bool,
) -> usize
Expand description

Number of per-token H-state intermediates the verify pools allocate for pool slot slot_idx: exactly the slot’s draft capacity (K-1 snapshots for a K-row verify). uniform_verify (DFlash-γ pools, whose verify width does not follow the MTP ladder) sizes every slot at the full num_drafts.

WHY K-1 and not K (2026-08-16 audit): no verify arm ever writes OR reads H intermediate index K-1. The fused WY kernels write Hi_0..Hi_{K-2} plus the final H in place (gdn_decode_wy{2,3,4}, wyn/wy17, the strided _snap twins NULL-skip index K-1), the single-seq K=2/3/4 arms and the exact arm skip the dead snapshot explicitly, and the sequential fallback now skips t = K-1 too. Every reader is bounded at index K-2: commit_accepted_prefix pins the reachable index to [0, k-2], rollback_ssm_states validates against the vec length with callers guaranteeing a rejected draft, and start_rollback_and_checkpoint_async is only called with 1..=K-1 (index ≤ K-2). See the reader enumeration in trait_decode_batched_conv_gdn.rs.

Only the H side tiers. The CONV intermediates stay UNIFORM at num_drafts + 1 per slot: the batched conv verify kernel (gdn_verify_fused_conv_kn_batched) requires a uniform cross-sequence snapshot stride (checked against the actual pointers in trait_decode_batched_conv_gdn_multi.rs) and writes all K snapshots — tiering conv would silently decline the two-launch fast path for every spec batch spanning the tier boundary (all n >= 9). Conv is ~5% of the blob, so the forgone saving is ~0.35 GiB at 32 slots while the H side carries the other 6.75 GiB.