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
DecodeKVConsumer
struct DecodeKVConsumer[dtype: DType, config: MLA_SM100_Decode_Config, num_producer: Int = Int(1), num_consumer: Int = Int(2)]
Consumer side of the decode KV pipeline that waits for and releases KV stages.
Parametersβ
- βdtype (
DType): Element type of the KV tiles stored in SMEM. - βconfig (
MLA_SM100_Decode_Config): Decode config supplyingnum_kv_stages,BN_QK, andq_depthfor pipeline stage sizing. - βnum_producer (
Int): Number of producer threads arriving on each producer mbarrier (defaults to 1). - βnum_consumer (
Int): Number of consumer threads arriving on each consumer mbarrier (defaults to 2, matching the standard mmaQK+mmaPV dual-consumer KV pipeline).
Fieldsβ
- βpipe (
DecodeKVConsumer[dtype, config, num_producer, num_consumer].KVPipeType): - βsmem (
Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED]):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
kv_stage_elemsβ
comptime kv_stage_elems = (config * config)
KVPipeTypeβ
comptime KVPipeType = KVPipelineGeneric[config.num_kv_stages, Int(1), num_producer, num_consumer]
Methodsβ
__init__β
def __init__(pipe: KVPipelineGeneric[config.num_kv_stages, Int(1), num_producer, num_consumer], smem: Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED]) -> Self
stage_base_ptrβ
def stage_base_ptr[*, qk_stage: Int = Int(0)](self) -> Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED]
Returns:
Pointer[Scalar[dtype], MutAnyOrigin, address_space=AddressSpace.SHARED]
stage_indexβ
waitβ
def wait[*, qk_stage: Int = Int(0)](self)
releaseβ
def release[*, qk_stage: Int = Int(0)](mut self, e: Int32)
release_allβ
def release_all(mut self)
Explicit-arrive release for a non-MMA (independent-thread) consumer.
Every thread of the num_consumer-wide consumer role (e.g. a full
warpgroup doing a manual SMEM re-swizzle read) calls this once; the
num_consumer independent arrive() calls satisfy the mbar's
expected count. Use this instead of release[qk_stage](e) (which
uses elect_mma_arrive for a single elected thread per warp) when
every thread independently participates, not just one MMA-eligible
lane per warp.