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 module
mha
Implements CPU-based multi-head attention kernels, including flash attention and KV-cache-backed attention variants.
Functionsβ
- β
flash_attention: Computes scaled dot-product flash attention on CPU for the given query, key, value, and mask accessors. - β
flash_attention_kv_cache: Computes flash attention on CPU using a KV cache with an additive LayoutTensor mask. - β
flash_attention_split_kv: Variant of flash attention that takes the previous KV cacheinput_{k,v}_cache_fnand the current KV tensorsinput_k_fnandinput_v_fnas separate arguments.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!