Module rdma_stage

Module rdma_stage 

Source
Expand description

RDMA LoRA staging (spark-model half): turn a peer-staged adapter’s manifest into a set of pool-slot LANDING TARGETS (the only place classify_key + the per-slot offset math live), then drive spark_storage::RdmaLoraLoader to RDMA-load the adapter’s A/B straight into a resident slot for fast rotation. Landing is byte-identical to the disk pack (the loader does the same F16/F32→BF16 convert + B row-repack).

Gated behind $ATLAS_LORA_PEER at the call site; when unset the disk rotation path is unchanged.

Functions§

build_land_targets
Build the landing targets for one adapter’s manifest into pool slot. Each lora_A/lora_B tensor is classified to (layer, module, A|B) and mapped to its byte sub-region pool + slot*slot_bytes + a_off|b_off. The adapter’s real rank r is read from the tensor shape (A=[r,in], B=[out,r]). Rejections from classify_key (GDN / wrong-layer / non-PEFT key) fire here too — never a silent skip.
fetch_adapter_manifest
Fetch a peer-staged adapter’s manifest over the weight_peer control channel (connect → request → read manifest, then drop the connection). Needed to build landing targets before the loader’s own verbs handshake.
rebuild_slot_layers
Rebuild a slot’s per-layer LoraLayerWeights after an in-place RDMA reload — the A/B bytes changed AND the adapter’s r/scale may differ, so the LoraPairs (which bake rank + scale) must be rebuilt, not just re-pointed. Pointers are deterministic (pool + slot*slot_bytes + off); this does NOT touch the GPU. Modules present are those with a target of the matching kind.
slot_bytes
The per-slot byte length (re-exported so the swap path can re-zero exactly one slot’s sub-region before an in-place reload).