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
be1e2163
"vscode:/vscode.git/clone" did not exist on "c54e04866652dbb9eaaf5e7d0206bdf62fe9f091"
Commit
be1e2163
authored
Feb 14, 2023
by
Woosuk Kwon
Browse files
Fix memory leak in swapping
parent
7e5f604e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
cacheflow/master/block_manager.py
cacheflow/master/block_manager.py
+9
-9
No files found.
cacheflow/master/block_manager.py
View file @
be1e2163
...
...
@@ -165,10 +165,11 @@ class BlockSpaceManager:
for
cpu_block
in
block_table
:
if
cpu_block
in
mapping
:
new_block_table
.
append
(
mapping
[
cpu_block
])
continue
gpu_block
=
self
.
gpu_allocator
.
allocate
()
mapping
[
cpu_block
]
=
gpu_block
gpu_block
=
mapping
[
cpu_block
]
else
:
gpu_block
=
self
.
gpu_allocator
.
allocate
()
mapping
[
cpu_block
]
=
gpu_block
new_block_table
.
append
(
gpu_block
)
# Free the CPU block swapped in to GPU.
self
.
cpu_allocator
.
free
(
cpu_block
)
self
.
block_tables
[
seq
.
seq_id
]
=
new_block_table
...
...
@@ -194,12 +195,11 @@ class BlockSpaceManager:
for
gpu_block
in
block_table
:
if
gpu_block
in
mapping
:
new_block_table
.
append
(
mapping
[
gpu_block
])
continue
cpu_block
=
self
.
cpu_allocator
.
allocate
()
cpu_block
=
mapping
[
gpu_block
]
else
:
cpu_block
=
self
.
cpu_allocator
.
allocate
()
mapping
[
gpu_block
]
=
cpu_block
new_block_table
.
append
(
cpu_block
)
mapping
[
gpu_block
]
=
cpu_block
# Free the GPU block swapped out to CPU.
self
.
gpu_allocator
.
free
(
gpu_block
)
self
.
block_tables
[
seq
.
seq_id
]
=
new_block_table
...
...
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