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: The type of operation (kernel-specific, used by _emit dispatch). stage: Buffer stage index (0 or 1 for double-buffering). subtile: Subtile index within the stage (0 or 1). k_offset: How to compute the K dimension offset for loads. vm_cost: Number of vmcnt (global load) ops this produces. lgkm_cost: Number of lgkmcnt (LDS) ops this produces. wait_value: For WAIT_VM/WAIT_LGKM ops, the count to wait for. resource: Hardware execution unit (GLOBAL_MEM, LDS, MMA_UNIT, SCALAR). latency: Estimated execution latency in cycles. role: Pipeline data-flow role (GLOBAL_LOAD, FRAGMENT_LOAD, etc.). channel: 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: VGPRs this op brings into scope (new live register values). vgpr_kill: VGPRs this op releases (last use of some register buffer).
Fieldsβ
- βtag (
Int): - βstage (
Int): - βsubtile (
Int): - βk_offset (
KOffsetKind): - βvm_cost (
Int): - βlgkm_cost (
Int): - βwait_value (
Int): - βresource (
ResourceKind): - βlatency (
Int): - βrole (
OpRole): - βchannel (
Int): - β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,
ImplicitlyDestructible,
Movable
Methodsβ
__init__β
__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β
opβ
static 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 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 barrier() -> Self
wait_vmβ
static wait_vm[count: Int]() -> Self
wait_vm_nβ
static wait_vm_n(count: Int) -> Self
Runtime-parameterized wait_vm (for ScheduleConfig-driven waits).
wait_lgkmβ
static wait_lgkm[count: Int]() -> Self
wait_lgkm_nβ
static wait_lgkm_n(count: Int) -> Self
Runtime-parameterized wait_lgkm (for ScheduleConfig-driven waits).
set_prioβ
static set_prio[priority: Int]() -> Self
Priority hint: s_setpriopriority.
schedule_barrierβ
static schedule_barrier() -> Self
Compiler scheduling fence.
noneβ
static none() -> Self
No-op sentinel (used for optional MMA block fields).
sched_group_barrierβ
static sched_group_barrier[mask: Int, count: Int]() -> Self
Schedule_group_barrier hint. Mask encoded in subtile, count in wait_value.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!