From 07359efce92ccef05bed214284002436353a9928 Mon Sep 17 00:00:00 2001 From: Ke Bao Date: Sun, 8 Mar 2026 23:21:18 +0800 Subject: [PATCH] Fix missing clone in hicache (#20130) --- python/sglang/srt/mem_cache/hiradix_cache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/mem_cache/hiradix_cache.py b/python/sglang/srt/mem_cache/hiradix_cache.py index 2acb01157..e614b7743 100644 --- a/python/sglang/srt/mem_cache/hiradix_cache.py +++ b/python/sglang/srt/mem_cache/hiradix_cache.py @@ -1044,7 +1044,7 @@ class HiRadixCache(RadixCache): self.ongoing_load_back[last_hit_node.id] = last_hit_node offset = 0 for node in nodes_to_load: - node.value = device_indices[offset : offset + len(node.host_value)] + node.value = device_indices[offset : offset + len(node.host_value)].clone() offset += len(node.host_value) self.evictable_size_ += len(device_indices) self.inc_lock_ref(last_hit_node) @@ -1472,7 +1472,7 @@ class HiRadixCache(RadixCache): if node.evicted: # change the reference if the node is evicted # this often happens in the case of KV cache recomputation - node.value = value[:prefix_len] + node.value = value[:prefix_len].clone() self.evictable_size_ += len(node.value) self._update_leaf_status(node) self._update_host_leaf_status(node)