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

Pipe

struct Pipe[N: Int]

A compile-time sequence of N pipeline operations.

Build sequences using the >> operator to chain ops into a pipeline:

pipe(ld()) >> st() >> br() >> frag[0]() >> sb()

Convert to schedule entries for a given phase:

my_pipe.as_schedule[Phase.PROLOGUE]()

Concatenate two pipes:

pipe_a >> pipe_b   # Pipe[A+B]

Fields

  • ops (Array[OpDesc, N]):

Implemented traits

AnyType, Copyable, Deinitable, Movable

Methods

__init__

def __init__(out self)

__rshift__

def __rshift__(self, op: OpDesc) -> Pipe[(N + Int(1))]

Append a single op: pipe >> op -> Pipe[N+1].

Returns:

Pipe[(N + Int(1))]

def __rshift__[M: Int](self, other: Pipe[M]) -> Pipe[(N + M)]

Concatenate two pipes: Pipe[N] >> Pipe[M] -> Pipe[N+M].

Returns:

Pipe[(N + M)]

as_schedule

def as_schedule[phase: Phase](self) -> Array[ScheduleEntry, N]

Convert to schedule entries with sequential time slots.

Returns:

Array[ScheduleEntry, N]

def as_schedule[phase: Phase](self, offset: Int) -> Array[ScheduleEntry, N]

Convert to schedule entries with time slots starting at offset.

Returns:

Array[ScheduleEntry, N]

emit_into

def emit_into[MaxN: Int, phase: Phase](self, mut entries: Array[ScheduleEntry, MaxN], offset: Int = Int(0)) -> Int

Write ops into a larger schedule array starting at offset.

Returns the new offset (offset + N), allowing chained writes.

Returns:

Int

emit_into_body

def emit_into_body(self, mut body: LoopBody, offset: Int = Int(0)) -> Int

Write ops into a LoopBody's ops array as OpNodes.

Returns the new offset (offset + N).

Returns:

Int