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 function

generic_flare_mla_prefill_ragged_paged_plan

def generic_flare_mla_prefill_ragged_paged_plan[target: StringSlice[ImmStaticOrigin]](input_row_offsets: LayoutTensor[DType.uint32, element_layout=input_row_offsets.element_layout, layout_int_type=input_row_offsets.layout_int_type, linear_idx_type=input_row_offsets.linear_idx_type, masked=input_row_offsets.masked, alignment=input_row_offsets.alignment], kv_collection: PagedKVCacheCollection[scale_dtype_=kv_collection.scale_dtype_, quantization_granularity_=kv_collection.quantization_granularity_], layer_idx: UInt32, buffer_token_size: UInt32, buffer_row_offsets: LayoutTensor[DType.uint32, element_layout=buffer_row_offsets.element_layout, layout_int_type=buffer_row_offsets.layout_int_type, linear_idx_type=buffer_row_offsets.linear_idx_type, masked=buffer_row_offsets.masked, alignment=buffer_row_offsets.alignment], cache_offsets: LayoutTensor[DType.uint32, element_layout=cache_offsets.element_layout, layout_int_type=cache_offsets.layout_int_type, linear_idx_type=cache_offsets.linear_idx_type, masked=cache_offsets.masked, alignment=cache_offsets.alignment], buffer_lengths: LayoutTensor[DType.int32, element_layout=buffer_lengths.element_layout, layout_int_type=buffer_lengths.layout_int_type, linear_idx_type=buffer_lengths.linear_idx_type, masked=buffer_lengths.masked, alignment=buffer_lengths.alignment], context: DeviceContext)

Computes the MLA prefill plan for a ragged paged KV cache.

Populates buffer_row_offsets, cache_offsets, and buffer_lengths from the input row offsets and paged key cache so the subsequent MLA prefill kernel can gather K/V entries into a contiguous buffer.

Parameters:

Args: