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 class

RecurrentStateBuffer

RecurrentStateBuffer​

class max.nn.kv_cache.RecurrentStateBuffer(pages)

source

Bases: KVCacheBufferInterface

One replica’s recurrent state pool, viewed as the pages it holds.

Parameters:

pages (dict[str, list[Buffer]])

all_buffers​

property all_buffers: list[Buffer]

source

Returns every leaf’s pages, leaf-major then device order.

pages​

pages: dict[str, list[Buffer]]

source

Each state leaf’s [num_blocks, bytes_per_page] uint8 pages, one buffer per device.

to_memory()​

to_memory()

source

Returns one unit per state leaf, keyed as leaves() names it.

Return type:

Mapping[str, KVCacheMemory]

total_num_pages​

property total_num_pages: int

source

Returns the first leaf’s block count, including the null block.