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

sched_barrier_pairs

def sched_barrier_pairs[pairs: Int, valu_cnt: Int, group: Int]()

Emits pairs schedule groups of shape [1 MFMA, valu_cnt VALU].

Each call expands to two schedule_group_barrier invocations under sync_id=group: one declaring "1 MFMA in this group" and one declaring "valu_cnt VALUs in this group". pairs > 1 recurses to emit additional pairs in the same sync_id, all of which LLVM orders relative to each other.

Note valu_cnt is the count of VALU instructions in each group, not a VALU-to-MFMA ratio; LLVM derives the interleave from the group declaration. Mojo's underlying schedule_group_barrier(mask, size, sync_id) docstring labels size as a "repeat count" β€” that is misleading; it is the instruction count per group.

Parameters:

  • ​pairs (Int): Number of (MFMA, VALU) groups to emit, all sharing sync_id=group.
  • ​valu_cnt (Int): VALU instructions per group.
  • ​group (Int): IGroupLP sync_id. Reuse within one cluster's pair sequence; pick distinct ids for distinct clusters so their constraints stay independent. 1-10 typical for MHA main+epilogue.