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 function
get_mha_decoding_num_partitions
def get_mha_decoding_num_partitions[num_heads: Int, group: Int](batch_size: Int, num_keys: Int, ctx: DeviceContext) -> Int
Return the recommended number of split-K partitions for MHA decoding.
Computes the number of CTAs (partitions) that maximally utilise the GPU
for decoding, given the batch size and key-sequence length. The result
feeds the split-K launcher and is also stored in
MHADecodeDispatchMetadata.
Parameters:
- βnum_heads (
Int): Total number of query heads. - βgroup (
Int): GQA group size (query heads per key/value head).
Args:
- βbatch_size (
Int): Number of sequences in the batch. - βnum_keys (
Int): Maximum key-sequence length (cache length). - βctx (
DeviceContext): GPU device context used to query SM count and other properties.
Returns:
Int: The number of split-K partitions to launch.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!