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
c128c2ed
Commit
c128c2ed
authored
Feb 14, 2023
by
Woosuk Kwon
Browse files
Fix double free
parent
c80ed212
Changes
1
Hide 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 @
c128c2ed
...
@@ -115,13 +115,13 @@ class BlockSpaceManager:
...
@@ -115,13 +115,13 @@ class BlockSpaceManager:
last_block
=
block_table
[
-
1
]
last_block
=
block_table
[
-
1
]
assert
last_block
.
device
==
Device
.
GPU
assert
last_block
.
device
==
Device
.
GPU
if
last_block
.
ref_count
==
1
:
if
last_block
.
ref_count
==
1
:
# Append.
#
Not shared with other sequences.
Append
able
.
return
None
return
None
else
:
else
:
# The last block is shared with other sequences.
# The last block is shared with other sequences.
# Copy on Write: Allocate a new block and copy the tokens.
# Copy on Write: Allocate a new block and copy the tokens.
new_block
=
self
.
gpu_allocator
.
allocate
()
new_block
=
self
.
gpu_allocator
.
allocate
()
block_table
.
append
(
new_block
)
block_table
[
-
1
]
=
new_block
self
.
gpu_allocator
.
free
(
last_block
)
self
.
gpu_allocator
.
free
(
last_block
)
return
last_block
.
block_number
,
new_block
.
block_number
return
last_block
.
block_number
,
new_block
.
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