derive_kv_ns

Function derive_kv_ns 

Source
pub fn derive_kv_ns(
    model_fp: u64,
    layout: &GroupLayout,
    elem_bytes: u32,
    block_size: u32,
    head_dim: u32,
    client_salt: u64,
) -> NonZeroU64
Expand description

2026-09-25: Derive the KV paging namespace: FNV-1a/64 over fixed-width [tag][8-byte LE] records. A change to the fields or their order must bump KV_NS_VERSION:

tagfieldtagfieldtagfield
0x00KV_NS_VERSION0x04block_size0x08num_kv_heads
0x01model_fp0x05head_dim0x09fs_block_size
0x02KV_DOMAIN0x06num_layers0x0agroup_stride
0x03elem_bytes0x07num_blocks0x0bclient_salt

model_fp is ModelFingerprint::derive_kv in metrale-model-engine: model type, quantization identity, METRALE_MODEL_ID and geometry. A hash of 0 is replaced by FNV_OFFSET.