[HiCache] resolve conflict between chunked-prefill and hicache hit count (#9776)

This commit is contained in:
Zhiqiang Xie
2025-08-30 01:30:54 +08:00
committed by GitHub
parent e5b29bf14e
commit 54e872d343
8 changed files with 20 additions and 17 deletions
+5 -3
View File
@@ -195,7 +195,7 @@ class RadixCache(BasePrefixCache):
last_host_node=last_node,
)
def insert(self, key: List, value=None):
def insert(self, key: List, value=None, chunked=False):
if self.disable:
return 0
@@ -240,7 +240,7 @@ class RadixCache(BasePrefixCache):
self.req_to_token_pool.free(req.req_pool_idx)
self.dec_lock_ref(req.last_node)
def cache_unfinished_req(self, req: Req):
def cache_unfinished_req(self, req: Req, chunked=False):
"""Cache request when it is unfinished."""
if self.disable:
return
@@ -261,7 +261,9 @@ class RadixCache(BasePrefixCache):
page_aligned_token_ids = token_ids[:page_aligned_len]
# Radix Cache takes one ref in memory pool
new_prefix_len = self.insert(page_aligned_token_ids, page_aligned_kv_indices)
new_prefix_len = self.insert(
page_aligned_token_ids, page_aligned_kv_indices, chunked=chunked
)
self.token_to_kv_pool_allocator.free(
kv_indices[len(req.prefix_indices) : new_prefix_len]
)