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

WaitStrategy

struct WaitStrategy

How the schedule derives and places vmcnt/lgkmcnt waits.

Fields: auto_waits: Auto-derive wait counts from program structure. drain_lgkm_mask: Per-block bitmask for selective LDS drains. auto_drain: Auto-derive drain_lgkm_mask from channel analysis. wait_lgkm_first: Manual wait_lgkm override (used when auto_waits=False). 255 = unset. wait_vm_last: Manual wait_vm override. lgkm_after_last: Insert wait_lgkm(0) after the last block's barrier. inter_block_lgkm_drain: Emit wait_lgkm(0) at non-top, non-cross interior block starts. partial_prologue_drain: Skip standard wait_vm(0) drains in the framework prologue (kernel emits its own partial drains via bootstrap_frags).

Fields​

  • ​auto_waits (Bool): Auto-derives wait counts from program structure.
  • ​drain_lgkm_mask (Int): Per-block bitmask for selective LDS drains.
  • ​auto_drain (Bool): Auto-derives drain_lgkm_mask from channel analysis.
  • ​wait_lgkm_first (Int): Manual wait_lgkm override (used when auto_waits=False). 255 means unset.
  • ​wait_vm_last (Int): Manual wait_vm override for the last block.
  • ​lgkm_after_last (Bool): Inserts wait_lgkm(0) after the last block's barrier.
  • ​inter_block_lgkm_drain (Bool): Emits wait_lgkm(0) at non-top, non-cross interior block starts.
  • ​partial_prologue_drain (Bool): Skips standard wait_vm(0) drains in the framework prologue (kernel emits its own partial drains via bootstrap_frags).

Implemented traits​

AnyType, Copyable, ImplicitlyDestructible, Movable

Methods​

default​

static default() -> Self

Returns the ping-pong default: auto waits, no inter-block drain.

Returns:

Self: A WaitStrategy matching the framework default.

auto_with_inter_block_drain​

static auto_with_inter_block_drain(partial_prologue_drain: Bool = False) -> Self

Returns auto-derived waits plus inter-block lgkm drain (4-wave pattern).

Args:

  • ​partial_prologue_drain (Bool): Skip standard wait_vm(0) drains in the framework prologue.

Returns:

Self: A WaitStrategy configured for the 4-wave kernel pattern.