For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /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,
Deinitable,
ImplicitlyCopyable,
Movable
Methods
__init__
def __init__(out self, *, tag: Int, stage: Int = Int(0), subtile: Int = Int(0), k_offset: KOffsetKind = KOffsetKind.NONE, vm_cost: Int = Int(0), lgkm_cost: Int = Int(0), wait_value: Int = Int(0), resource: ResourceKind = ResourceKind.NONE, latency: Int = Int(0), role: OpRole = OpRole.NONE, channel: Int = Int(-1), vgpr_def: Int = Int(0), vgpr_kill: Int = Int(0))
is_present
op
static def op(tag: Int, resource: ResourceKind, latency: Int, role: OpRole, *, channel: Int = Int(-1), stage: Int = Int(0), subtile: Int = Int(0), k_offset: KOffsetKind = KOffsetKind.NONE, vm_cost: Int = Int(0), lgkm_cost: Int = Int(0), wait_value: Int = Int(0), vgpr_def: Int = Int(0), vgpr_kill: Int = 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.
Args:
- tag (
Int): Kernel-specific op tag (0-127) used by_emitdispatch. - resource (
ResourceKind): Hardware execution unit (GLOBAL_MEM,LDS,MMA_UNIT, orSCALAR). - 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 (defaults to -1). - stage (
Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0). - subtile (
Int): Subtile index within the stage (defaults to 0). - k_offset (
KOffsetKind): How to compute the K dimension offset for loads (defaults toKOffsetKind.NONE). - vm_cost (
Int): Number ofvmcnt(global load) ops this produces (defaults to 0). - lgkm_cost (
Int): Number oflgkmcnt(LDS) ops this produces (defaults to 0). - wait_value (
Int): ForWAIT_VM/WAIT_LGKMops, the count to wait for (defaults to 0). - vgpr_def (
Int): VGPRs this op brings into scope as new live register values (defaults to 0). - vgpr_kill (
Int): VGPRs this op releases as last use of some register buffer (defaults to 0).
logical
static def logical(tag: Int, *, channel: Int = Int(-1), stage: Int = Int(0), subtile: Int = 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).
Args:
- tag (
Int): Kernel-specific op tag (0-127) used by_emitdispatch. - channel (
Int): Data path identifier for edge derivation. Ops on the same channel share a buffer (defaults to -1). - stage (
Int): Buffer stage index (0 or 1 for double-buffering) (defaults to 0). - subtile (
Int): Subtile index within the stage (defaults to 0). - k_offset (
KOffsetKind): How to compute the K dimension offset for loads (defaults toKOffsetKind.NONE).
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).
Args:
- count (
Int): Number of outstandingvmcnt(global load) ops to wait for.
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).
Args:
- count (
Int): Number of outstandinglgkmcnt(LDS / scalar-memory) ops to wait for.
set_prio
static def set_prio[priority: Int]() -> Self
Priority hint: s_setpriopriority.
Parameters:
- priority (
Int): Wave priority value passed to thes_setprioinstruction.
schedule_barrier
static def schedule_barrier() -> Self
Compiler scheduling fence.
none
static def none() -> Self
No-op sentinel (used for optional MMA block fields).