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
naively_compute_total_iters
def naively_compute_total_iters[MaskType: MHAMask, //, BM: Int, BN: Int](mask: MaskType, seq_id: UInt32, q_row: UInt32, end: UInt32) -> UInt32
Count the non-fully-masked KV tile iterations for a query row by linear scan.
Walks every BN-wide column tile from 0 to end, calling
mask.status() for each and counting tiles that are not
TileMaskStatus.FULL_MASK. Intended as a reference fallback for mask
types that do not implement a closed-form total_iters().
Parameters:
- βMaskType (
MHAMask): ConcreteMHAMaskimplementation to query. - βBM (
Int): Query tile height (number of query rows per block). - βBN (
Int): Key tile width (number of key columns per block).
Args:
- βmask (
MaskType): The mask instance. - βseq_id (
UInt32): Sequence/batch index. - βq_row (
UInt32): Starting query-row index of the current query tile. - βend (
UInt32): Exclusive upper bound on key column indices.
Returns:
UInt32: The number of KV tiles in [0, end) that are not fully masked.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!