IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

K2qCsr

struct K2qCsr

Reverse-CSR + schedule for one sparse-MHA forward pass (host-built).

All buffers are owned List[Int32]; index them with the strides documented on each field. total_rows, max_kv_blocks and work_capacity are the sizing the future kernel allocates against.

Fields​

  • ​head_kv (Int):
  • ​total_q (Int):
  • ​topk (Int):
  • ​batch (Int):
  • ​blk_kv (Int):
  • ​max_seqlen_q (Int):
  • ​total_rows (Int):
  • ​max_kv_blocks (Int):
  • ​work_capacity (Int):
  • ​k2q_row_ptr (List[Int32]):
  • ​qsplit_indices (List[Int32]):
  • ​scheduler_metadata (List[Int32]):
  • ​work_count (Int):
  • ​split_counts (List[Int32]):
  • ​row_coords (List[Int32]):

Implemented traits​

AnyType, ImplicitlyDeletable, Movable

Methods​

__init__​

def __init__(out self, head_kv: Int, total_q: Int, topk: Int, batch: Int, blk_kv: Int, max_seqlen_q: Int, total_rows: Int, max_kv_blocks: Int, work_capacity: Int)