For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
indexer_remap_sparse_columns
def indexer_remap_sparse_columns[block_kv: Int](columns: TileTensor[.int32, Engine=columns.Engine, address_space=columns.address_space, linear_idx_type=columns.linear_idx_type], blocks: TileTensor[.int32, Engine=blocks.Engine, address_space=blocks.address_space, linear_idx_type=blocks.linear_idx_type], starts: TileTensor[.int32, Engine=starts.Engine, address_space=starts.address_space, linear_idx_type=starts.linear_idx_type], output: TileTensor[.int32, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type], count: Int, width: Int, ctx: DeviceContextBase)
Map selected sparse columns to local tokens; invalid columns yield -1.
Each tensor is a row-major [rows, stride] tile whose row stride is
its second dimension. width is the scored sparse-column width, not a
row's valid-prefix length. The selector owns masking by the latter
before this operation.
Parameters:
- block_kv (
Int): Tokens per block, either 8 or 16.
Args:
- columns (
TileTensor[.int32, Engine=columns.Engine, address_space=columns.address_space, linear_idx_type=columns.linear_idx_type]): Selected sparse columns. Shape:[rows, column_stride]with at leastcountcolumns used. - blocks (
TileTensor[.int32, Engine=blocks.Engine, address_space=blocks.address_space, linear_idx_type=blocks.linear_idx_type]): Expanded block ids, asindexer_expand_candidateswrites. Shape:[rows, block_stride]with at leastceildiv(width, block_kv)columns used. - starts (
TileTensor[.int32, Engine=starts.Engine, address_space=starts.address_space, linear_idx_type=starts.linear_idx_type]): First token position per row, in column 0. Shape:[rows, start_stride]. - output (
TileTensor[.int32, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): Local token positions. Shape:[rows, output_stride]with at leastcountcolumns used. - count (
Int): Selected columns per row. - width (
Int): Scored sparse-column width. - ctx (
DeviceContextBase): The device context.