From 6ed068a71a58110f41c9cba76035f4c086840eb1 Mon Sep 17 00:00:00 2001 From: explainerauthors <152090505+explainerauthors@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:34:05 -0800 Subject: [PATCH] Use the type BlockTable (#1791) --- vllm/core/block_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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