[Weight Cache] Enhance test and support EPLB (#36198)

This commit is contained in:
Xun Sun
2026-08-26 23:11:53 -07:00
committed by GitHub
parent b294bd4bc7
commit adcf73d7f7
5 changed files with 77 additions and 9 deletions
-5
View File
@@ -8467,11 +8467,6 @@ class ServerArgs:
"(--weight-cache-mode off) for this configuration."
)
if cfg.weight_cache_mode != "off" and cfg.enable_eplb:
raise ValueError(
"--weight-cache-mode is not supported together with --enable-eplb."
)
def _is_mistral_native_format(self) -> bool:
"""True iff the checkpoint requires load_format=mistral.
+18
View File
@@ -316,6 +316,7 @@ class WeightCacheDaemon:
# The initialized groups are the authority for rank identity. This
# avoids maintaining a second copy of the model-parallel hierarchy.
self._init_distributed(server_args, model_config)
self._initialize_eplb_expert_location_metadata(model_config)
moe_dp_rank = get_parallel().moe_dp_rank
moe_ep_rank = get_parallel().moe_ep_rank
self.config = CacheConfig(
@@ -457,6 +458,23 @@ class WeightCacheDaemon:
f"metadata size ~{total_bytes / 1024 / 1024:.1f} MB"
)
def _initialize_eplb_expert_location_metadata(self, model_config) -> None:
"""Build the same initial physical expert layout as the engine."""
if not self.server_args.enable_eplb:
return
from sglang.srt.eplb.expert_location import (
compute_initial_expert_location_metadata,
set_global_expert_location_metadata,
)
set_global_expert_location_metadata(
compute_initial_expert_location_metadata(
model_config=model_config,
moe_ep_rank=get_parallel().moe_ep_rank,
)
)
def serve(self):
"""Block and serve IPC handles over Unix socket."""
# Do NOT unlink an existing socket here: stale-file cleanup is the launch