Module weight_peer

Module weight_peer 

Source

Structs§

WeightManifest
A staged model’s manifest: the geometry the client needs to reconstruct a byte-identical WeightStore. Published as length-prefixed JSON right after the client’s model request. The per-shard (base, rkey) MR handles ride the verbs handshake separately (see the module doc).
WeightPeerConfig
Peer configuration: the RDMA rails, the memory ceiling, and how the peer resolves a model request to a directory.
WeightTensorRecord
One tensor’s placement inside a staged model, mirroring the safetensors header exactly: offset_in_shard is the ABSOLUTE file offset (8-byte size prefix + header + the tensor’s data-section start), len is the raw contiguous byte count (data_offsets[1] - data_offsets[0]). The client RDMA-READs exactly [shard_base + offset_in_shard .. + len).

Constants§

MODEL_REQUEST_MAX
Longest model id/path the wire accepts (a corrupt/hostile length must not trigger a huge allocation).

Functions§

rail_for_tensor
Rail selection for a tensor under dual-rail striping: tensor N is served over rail N % n_rails. Factored out (un-gated) so the striping is unit- testable off the RDMA path — the client’s read loop calls this so the tested logic and the shipped logic are the same. n_rails is clamped to >= 1.
read_model_request
Read a model request written by write_model_request.
read_weight_manifest
Read + parse a length-prefixed manifest. Shared by the client tier.
serve
Serve staged models on addr until interrupted. One thread per connection; blocking. Intended to run as its own process (atlas-weight-peer).
tensor_remote_addr
Absolute peer virtual address of a tensor’s first byte: the shard’s whole- file REMOTE_READ MR base plus the tensor’s ABSOLUTE in-shard offset (the safetensors data-section offset, which already includes the 8-byte size prefix + header). The client RDMA-READs [addr .. addr + len). Factored out (un-gated) so the address math is unit-testable off the RDMA path.
write_model_request
Wire form of the model request: [u32 len][len bytes UTF-8 id/path].
write_weight_manifest
Serialize + frame a manifest as [u32 len][len bytes JSON].