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
b1644f76
Commit
b1644f76
authored
Feb 14, 2023
by
Woosuk Kwon
Browse files
Fix can_swap_in
parent
c574f195
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
cacheflow/master/block_manager.py
cacheflow/master/block_manager.py
+2
-2
No files found.
cacheflow/master/block_manager.py
View file @
b1644f76
...
@@ -147,12 +147,12 @@ class BlockSpaceManager:
...
@@ -147,12 +147,12 @@ class BlockSpaceManager:
def
can_swap_in
(
self
,
seq_group
:
SequenceGroup
)
->
bool
:
def
can_swap_in
(
self
,
seq_group
:
SequenceGroup
)
->
bool
:
blocks
=
self
.
_get_physical_blocks
(
seq_group
)
blocks
=
self
.
_get_physical_blocks
(
seq_group
)
num_
running
_seqs
=
seq_group
.
num_seqs
(
status
=
SequenceStatus
.
RUNNING
)
num_
swapped
_seqs
=
seq_group
.
num_seqs
(
status
=
SequenceStatus
.
SWAPPED
)
num_free_blocks
=
self
.
gpu_allocator
.
get_num_free_blocks
()
num_free_blocks
=
self
.
gpu_allocator
.
get_num_free_blocks
()
# NOTE: Conservatively, we assume that every sequence will allocate
# NOTE: Conservatively, we assume that every sequence will allocate
# at least one free block right after the swap-in.
# at least one free block right after the swap-in.
# NOTE: This should match the logic in can_append().
# NOTE: This should match the logic in can_append().
return
len
(
blocks
)
+
num_
running
_seqs
<=
num_free_blocks
return
len
(
blocks
)
+
num_
swapped
_seqs
<=
num_free_blocks
def
swap_in
(
self
,
seq_group
:
SequenceGroup
)
->
Dict
[
int
,
int
]:
def
swap_in
(
self
,
seq_group
:
SequenceGroup
)
->
Dict
[
int
,
int
]:
# src_block_number -> dst_block_number
# src_block_number -> dst_block_number
...
...
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