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
SplitParallelCombineParams
struct SplitParallelCombineParams[output_type: DType, accum_type: DType, num_splits: Int, ragged: Bool = False, has_attn_sink: Bool = False]
Holds the pointers, strides, and shape metadata for the split-parallel combine kernel.
Carries the per-split partial output and LSE accumulators, the final output
tensor, optional ragged row offsets and attention-sink pointer, and the
derived strides used by mla_combine_kernel_split_parallel. All 8 warps
cooperate on a single head, so heads_per_block is fixed at 1.
Parametersβ
- βoutput_type (
DType): The element type of the per-split partial output accumulator and the final combined output tensor. - βaccum_type (
DType): The element type of the per-split LSE accumulator values. - βnum_splits (
Int): The compile-time number of KV cache splits to combine. Used to partition splits across the 8 warps. - βragged (
Bool): Whether batches have variable-length sequences in a packed layout (defaults toFalse). When true,input_row_offsets_ptrselects each batch's token range. - βhas_attn_sink (
Bool): Whether to apply attention-sink correction to the global LSE (defaults toFalse). When true,attn_sink_ptrmust be provided.
Fieldsβ
- βout_accum_split_ptr (
Pointer[Scalar[output_type], MutAnyOrigin, _safe=False]): - βlse_accum_split_ptr (
Pointer[Scalar[accum_type], MutAnyOrigin, _safe=False]): - βoutput_ptr (
Pointer[Scalar[output_type], MutAnyOrigin, _safe=False]): - βinput_row_offsets_ptr (
Pointer[UInt32, MutAnyOrigin, _safe=False]): - βattn_sink_ptr (
OptionalReg[Pointer[Float32, MutAnyOrigin, _safe=False]]): - βbatch_size (
Int): - βseq_len (
Int): - βnum_heads (
Int): - βhead_dim (
Int): - βlse_stride_split (
Int): - βlse_stride_batch (
Int): - βlse_stride_seq (
Int): - βout_accum_stride_split (
Int): - βout_accum_stride_head (
Int): - βout_stride_row (
Int):
Implemented traitsβ
AnyType,
Copyable,
DevicePassable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
device_typeβ
comptime device_type = SplitParallelCombineParams[output_type, accum_type, num_splits, ragged, has_attn_sink]
heads_per_blockβ
comptime heads_per_block = 1
num_threadsβ
comptime num_threads = (Int(8) * _resolve_warp_size())
num_warpsβ
comptime num_warps = 8
Methodsβ
__init__β
def __init__(out_accum_split_ptr: Pointer[Scalar[output_type], MutAnyOrigin, _safe=False], lse_accum_split_ptr: Pointer[Scalar[accum_type], MutAnyOrigin, _safe=False], output_ptr: Pointer[Scalar[output_type], MutAnyOrigin, _safe=False], input_row_offsets_ptr: Pointer[UInt32, MutAnyOrigin, _safe=False], attn_sink_ptr: OptionalReg[Pointer[Float32, MutAnyOrigin, _safe=False]], batch_size: Int, seq_len: Int, num_heads: Int, head_dim: Int) -> Self
get_type_nameβ
get_device_type_nameβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!