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

OpNode

struct OpNode

An operation in the Loop Dependency Graph (LDG).

Enriches OpDesc with resource assignment and latency β€” the information needed for modulo scheduling (GAG96). Each OpNode represents one vertex in the LDG:

  • resource: which hardware unit executes this op (from OpDesc.resource)
  • latency: estimated cycles until the result is available
  • op: the underlying OpDesc with kind, stage, subtile, etc.

Latencies are approximate and used for scheduling heuristics (ASAP/ALAP priority), not for cycle-accurate simulation. Typical values:

GLOBAL_MEM (buffer_load β†’ LDS): ~200 cycles LDS (ds_read β†’ register): ~20 cycles MMA_UNIT (MFMA execution): ~16 cycles SCALAR (barriers, fences): ~0 cycles (sync, not compute)

Fields​

  • ​op (OpDesc):
  • ​resource (ResourceKind):
  • ​latency (Int):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable

Methods​

__init__​

__init__(out self, *, op: OpDesc, latency: Int = -1)

Create an OpNode from an OpDesc.

If latency is -1 (default), it is auto-derived from op.latency. Pass an explicit value to override.