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

EdgeRule

struct EdgeRule

Declarative edge derivation rule.

Each rule describes a class of dependency edges: for every (producer, consumer) pair whose OpDesc fields satisfy the predicates, emit a DepEdge with the given kind and loop distance.

The evaluator (apply_edge_rules) pre-classifies ops by role, then for each rule scans only relevant (producer_role, consumer_role) pairs and checks the predicate fields. This replaces the hand-coded 4-phase double-buffer logic and 8-rule single-buffer logic in derive_edges_from_ops with inspectable data.

Fields fall into five groups:

  1. Core β€” producer/consumer roles, dependency kind, loop distance. loop_distance = -1 means "derive from producer.k_offset": K_PREV β†’ d=0 (current-iteration load), otherwise d=1 (prefetch).

  2. Field matching β€” require same channel / stage / subtile between the producer and consumer ops. use_config_match activates the PipelineConfig.compute_match_key() logic (Phase 1 register-FLOW).

  3. Half predicates (double-buffer) β€” same_half / cross_half / producer_half constrain which half each op lives in.

  4. K-offset filter β€” 0=any, 1=K_PREV only, 2=non-K_PREV only. Applied to the consumer for LDS-ANTI rules, to the producer for LDS-FLOW distance derivation.

  5. Single-buffer predicates β€” lc_producer/lc_consumer (loop- carried status), producer_ordinal/consumer_ordinal (Nth op of that role), first_match_only (break after first consumer match).

Fields​

  • ​producer_role (OpRole):
  • ​consumer_role (OpRole):
  • ​dep_kind (DepKind):
  • ​loop_distance (Int):
  • ​match_channel (Bool):
  • ​match_stage (Bool):
  • ​match_subtile (Bool):
  • ​use_config_match (Bool):
  • ​same_half (Bool):
  • ​cross_half (Bool):
  • ​producer_half (Int):
  • ​k_offset_filter (Int):
  • ​lc_producer (Int):
  • ​lc_consumer (Int):
  • ​producer_ordinal (Int):
  • ​consumer_ordinal (Int):
  • ​first_match_only (Bool):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable