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

DecodeKVProducer

struct DecodeKVProducer[dtype: DType, config: MLA_SM100_Decode_Config, num_producer: Int = Int(1)]

Producer side of the decode KV pipeline that loads KV tiles via TMA.

Parameters​

  • ​dtype (DType): Element type of the KV tiles stored in SMEM.
  • ​config (MLA_SM100_Decode_Config): Decode config supplying num_kv_stages, BN_QK, and q_depth for pipeline stage sizing.
  • ​num_producer (Int): Number of producer threads arriving on each producer mbarrier (defaults to 1).

Fields​

  • ​pipe (DecodeKVProducer[dtype, config, num_producer].KVPipeType):
  • ​smem (Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED, _safe=False]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

kv_stage_bytes​

comptime kv_stage_bytes = (Int((mul config.BN_QK, config.q_depth)) * size_of[dtype]())

kv_stage_elems​

comptime kv_stage_elems = (config * config)

KVPipeType​

comptime KVPipeType = KVPipelineGeneric[config.num_kv_stages, Int(1), num_producer, Int(2)]

Methods​

__init__​

def __init__(pipe: KVPipelineGeneric[config.num_kv_stages, Int(1), num_producer, Int(2)], smem: Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED, _safe=False]) -> Self

init​

def init(self)

stage_base_ptr​

def stage_base_ptr[*, qk_stage: Int = Int(0)](self) -> Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED, _safe=False]

Returns:

Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED, _safe=False]

stage_index​

def stage_index[*, qk_stage: Int = Int(0)](self) -> UInt32

Returns:

UInt32

producer_mbar​

def producer_mbar[*, qk_stage: Int = Int(0)](self) -> MBarType

Returns:

MBarType

acquire​

def acquire[*, qk_stage: Int = Int(0)](self)

commit_step​

def commit_step(mut self)

Was this page helpful?