spark_storage/
model_dims.rs

1// SPDX-License-Identifier: AGPL-3.0-only
2
3//! `ModelDims` — model-shape descriptor threaded through every layer's
4//! forward signature. Lives in spark-storage because the high-speed-
5//! swap orchestrator was the original consumer, but the type itself
6//! has no GPU state and must remain compilable on macOS / no-cuda
7//! builds where the swap orchestrator isn't reachable.
8
9/// Per-call dimensions describing the model the orchestrator serves.
10#[derive(Clone, Copy, Debug)]
11pub struct ModelDims {
12    pub num_layers: u32,
13    pub max_blocks_per_layer: u32,
14    pub num_q_heads: u16,
15    pub num_kv_heads: u16,
16    pub head_dim: u16,
17    pub block_size: u16,
18    /// Config-derived model fingerprint (spark-model's `ModelFingerprint`,
19    /// KV convention `derive_kv`: blob_bytes = 0) — the per-model identity
20    /// the KV paging namespace folds (`kv_paging::ns::derive_kv_ns`) so two
21    /// models sharing one paging peer can never collide. `None` when the
22    /// loader could not derive one (or in geometry-only tests/benches);
23    /// `ATLAS_KV_PAGING=1` then fails fast at connect unless
24    /// `ATLAS_KV_PAGING_NS` is set explicitly. Unread on every other path.
25    pub model_fp: Option<std::num::NonZeroU64>,
26}