[refactor] Adopt get_parallel() everywhere and close out the parallel wrapper surface (#30492)
This commit is contained in:
@@ -33,19 +33,12 @@ if TYPE_CHECKING:
|
||||
from sglang.srt.mem_cache.allocator import BaseTokenToKVPoolAllocator
|
||||
from sglang.srt.mem_cache.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,
|
||||
)
|
||||
from sglang.srt.layers.dp_attention import (
|
||||
get_attention_dp_rank,
|
||||
get_attention_tp_rank,
|
||||
get_attention_tp_size,
|
||||
is_dp_attention_enabled,
|
||||
)
|
||||
from sglang.srt.mem_cache.memory_pool import MLATokenToKVPool
|
||||
from sglang.srt.runtime_context import get_parallel
|
||||
from sglang.srt.utils import get_device_module
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -569,16 +562,16 @@ class HiCacheController:
|
||||
storage_backend_extra_config = {}
|
||||
|
||||
if is_dp_attention_enabled():
|
||||
self.tp_rank = get_attention_tp_rank()
|
||||
self.tp_size = get_attention_tp_size()
|
||||
self.tp_rank = get_parallel().attn_tp_rank
|
||||
self.tp_size = get_parallel().attn_tp_size
|
||||
self.dp_rank = get_attention_dp_rank()
|
||||
else:
|
||||
self.tp_rank = get_tensor_model_parallel_rank()
|
||||
self.tp_size = get_tensor_model_parallel_world_size()
|
||||
self.tp_rank = get_parallel().tp_rank
|
||||
self.tp_size = get_parallel().tp_size
|
||||
self.dp_rank = 0
|
||||
|
||||
self.pp_rank = get_pipeline_model_parallel_rank()
|
||||
self.pp_size = get_pipeline_model_parallel_world_size()
|
||||
self.pp_rank = get_parallel().pp_rank
|
||||
self.pp_size = get_parallel().pp_size
|
||||
|
||||
# Currently, NPUMLATokenToKVPool is the subclass of MLATokenToKVPool.
|
||||
# DeepSeekV4TokenToKVPool has compressed MLA-style rank-replicated cache
|
||||
|
||||
Reference in New Issue
Block a user