nemo_rl.data_plane.nixl.blob_format#
Blob codec: many values → one self-describing byte blob, no per-tensor serialization.
Tensors and numpy arrays are stored as their raw contiguous bytes. What the bytes mean (kind, dtype, shape) lives in two places that we own: the per-entry location meta TransferQueue hands back on every get, and the blob’s trailing index so a unit can read its own blobs without the controller (scan, checkpoint shards). Only non-tensor objects are pickled.
Layout::
[ entry_0 | pad | entry_1 | pad | ... | index (msgpack) | footer 16 B ]
Entries are 64-byte aligned.
Module Contents#
Classes#
Functions#
Write only the index and footer ( |
|
Reconstruct a value from its bytes. Tensors and arrays are zero-copy views. |
|
Copy a decoded zero-copy view out of the transfer buffer. |
|
|
|
|
|
Data#
API#
- nemo_rl.data_plane.nixl.blob_format.ALIGN#
64
- nemo_rl.data_plane.nixl.blob_format.MAGIC#
1314276432
- nemo_rl.data_plane.nixl.blob_format.VERSION#
3
- nemo_rl.data_plane.nixl.blob_format._FOOTER_FMT#
‘<IHHII16s’
- nemo_rl.data_plane.nixl.blob_format.FOOTER_SIZE#
‘calcsize(…)’
- nemo_rl.data_plane.nixl.blob_format._FOOTER_V2_FMT#
‘<IHHII’
- nemo_rl.data_plane.nixl.blob_format.FOOTER_V2_SIZE#
‘calcsize(…)’
- nemo_rl.data_plane.nixl.blob_format.NO_TAG#
‘bytes(…)’
- nemo_rl.data_plane.nixl.blob_format.KIND_TENSOR#
‘t’
- nemo_rl.data_plane.nixl.blob_format.KIND_NUMPY#
‘n’
- nemo_rl.data_plane.nixl.blob_format.KIND_PICKLE#
‘p’
- nemo_rl.data_plane.nixl.blob_format._align_up(n: int) int#
- class nemo_rl.data_plane.nixl.blob_format.Entry#
- key: str#
None
- off: int#
None
- len: int#
None
- kind: str#
None
- dtype: str | None#
None
- shape: tuple[int, ...] | None#
None
- meta() dict[str, Any]#
Location meta stored by TQ as
custom_backend_meta(blob id added by the client).
- static from_meta(
- key: str,
- m: dict[str, Any],
- class nemo_rl.data_plane.nixl.blob_format.BlobPlan#
- keys: list[str]#
None
- buffers: list[memoryview]#
None
- keepalive: list[Any]#
None
- entries: list[nemo_rl.data_plane.nixl.blob_format.Entry]#
None
- index_bytes: bytes#
None
- nbytes: int#
None
- tag: bytes#
None
- property index_off: int#
- nemo_rl.data_plane.nixl.blob_format._tensor_bytes(t: torch.Tensor) tuple[memoryview, Any]#
- nemo_rl.data_plane.nixl.blob_format._numpy_bytes(a: numpy.ndarray) tuple[memoryview, Any]#
- nemo_rl.data_plane.nixl.blob_format.encode_value(
- key: str,
- v: Any,
- nemo_rl.data_plane.nixl.blob_format.plan(
- keys: Sequence[str],
- values: Sequence[Any],
- tag: bytes = NO_TAG,
- nemo_rl.data_plane.nixl.blob_format.write_tail(
- p: nemo_rl.data_plane.nixl.blob_format.BlobPlan,
- out: memoryview,
Write only the index and footer (
len(p.index_bytes) + FOOTER_SIZEbytes).For a blob whose values are sent separately.
outmaps to blob offsetp.index_off.
- nemo_rl.data_plane.nixl.blob_format.write(
- p: nemo_rl.data_plane.nixl.blob_format.BlobPlan,
- out: memoryview,
- nemo_rl.data_plane.nixl.blob_format._torch_dtype(name: str) torch.dtype#
- nemo_rl.data_plane.nixl.blob_format.decode_entry(
- view: memoryview,
- e: nemo_rl.data_plane.nixl.blob_format.Entry,
Reconstruct a value from its bytes. Tensors and arrays are zero-copy views.
- nemo_rl.data_plane.nixl.blob_format.materialize(v: Any) Any#
Copy a decoded zero-copy view out of the transfer buffer.
(index_off, index_len, tag)from a v3 or v2 footer at the end ofblob.
- nemo_rl.data_plane.nixl.blob_format.read_index(
- blob: memoryview,
- nemo_rl.data_plane.nixl.blob_format.read_index_file(
- f: Any,
- off: int,
- nbytes: int,
- Func:
read_indexof the blob stored atoffin binary filef.
- nemo_rl.data_plane.nixl.blob_format._entries(
- raw: bytes,