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 function

verify_schedule

def verify_schedule(program: PipelineProgram, config: PipelineConfig, lgkm_per_a: Int, lgkm_per_b: Int, wait_lgkm_first: Int, wait_vm_last: Int)

Verify structural invariants of a finalized pipeline schedule.

Runs at compile time, zero runtime cost. Catches bugs in schedule construction that would otherwise surface as silent GPU miscomputes.

Checks:

  1. Block completeness: every block has exactly 1 MMA op
  2. Wait count bounds: wait values are non-negative and bounded
  3. Distribution invariant: uniform global loads when max_globals > 0
  4. Stage consistency: fragment/global ops use correct stage for half
  5. Prefetch coverage: at least one global is marked prefetch
  6. Completion coverage: each half has a completion load
  7. Warp stagger LDS safety: no cross-block prefetch/fragment race

Note: these are structural checks on the generated program. They do not verify that the execution ordering respects all LDG dependency edges; that is enforced by the scheduler (greedy_schedule / optimal_schedule) which only places ops whose d=0 predecessors are already scheduled.

Args:

  • ​program (PipelineProgram): The finalized PipelineProgram to verify.
  • ​config (PipelineConfig): Pipeline configuration providing block structure geometry and partition count.
  • ​lgkm_per_a (Int): Per-channel lgkm cost for channel 0 loads, used to bound wait_lgkm_first. 0 means unknown (skips the bound check).
  • ​lgkm_per_b (Int): Per-channel lgkm cost for channel 1 loads, used to bound wait_lgkm_first. 0 means unknown (skips the bound check).
  • ​wait_lgkm_first (Int): The lgkm wait count applied at the first block of each half. 255 means no wait is emitted.
  • ​wait_vm_last (Int): The vm wait count applied at the last block of each half.