pack_store_into_slot

Function pack_store_into_slot 

Source
pub fn pack_store_into_slot(
    lw: &mut LoraWeights,
    slot: usize,
    name: &str,
    store: &WeightStore,
    peft: &PeftAdapterConfig,
    cfg: &ModelConfig,
    gpu: &dyn GpuBackend,
) -> Result<Vec<Option<LoraLayerWeights>>>
Expand description

Runtime disk swap: audit + pack an already-loaded adapter store into an EXISTING pool slot of lw, in place, and stamp that slot’s name/config/layers. Byte-identical to a startup pack of the same adapter into that slot — same audit, A-contiguous copy, and B row-repack via pack_slot. The slot sub-region is re-zeroed first (a reused slot still holds the prior adapter’s bytes, and pad rows/cols must stay 0 for padded-K correctness). Returns the rebuilt per-layer pairs so the caller can re-install them if the slot is currently active. Like the startup pack, the intermediate store’s device copies leak (small, one-off per swap). Used for the pool-size-1 dynamic-load demo (load a different adapter into the single slot at runtime).