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 package

pipeline

Generic compile-time software pipelining for GPU kernels: schedule generation and verification.

This package simplifies defining a pipelined GPU kernel schedule: the ordered list of operations in a loop (global loads, shared-memory reads, MMA instructions, barriers, and hardware waits) for each execution phase. For example, in a tiled matmul kernel, that ordering overlaps fetching the next A/B tile from DRAM into LDS with multiplying the current tile in registers. The schedule splits into a prologue (prime buffers before overlap is possible), a kernel phase (steady overlap on every iteration), and an epilogue (drain without issuing new loads).

You describe the operations in one iteration β€” loads, fragment reads, MMA β€” and a per-target cost model for your GPU. At comptime, this package builds a dependency graph from those declarations, schedules the operations, derives hardware wait counts and barriers, and verifies structural safety. You consume the result as a flat ScheduleEntry list that unrolls into straight-line code with no runtime scheduling cost.

Import from submodules directly:

from pipeline.types import OpDesc, ResourceKind, OpRole
from pipeline.config import PipelineConfig, ScheduleConfig
from pipeline.compiler import PipelineSchedule, compile_schedule
from pipeline.schedulers import optimal_schedule_with_halves
from pipeline.program_builder import verify_schedule, build_kernel_program

Modules​

  • ​compiler: Pipeline schedule compiler: PipelineSchedule trait, ScheduleCompiler struct, and compile_schedule function.
  • ​config: Pipeline configuration structs: LoopCarriedSpec, BlockSizing, FragOrder, SchedulingStrategy, ScheduleConfig, WarpStaggerRule, PipelineConfig, and TargetProfile.
  • ​debug: Diagnostic tooling for compiled pipeline schedules.
  • ​dependency_graph: Loop Dependency Graph (LDG) types: OpNode and LoopBody.
  • ​geometry: Kernel-geometry-derived scheduling constants.
  • ​phase_derivation: Phase derivation: recipes, default prologue/kernel/epilogue, and edge rules.
  • ​pipeline_dsl: Pipeline DSL: ScheduleEntry, EntryBuilder, Pipe, pipe, annotate_pipe.
  • ​program: MMABlockSpec and PipelineProgram β€” declarative pipeline program representation.
  • ​program_builder: Program builder: constructs PipelineProgram from a loop body.
  • ​schedulers: Scheduling algorithms: greedy and within-iteration optimal schedulers.
  • ​strategies: Strategy structs that group related ScheduleConfig flags.
  • ​types: Core types for the pipeline scheduling framework.