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

KernelContext

struct KernelContext[num_clc_pipeline_stages: Int, cta_group: Int, CLUSTER_M: Int, CLUSTER_N: Int]

Shared kernel state: election vars, CTA coords, multicast masks, pipeline states.

Fields​

  • ​elect_one_warp (Bool):
  • ​elect_one_thread (Bool):
  • ​elect_one_cta (Bool):
  • ​is_first_cta_in_cluster (Bool):
  • ​warp_id (UInt32):
  • ​rank_m (Int):
  • ​rank_n (Int):
  • ​peer_cta_coord (Tuple[Int, Int, Int]):
  • ​a_multicast_mask (UInt16):
  • ​b_multicast_mask (UInt16):
  • ​mma_complete_mask (Int):
  • ​ptr_tmem_addr (UnsafePointer[UInt32, MutAnyOrigin, address_space=AddressSpace.SHARED]):

Implemented traits​

AnyType, Copyable, ImplicitlyDestructible, Movable

comptime members​

TmemAddrArray​

comptime TmemAddrArray = SMemArray[UInt32, 1]

Methods​

__init__​

__init__(out self, ptr_tmem_addr: UnsafePointer[UInt32, MutAnyOrigin, address_space=AddressSpace.SHARED])

Initialize context from TMEM pointer; computes all derived state.

__init__(out self, tmem_addr: SMemArray[UInt32, 1])

Initialize context from typed TMEM address array.