diff --git a/python/sglang/srt/mem_cache/hicache_storage.py b/python/sglang/srt/mem_cache/hicache_storage.py index 8e39fd0acc14..ba88c5f61b0a 100644 --- a/python/sglang/srt/mem_cache/hicache_storage.py +++ b/python/sglang/srt/mem_cache/hicache_storage.py @@ -307,17 +307,21 @@ def __init__( ): self.file_path = envs.SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR.get() or file_path - tp_rank, tp_size, model_name, is_mla_model = ( + tp_rank, tp_size, pp_rank, pp_size, model_name, is_mla_model = ( storage_config.tp_rank, storage_config.tp_size, + storage_config.pp_rank, + storage_config.pp_size, storage_config.model_name, storage_config.is_mla_model, ) model_name = "-".join(model_name.split("/")) if model_name else "" - if is_mla_model: - self.config_suffix = f"_{model_name}" - else: - self.config_suffix = f"_{model_name}_{tp_rank}_{tp_size}" + enable_pp = pp_size > 1 + self.config_suffix = f"_{model_name}" + if not is_mla_model: + self.config_suffix += f"_{tp_rank}_{tp_size}" + if enable_pp: + self.config_suffix += f"_{pp_size}_{pp_rank}" if not os.path.exists(self.file_path) and tp_rank == 0: os.makedirs(self.file_path) logger.info(f"Created HiCacheFile storage directory at {self.file_path}")