diff --git a/vllm/core/block_manager.py b/vllm/core/block_manager.py index 4ce87f6e5061b..f6251f667c65c 100644 --- a/vllm/core/block_manager.py +++ b/vllm/core/block_manager.py @@ -7,6 +7,10 @@ from vllm.utils import Device +# Mapping: logical block number -> physical block. +BlockTable = List[PhysicalTokenBlock] + + class BlockAllocator: """Manages free physical token blocks for a device. @@ -26,7 +30,7 @@ def __init__( self.num_blocks = num_blocks # Initialize the free blocks. - self.free_blocks: List[PhysicalTokenBlock] = [] + self.free_blocks: BlockTable = [] for i in range(num_blocks): block = PhysicalTokenBlock(device=device, block_number=i, @@ -51,10 +55,6 @@ def get_num_free_blocks(self) -> int: return len(self.free_blocks) -# Mapping: logical block number -> physical block. -BlockTable = List[PhysicalTokenBlock] - - class AllocStatus(enum.Enum): """Result for BlockSpaceManager.can_allocate