Skip to content

Commit

Permalink
Use the type BlockTable (vllm-project#1791)
Browse files Browse the repository at this point in the history
  • Loading branch information
explainerauthors authored Nov 29, 2023
1 parent 708e6c1 commit 6ed068a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions vllm/core/block_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 6ed068a

Please sign in to comment.