[mem_cache][5/N] refactor: extract host KV cache base layer into pool_host package (#27273)

This commit is contained in:
shuwenn
2026-06-20 20:44:08 +08:00
committed by GitHub
parent 1109acc24b
commit ff1fc1fbdf
16 changed files with 380 additions and 332 deletions
+3 -1
View File
@@ -6,9 +6,11 @@ import torch
from sglang.jit_kernel.hicache import can_use_write_back_jit_kernel
from sglang.srt.mem_cache.memory_pool import MHATokenToKVPool, MLATokenToKVPool
from sglang.srt.mem_cache.memory_pool_host import (
ALLOC_MEMORY_FUNCS,
MHATokenToKVPoolHost,
MLATokenToKVPoolHost,
)
from sglang.srt.mem_cache.pool_host.common import (
ALLOC_MEMORY_FUNCS,
alloc_with_pin_memory,
)
from sglang.srt.utils import is_cuda, is_hip, is_npu, is_xpu
@@ -85,7 +85,7 @@ class TestHiSparseUnit(unittest.TestCase):
torch.distributed.init_process_group(backend="gloo", rank=0, world_size=1)
cls.tp_group = torch.distributed.group.WORLD
from sglang.srt.mem_cache.memory_pool_host import (
from sglang.srt.mem_cache.pool_host.common import (
ALLOC_MEMORY_FUNCS,
alloc_with_pin_memory,
)
@@ -154,7 +154,7 @@ class TestHiSparseUnit(unittest.TestCase):
@classmethod
def tearDownClass(cls):
from sglang.srt.mem_cache.memory_pool_host import ALLOC_MEMORY_FUNCS
from sglang.srt.mem_cache.pool_host.common import ALLOC_MEMORY_FUNCS
ALLOC_MEMORY_FUNCS["cuda"] = cls._original_alloc
if torch.distributed.is_initialized():
@@ -5,9 +5,11 @@ import torch
from sglang.srt.mem_cache.memory_pool import DSATokenToKVPool
from sglang.srt.mem_cache.memory_pool_host import (
ALLOC_MEMORY_FUNCS,
DSAIndexerPoolHost,
MLATokenToKVPoolHost,
)
from sglang.srt.mem_cache.pool_host.common import (
ALLOC_MEMORY_FUNCS,
alloc_with_pin_memory,
)
from sglang.srt.utils import is_cuda, is_hip, is_npu, is_xpu