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

OpDesc

struct OpDesc

Describes a single operation in the pipeline schedule.

Fields​

  • ​tag (Int): The type of operation (kernel-specific, used by _emit dispatch).
  • ​stage (Int): Buffer stage index (0 or 1 for double-buffering).
  • ​subtile (Int): Subtile index within the stage (0 or 1).
  • ​k_offset (KOffsetKind): How to compute the K dimension offset for loads.
  • ​vm_cost (Int): Number of vmcnt (global load) ops this produces.
  • ​lgkm_cost (Int): Number of lgkmcnt (LDS) ops this produces.
  • ​wait_value (Int): For WAIT_VM/WAIT_LGKM ops, the count to wait for.
  • ​resource (ResourceKind): Hardware execution unit (GLOBAL_MEM, LDS, MMA_UNIT, SCALAR).
  • ​latency (Int): Estimated execution latency in cycles.
  • ​role (OpRole): Pipeline data-flow role (GLOBAL_LOAD, FRAGMENT_LOAD, etc.).
  • ​channel (Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (e.g., 0=A matrix, 1=B matrix). -1 = none.
  • ​vgpr_def (Int): VGPRs this op brings into scope (new live register values).
  • ​vgpr_kill (Int): VGPRs this op releases (last use of some register buffer).

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable

Methods​

__init__​

def __init__(out self, *, tag: Int, stage: Int = 0, subtile: Int = 0, k_offset: KOffsetKind = KOffsetKind.NONE, vm_cost: Int = 0, lgkm_cost: Int = 0, wait_value: Int = 0, resource: ResourceKind = ResourceKind.NONE, latency: Int = 0, role: OpRole = OpRole.NONE, channel: Int = -1, vgpr_def: Int = 0, vgpr_kill: Int = 0)

is_present​

def is_present(self) -> Bool

True if this is a real op (not the NONE sentinel).

Returns:

Bool

op​

static def op(tag: Int, resource: ResourceKind, latency: Int, role: OpRole, *, channel: Int = -1, stage: Int = 0, subtile: Int = 0, k_offset: KOffsetKind = KOffsetKind.NONE, vm_cost: Int = 0, lgkm_cost: Int = 0, wait_value: Int = 0, vgpr_def: Int = 0, vgpr_kill: Int = 0) -> Self

Construct an OpDesc with all metadata inline.

All scheduling metadata (tag, resource, latency, role, channel) is specified directly. Per-instance fields (stage, subtile, k_offset) are keyword arguments.

logical​

static def logical(tag: Int, *, channel: Int = -1, stage: Int = 0, subtile: Int = 0, k_offset: KOffsetKind = KOffsetKind.NONE) -> Self

Declare a logical op β€” buffer metadata only, no hardware costs.

Resource, latency, and role are left as sentinel values (NONE/0). Call annotate_ops() with a TargetCostModel to fill them in before scheduling. This separates the algorithm (what ops exist) from the target (how expensive they are).

barrier​

static def barrier() -> Self

wait_vm​

static def wait_vm[count: Int]() -> Self

wait_vm_n​

static def wait_vm_n(count: Int) -> Self

Runtime-parameterized wait_vm (for ScheduleConfig-driven waits).

wait_lgkm​

static def wait_lgkm[count: Int]() -> Self

wait_lgkm_n​

static def wait_lgkm_n(count: Int) -> Self

Runtime-parameterized wait_lgkm (for ScheduleConfig-driven waits).

set_prio​

static def set_prio[priority: Int]() -> Self

Priority hint: s_setpriopriority.

schedule_barrier​

static def schedule_barrier() -> Self

Compiler scheduling fence.

none​

static def none() -> Self

No-op sentinel (used for optional MMA block fields).

sched_group_barrier​

static def sched_group_barrier[mask: Int, count: Int]() -> Self

Schedule_group_barrier hint. Mask encoded in subtile, count in wait_value.