IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo struct

PipelineBody

struct PipelineBody

Builder for declarative pipeline body specifications.

Use as a context manager: with PipelineBody() as b:. Accumulates logical OpDesc entries via role-typed methods and combinators. Call b.done() to finalize the builder and return the op list for annotate_ops() and subsequent scheduling.

Implemented traits

AnyType, Deinitable, Movable

Methods

__init__

def __init__(out self)

__enter__

def __enter__(var self) -> Self

Enable with PipelineBody() as b: syntax for scoped building.

load

def load(mut self, tag: Int, *, ch: Int = Int(-1), stage: Int = Int(0), sub: Int = Int(0), k: KOffsetKind = KOffsetKind.NONE)

Append a global load (DRAM → LDS or DRAM → registers).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • sub (Int): Subtile index within the stage (defaults to 0).
  • k (KOffsetKind): How to compute the K dimension offset for loads (defaults to KOffsetKind.NONE).

store

def store(mut self, tag: Int, *, ch: Int = Int(-1), stage: Int = Int(0), sub: Int = Int(0))

Append a shared memory store (registers → LDS).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • sub (Int): Subtile index within the stage (defaults to 0).

frag

def frag(mut self, tag: Int, *, ch: Int = Int(-1), stage: Int = Int(0), sub: Int = Int(0))

Append a fragment load (LDS → registers).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • sub (Int): Subtile index within the stage (defaults to 0).

compute

def compute(mut self, tag: Int, *, stage: Int = Int(0), sub: Int = Int(0))

Append a compute/MMA op.

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • sub (Int): Subtile index within the stage (defaults to 0).

barrier

def barrier(mut self)

Append a barrier.

op

def op(mut self, tag: Int, *, ch: Int = Int(-1), stage: Int = Int(0), sub: Int = Int(0), k: KOffsetKind = KOffsetKind.NONE)

Append a generic logical op (escape hatch for non-standard ops).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • sub (Int): Subtile index within the stage (defaults to 0).
  • k (KOffsetKind): How to compute the K dimension offset for loads (defaults to KOffsetKind.NONE).

fan

def fan[N: Int](mut self, tag: Int, *, ch: Int = Int(-1), stage: Int = Int(0), k: KOffsetKind = KOffsetKind.NONE)

Append N ops with subtile=0..N-1 (fan-out pattern).

Parameters:

  • N (Int): Number of ops to append (subtile ranges from 0 to N-1).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).
  • stage (Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0).
  • k (KOffsetKind): How to compute the K dimension offset for loads (defaults to KOffsetKind.NONE).

grid

def grid[M: Int, N: Int](mut self, tag: Int, *, ch: Int = Int(-1))

Append M×N ops with stage=i, subtile=j (2D grid pattern).

First dimension maps to stage (0..M-1), second to subtile (0..N-1). For flat patterns where only subtile varies, use fan[M*N] instead.

Parameters:

  • M (Int): Number of stage values (stage ranges from 0 to M-1).
  • N (Int): Number of subtile values (subtile ranges from 0 to N-1).

Args:

  • tag (Int): Kernel-specific op tag (0-127) used by _emit dispatch.
  • ch (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1).

extend

def extend(mut self, mut other: Self)

Absorb all ops from another builder (for hierarchical composition).

Args:

  • other (Self): Builder whose ops are appended to this one.

done

def done(self) -> List[OpDesc]

Return the logical op list.

Returns:

List[OpDesc]