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

PipelineProgram

struct PipelineProgram

A pipeline schedule phase as a sequence of MMA block specifications.

Separates schedule definition (what blocks to emit) from schedule expansion (writing ScheduleEntry values into a List). This makes schedules declarative data rather than imperative code.

Per-block emission has two paths:

  • Default: each MMABlockSpec is expanded via the flag-driven template in MMABlockSpec.expand_to_list. The *_strategy flags on ScheduleConfig control op order, barrier placement, wrap fences, etc.
  • Override: schedules can supply a parallel explicit_blocks list (one List[OpDesc] per block) that bypasses the template entirely. When explicit_blocks[i] is non-empty the framework emits those ops verbatim β€” gives schedules full control over per-block emission shape without needing new flags.

explicit_blocks defaults to empty (every block uses the template). Schedules opt in by overriding build_explicit_blocks on the PipelineSchedule trait.

Fields​

  • ​blocks (List[MMABlockSpec]):
  • ​explicit_blocks (List[List[OpDesc]]): Per-block override op lists. Empty entries fall back to the template; non-empty entries are emitted verbatim. Defaults to empty so every block uses the template.
  • ​trailing_barrier (Bool):

Implemented traits​

AnyType, Copyable, ImplicitlyDestructible, Movable

Methods​

__init__​

__init__(out self, num_blocks: Int = 0, *, trailing_barrier: Bool = False)

total_entries​

total_entries(self) -> Int

Count total schedule entries this program will expand to.

Returns:

Int

block_start​

block_start(self, block_idx: Int) -> Int

Return the starting entry index for the given block.

Returns:

Int

mma_entry​

mma_entry(self, block_idx: Int) -> Int

Return the entry index of the MMA op in the given block.

For explicit-override blocks: scans the op list for the first COMPUTE-role op. For template blocks: uses mma_position.

Returns:

Int

expand_to_list​

expand_to_list(self, phase: Phase) -> List[ScheduleEntry]

Expand all blocks into a List of schedule entries.

For each block: emit explicit_blocks[i] verbatim if non-empty, otherwise call the block's flag-driven expand_to_list.

Returns:

List[ScheduleEntry]