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
SplitKPartition
struct SplitKPartition[dtype: DType]
A multi-partition split-K scheme for MHA decoding over long sequences.
Divides the key sequence across num_partitions CTAs. Each CTA writes
its partial softmax numerator/denominator to the buffer pointed to by
ptr, and a separate reduction kernel merges the results. Over-launches
up to max_num_partitions CTAs so the grid shape is stable across
varying key lengths (enabling CUDA graph capture).
Parametersβ
- βdtype (
DType): The accumulator element type used for the partial statistics buffer and the final output.
Fieldsβ
- βptr (
Pointer[Scalar[SplitKPartition[dtype].accum_dtype], MutAnyOrigin, _safe=False]): - βnum_partitions_value (
UInt32): - βmax_num_partitions_value (
UInt32):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
MHAPartitionScheme,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
accum_dtypeβ
comptime accum_dtype = dtype
do_partitionβ
comptime do_partition = True
Methodsβ
__init__β
def __init__(ptr: Pointer[Scalar[Self.accum_dtype], MutAnyOrigin, _safe=False], num_partitions_value: UInt32, max_num_partitions_value: UInt32) -> Self
num_partitionsβ
max_num_partitionsβ
get_exp_sum_qk_max_pointerβ
def get_exp_sum_qk_max_pointer(self) -> Pointer[Scalar[Self.accum_dtype], MutAnyOrigin, _safe=False]
Returns:
Pointer[Scalar[Self.accum_dtype], MutAnyOrigin, _safe=False]
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!