IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Python function

padded_lut_cols

padded_lut_cols()​

max.nn.kv_cache.padded_lut_cols(cols)

source

Rounds a page lookup-table inner dim up to a kernel-safe width.

Kept in lockstep with the invariant asserted in max/kernels/src/kv_cache/types.mojo (PagedKVCache.populate): lookup_table.dim[1] is a multiple of 8 and is at least logical_cols + 15 so a 16-wide SIMD lookup load from any valid first_lut_idx stays in-bounds.

Parameters:

cols (int) – The number of logical page columns per batch row.

Returns:

The allocated inner dim to use for the lookup table.

Return type:

int