IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/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 (InlineArray[OpDesc, N]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable

Methods​

__init__​

__init__(out self)

__rshift__​

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

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

Returns:

Pipe[(N + 1)]

__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​

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

Convert to schedule entries with sequential time slots.

Returns:

InlineArray[ScheduleEntry, N]

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

Convert to schedule entries with time slots starting at offset.

Returns:

InlineArray[ScheduleEntry, N]

emit_into​

emit_into[MaxN: Int, phase: Phase](self, mut entries: InlineArray[ScheduleEntry, MaxN], offset: 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​

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

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

Returns the new offset (offset + N).

Returns:

Int