Using UnifiedRadixTree by default for SWA, Mamba, and DSA models (#30468)

Co-authored-by: ispobock <ispobaoke@gmail.com>
This commit is contained in:
Zhangheng
2026-07-14 15:17:08 +08:00
committed by GitHub
co-authored by ispobock
parent 7e0b29ac03
commit afa3c06d1f
6 changed files with 78 additions and 27 deletions
@@ -3,6 +3,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Dict
from sglang.srt.mem_cache.swa_radix_cache import TreeNode as SWATreeNode
from sglang.srt.mem_cache.unified_radix_cache import UnifiedTreeNode
if TYPE_CHECKING:
from sglang.test.scripted_runtime.context.api import ScriptedContext
@@ -19,6 +20,8 @@ def get_all_node_lock_refs(ctx: ScriptedContext) -> Dict[int, int]:
def _node_lock_ref(node: Any) -> int:
if isinstance(node, SWATreeNode):
return node.full_lock_ref + node.swa_lock_ref
if isinstance(node, UnifiedTreeNode):
return sum(cd.lock_ref for cd in node.component_data)
return node.lock_ref