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

BarrierStrategy

struct BarrierStrategy

How the schedule emits barriers and barrier-adjacent fences.

Fields: minimal: Suppress per-block s_barriers and set_prio pairs; emit s_barrier only at top-of-half and the first cross-stage block. See ScheduleConfig.minimal_barriers. omit_set_prio: When minimal=True, drop the pre-MMA s_setprio[1] entirely. See ScheduleConfig.omit_mma_set_prio. sched_barrier_mask: Bitmask of which blocks get trailing schedule_barrier fences. Default: 0b01010101. wrap_waits_sched_barrier: Wrap each contiguous wait/barrier group with schedule_barrier on both sides. See ScheduleConfig.wrap_waits_with_sched_barrier. barrier_before_pre_ops: Move the pre_sync + barrier section ahead of the frag/global section in each block. See ScheduleConfig.barrier_before_pre_ops.

Fields​

  • ​minimal (Bool): Suppresses per-block s_barriers and set_prio pairs; emits s_barrier only at top-of-half and the first cross-stage block. See ScheduleConfig.minimal_barriers.
  • ​omit_set_prio (Bool): When minimal=True, drops the pre-MMA s_setprio[1] entirely. See ScheduleConfig.omit_mma_set_prio.
  • ​sched_barrier_mask (Int): Bitmask of which blocks get trailing schedule_barrier fences. Default: 0b01010101.
  • ​wrap_waits_sched_barrier (Bool): Wraps each contiguous wait/barrier group with schedule_barrier on both sides. See ScheduleConfig.wrap_waits_with_sched_barrier.
  • ​barrier_before_pre_ops (Bool): Moves the pre_sync + barrier section ahead of the frag/global section in each block. See ScheduleConfig.barrier_before_pre_ops.

Implemented traits​

AnyType, Copyable, ImplicitlyDestructible, Movable

Methods​

default​

static default() -> Self

Returns the ping-pong default: full barriers, no minimal mode.

Returns:

Self: A BarrierStrategy matching the framework default.

minimal_no_set_prio​

static minimal_no_set_prio(sched_barrier_mask: Int = 0, wrap_waits: Bool = False, barrier_before_pre_ops: Bool = False) -> Self

Returns the cross-stage-rotation default: minimal barriers, no set_prio.

Args:

  • ​sched_barrier_mask (Int): Bitmask of which blocks get trailing schedule_barrier fences.
  • ​wrap_waits (Bool): Wrap wait/barrier groups with schedule_barrier on both sides.
  • ​barrier_before_pre_ops (Bool): Move pre_sync + barrier ahead of the frag/global section in each block.

Returns:

Self: A BarrierStrategy configured for the cross-stage rotation kernel pattern.