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β
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.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!