BlockTableManager<T>
Models & Types · AiDotNet.Inference.PagedAttention
Manages block tables for multiple sequences.
Constructors
| Constructor |
Summary |
BlockTableManager(BlockManager<T> blockManager) |
Creates a new block table manager. |
Properties
| Property |
Summary |
BlockManager<T> BlockManager { get; } |
Gets the underlying block manager. |
int ActiveTableCount { get; } |
Gets the number of active block tables. |
Methods
| Method |
Summary |
BlockTable CreateBlockTable(long sequenceId, int initialBlocks) |
Creates a new block table for a sequence. |
BlockTable ForkBlockTable(long sourceSequenceId, long newSequenceId) |
Forks a block table for beam search (creates copy with shared blocks). |
BlockTable GetBlockTable(long sequenceId) |
Gets the block table for a sequence. |
bool CopyOnWrite(long sequenceId, int logicalBlockIndex, Action<int, int> copyData) |
Performs copy-on-write for a block in a sequence’s table. |
bool EnsureCapacity(long sequenceId, int numTokens) |
Ensures a sequence has enough blocks for the specified token count. |
int EvictBelow(long sequenceId, int keepFromPosition) |
Sliding-window retention: releases the leading logical blocks of sequenceId that lie entirely below keepFromPosition (block L is evictable iff (L+1)*blockSize <= keepFromPosition). |
int[] GetBlockTableArray(long sequenceId) |
Gets the physical block IDs for a sequence (for GPU transfer). |
long[] GetActiveSequenceIds() |
Gets all active sequence IDs. |
void Clear() |
Clears all block tables and frees all blocks. |
void FreeBlockTable(long sequenceId) |
Frees a block table and returns its blocks to the pool. |