|
Mila
Deep Neural Network Library
|
Capability interface for KV-cache state management. More...
Public Member Functions | |
| virtual void | initializeKvCache (dim_t batch_size, dim_t max_sequence_length)=0 |
| Allocate the KV cache for a given batch size and maximum sequence length. | |
| virtual void | resetKvCache ()=0 |
| Reset the KV cache to an empty state, preserving the allocation. | |
| virtual bool | rewindKvCache (dim_t position)=0 |
| Rewind the logical cache fill position without touching device K/V buffer contents, so positions [0, position) can be reused by a subsequent partial prefill (PromptCaching.md). | |
Capability interface for KV-cache state management.
Implemented by attention operations (GQA, MHA) that allocate and maintain key/value caches across autoregressive decode steps. This concern is orthogonal to positional dispatch – an operation may implement both IPositionalUnaryOp and IKVCacheLifecycle.
|
pure virtual |
Allocate the KV cache for a given batch size and maximum sequence length.
| batch_size | Number of sequences in the batch. |
| max_sequence_length | Maximum number of tokens the cache must hold. |
|
pure virtual |
Rewind the logical cache fill position without touching device K/V buffer contents, so positions [0, position) can be reused by a subsequent partial prefill (PromptCaching.md).