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 module
types
This module contains the types for the key-value cache APIs.
The module includes structs implementing several different types of KV caches.
This module defines two traits that define the roles of the different structs
KVCacheT: Defines the interface for a single (key or value) cache.KVCollectionT: Defines the interface for a pair of caches (keys and values).
Structs
-
ContinuousBatchingKVCache: Wrapper for the ContinuousKVCache of a given layer in the transformer model. -
ContinuousBatchingKVCacheCollection: This is a "view" of the cache for the given sequences in the batch. -
KVCacheStaticParams: Compile-time shape parameters shared across all layers of a KV cache. -
PagedKVCache: The PagedKVCache is a wrapper around the KVCache blocks for a given layer. It is used to access the KVCache blocks for PagedAttention. -
PagedKVCacheCollection: Paged pair of key and value caches backed by a block-allocated tensor. -
PagedRowIndices: Pre-computed physical row indices for a BN-row range of paged KV cache.
Traits
-
KVCacheT: Trait for different KVCache types and implementations. -
KVCollectionT: Trait for a pair of caches (keys and values).
Functions
-
kv_num_sub_tiles: Number of sub-tile TMA copies needed fortile_BNrows. -
kv_sub_tile_rows: Sub-tile row count for a TMA load oftile_BNrows. -
kv_tma_fold_chunks: Single source of truth for the SM100 depth-chunk TMA-fold predicate. -
padded_depth: Alignsdepthup to the nearest multiple of the swizzle granularity. -
swizzle_granularity: Returns the TMA swizzle granularity measured in elements ofdtype.