fix: handle empty HiCache match prefixes

This commit is contained in:
2026-05-08 02:47:25 +08:00
parent 829f3ebceb
commit 39f40c02b4
2 changed files with 51 additions and 0 deletions

View File

@@ -1521,6 +1521,14 @@ class HiRadixCache(RadixCache):
page_aligned_len = len(key) // self.page_size * self.page_size
key = key[:page_aligned_len]
if len(key) == 0:
return MatchResult(
device_indices=empty_value,
last_device_node=self.root_node,
last_host_node=self.root_node,
host_hit_length=0,
)
value, last_node = self._match_prefix_helper(self.root_node, key)
if value:
value = torch.cat(value)