[kv cache] update num_free_blocks in the end (#24228)
Signed-off-by: Andy Xie <andy.xning@gmail.com>
This commit is contained in:
@@ -370,7 +370,6 @@ class FreeKVCacheBlockQueue:
|
||||
"""
|
||||
if len(blocks) == 0:
|
||||
return
|
||||
self.num_free_blocks += len(blocks)
|
||||
|
||||
last_block = self.fake_free_list_tail.prev_free_block
|
||||
assert last_block is not None, (
|
||||
@@ -385,6 +384,8 @@ class FreeKVCacheBlockQueue:
|
||||
last_block.next_free_block = self.fake_free_list_tail
|
||||
self.fake_free_list_tail.prev_free_block = last_block
|
||||
|
||||
self.num_free_blocks += len(blocks)
|
||||
|
||||
def get_all_free_blocks(self) -> list[KVCacheBlock]:
|
||||
"""Get all free blocks in the free list. Mainly used for testing.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user