Skip to main content

Module sambaflow

Module sambaflow 

Source
Expand description

largo emit rdu --format sambaflow — the authored tensor program as the PyTorch module SambaFlow ingests.

SambaFlow’s front end takes PyTorch, so the vendor-format artifact for that front door is a torch.nn.Module whose forward mirrors the program’s tensor statements ONE OP PER STATEMENT, in dataflow order, plus a weights manifest (variable → shape, role, checkpoint tensor name where the naming convention knows it) and a compile.py scaffold marked TEMPLATE where it calls the vendor API. It is an emitted vendor-ingestion artifact — like an emitted .cu — and never our compute path: nothing of ours runs from the Python, and the header says so.

The reader (read_tensor_sentences) walks the program’s sentences in the tensor sugar the parser defines (Let Y be rmsnorm of X with weight W across H heads. and its siblings); the real parser is asked to accept the program first, and the one IR’s lift of it (TensorGraph::lift_source) is asked to agree on the ops they both know, so the sentence reader can never drift silently from the language. Every spelling mirrors the parser’s DESUGAR — the rmsnorm eps, the NEOX rope pairs with the partial-rotary pass-through, attention’s 1/√hd with kvh = (head-1)/(H/KV), decay’s (1+e^u)^{alog}, the conv ring shift, the Gated DeltaNet recurrence with kb = ((h-1) mod hk)·d — and rdu_sambaflow_emit_lock checks the module against the VM’s logits when torch is present. An op without a spelling is refused BY NAME.

Structs§

TorchArtifact

Enums§

OpKind
TensorSentence
One sentence of a tensor program.

Constants§

QWEN38_OPS
The ops the authored Qwen3.8 decode step needs; every one has a spelling in torch_spelling.
TEMPLATE_MARK
The mark on every line of compile.py that calls an API nobody here has run.
VENDOR_HEADER
The first line of every emitted file.

Functions§

emit_torch_module
The program as a PyTorch module, its weights manifest and a SambaFlow compile scaffold, or a refusal naming what has no spelling.
gguf_name
The checkpoint tensor a LOGOS weight variable comes from, by the extractor’s naming convention (examples/extract_qwen38.rs): Wq3 → blk.3.attn_q.weight on an attention layer, Wq0 → blk.0.attn_qkv.weight on a Gated DeltaNet layer. None for a name the convention does not cover.
read_tensor_sentences
Every sentence of a tensor program, in order. A sentence outside the tensor sugar is an error naming it.
torch_spelling
The torch expression an op is spelled with (its helper’s call shape), or a refusal naming the op.