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
Pack
struct Pack[MaskType: MHAMask, SchedulerType: MHATileScheduler, ValidLengthType: OptionalPointer, SinkType: OptionalPointer, KVRowOffsetsType: OptionalPointer, MaxSeqLenType: OptionallyStaticInt, PartitionType: MHAPartitionScheme]
Bundles MHA kernel parameters into a single device-passable struct.
Parametersβ
- βMaskType (
MHAMask): Mask type applied to the attention score tiles. - βSchedulerType (
MHATileScheduler): Tile scheduler that assigns work to CTAs. - βValidLengthType (
OptionalPointer): Optional pointer type for the per-batch valid-length tensor. - βSinkType (
OptionalPointer): Optional pointer type for the attention-sink weights. - βKVRowOffsetsType (
OptionalPointer): Optional pointer type for the KV row-offsets tensor. - βMaxSeqLenType (
OptionallyStaticInt): Type of the maximum sequence length, which may be static or dynamic. - βPartitionType (
MHAPartitionScheme): KV-cache partitioning scheme.
Fieldsβ
- βmask (
MaskType): - βscheduler (
SchedulerType): - βvalid_length (
ValidLengthType): - βsink_weights (
SinkType): - βkv_input_row_offsets (
KVRowOffsetsType): - βmax_seq_len (
MaxSeqLenType): - βpartition (
PartitionType):
Implemented traitsβ
AnyType,
Copyable,
DevicePassable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
device_typeβ
comptime device_type = Pack[MaskType, SchedulerType, ValidLengthType, SinkType, KVRowOffsetsType, MaxSeqLenType, PartitionType]
Methodsβ
__init__β
def __init__(mask: MaskType, scheduler: SchedulerType, valid_length: ValidLengthType, sink_weights: SinkType, kv_input_row_offsets: KVRowOffsetsType, max_seq_len: MaxSeqLenType, partition: PartitionType) -> Self
get_type_nameβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!