[HiCache] Fix the compatibility between PP and HiCache (L2). (#27285)
Co-authored-by: ybyang <ybyang7@iflytek.com> Co-authored-by: hzh0425 <hzh0425@apache.org> Co-authored-by: shangmingc <csmthu@gmail.com> Co-authored-by: 晟海 <huangtingwei.htw@antgroup.com>
This commit is contained in:
co-authored by
ybyang
hzh0425
shangmingc
晟海
parent
aa5213abb1
commit
42fe025280
@@ -34,6 +34,8 @@ if TYPE_CHECKING:
|
||||
from sglang.srt.mem_cache.memory_pool_host import HostKVCache
|
||||
|
||||
from sglang.srt.distributed import (
|
||||
get_pipeline_model_parallel_rank,
|
||||
get_pipeline_model_parallel_world_size,
|
||||
get_tensor_model_parallel_rank,
|
||||
get_tensor_model_parallel_world_size,
|
||||
)
|
||||
@@ -254,19 +256,19 @@ class HiCacheController:
|
||||
load_cache_event: threading.Event,
|
||||
attn_cp_group: Optional[torch.distributed.ProcessGroup] = None,
|
||||
attn_tp_group: Optional[torch.distributed.ProcessGroup] = None,
|
||||
pp_group: Optional[torch.distributed.ProcessGroup] = None,
|
||||
write_policy: str = "write_through_selective",
|
||||
io_backend: str = "",
|
||||
storage_backend: Optional[str] = None,
|
||||
prefetch_threshold: int = 256,
|
||||
model_name: Optional[str] = None,
|
||||
storage_backend_extra_config: Optional[dict] = None,
|
||||
pp_rank: int = 0,
|
||||
pp_size: int = 1,
|
||||
enable_storage_metrics: bool = False,
|
||||
):
|
||||
self.tp_group = tp_group
|
||||
self.attn_cp_group = attn_cp_group
|
||||
self.attn_tp_group = attn_tp_group
|
||||
self.pp_group = pp_group
|
||||
self.prefetch_sync_groups: List[torch.distributed.ProcessGroup] = []
|
||||
self.mem_pool_device_allocator = token_to_kv_pool_allocator
|
||||
mem_pool_device = token_to_kv_pool_allocator.get_kvcache()
|
||||
@@ -282,8 +284,6 @@ class HiCacheController:
|
||||
self.enable_storage = False
|
||||
self.storage_backend = None
|
||||
self.storage_backend_type = None
|
||||
self.pp_rank = pp_rank
|
||||
self.pp_size = pp_size
|
||||
self.enable_storage_metrics = enable_storage_metrics
|
||||
|
||||
# Draft KV pool support (best-effort piggyback on target L2/L3 ops).
|
||||
@@ -624,6 +624,9 @@ class HiCacheController:
|
||||
self.tp_size = get_tensor_model_parallel_world_size()
|
||||
self.dp_rank = 0
|
||||
|
||||
self.pp_rank = get_pipeline_model_parallel_rank()
|
||||
self.pp_size = get_pipeline_model_parallel_world_size()
|
||||
|
||||
# Currently, NPUMLATokenToKVPool is the subclass of MLATokenToKVPool.
|
||||
# DeepSeekV4TokenToKVPool has compressed MLA-style rank-replicated cache
|
||||
# data. storage only needs rank 0 to write it back.
|
||||
|
||||
Reference in New Issue
Block a user