Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
norm
vllm
Commits
6ed068a7
Unverified
Commit
6ed068a7
authored
Nov 28, 2023
by
explainerauthors
Committed by
GitHub
Nov 28, 2023
Browse files
Use the type BlockTable (#1791)
parent
708e6c18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
vllm/core/block_manager.py
vllm/core/block_manager.py
+5
-5
No files found.
vllm/core/block_manager.py
View file @
6ed068a7
...
@@ -7,6 +7,10 @@ from vllm.sequence import Sequence, SequenceGroup, SequenceStatus
...
@@ -7,6 +7,10 @@ from vllm.sequence import Sequence, SequenceGroup, SequenceStatus
from
vllm.utils
import
Device
from
vllm.utils
import
Device
# Mapping: logical block number -> physical block.
BlockTable
=
List
[
PhysicalTokenBlock
]
class
BlockAllocator
:
class
BlockAllocator
:
"""Manages free physical token blocks for a device.
"""Manages free physical token blocks for a device.
...
@@ -26,7 +30,7 @@ class BlockAllocator:
...
@@ -26,7 +30,7 @@ class BlockAllocator:
self
.
num_blocks
=
num_blocks
self
.
num_blocks
=
num_blocks
# Initialize the free blocks.
# Initialize the free blocks.
self
.
free_blocks
:
List
[
PhysicalTokenBlock
]
=
[]
self
.
free_blocks
:
BlockTable
=
[]
for
i
in
range
(
num_blocks
):
for
i
in
range
(
num_blocks
):
block
=
PhysicalTokenBlock
(
device
=
device
,
block
=
PhysicalTokenBlock
(
device
=
device
,
block_number
=
i
,
block_number
=
i
,
...
@@ -51,10 +55,6 @@ class BlockAllocator:
...
@@ -51,10 +55,6 @@ class BlockAllocator:
return
len
(
self
.
free_blocks
)
return
len
(
self
.
free_blocks
)
# Mapping: logical block number -> physical block.
BlockTable
=
List
[
PhysicalTokenBlock
]
class
AllocStatus
(
enum
.
Enum
):
class
AllocStatus
(
enum
.
Enum
):
"""Result for BlockSpaceManager.can_allocate
"""Result for BlockSpaceManager.can_allocate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment