Report the whole server's world size in the scheduler's internal state (#35929)

This commit is contained in:
fzyzcjy
2026-08-24 20:21:45 +08:00
committed by GitHub
parent 6dd79576cd
commit e586a6f2c5
4 changed files with 144 additions and 1 deletions
+3 -1
View File
@@ -44,6 +44,7 @@ from sglang.srt.runtime_context import (
get_observability,
get_parallel,
get_schedule,
get_server_args,
get_serving,
get_spec,
)
@@ -296,7 +297,7 @@ from sglang.srt.plugins import load_plugins
from sglang.srt.runtime_context import get_context, publish
from sglang.srt.sampling.sampling_batch_info import SamplingBatchInfo
from sglang.srt.sampling.sampling_params import TOP_K_ALL
from sglang.srt.server_args import PortArgs, ServerArgs
from sglang.srt.server_args import PortArgs, ServerArgs, compute_world_size
from sglang.srt.session.session_controller import SessionController
from sglang.srt.speculative.base_spec_worker import BaseSpecWorker
from sglang.srt.speculative.dflash_utils import validate_dflash_request
@@ -4421,6 +4422,7 @@ class Scheduler(
# Resolved config (pristine server_args + post-publish overrides) so a
# readback reflects values changed via /set_internal_state, not startup.
ret = get_context().resolved_server_args_dict()
ret["world_size"] = compute_world_size(get_server_args())
ret["last_gen_throughput"] = self.metrics_reporter.last_gen_throughput
draft_graph_memory_usage = (
None if self.draft_worker is None else self.draft_worker.graph_memory_usage
+9
View File
@@ -10450,6 +10450,15 @@ class ServerArgs:
return self.expert_balancedness_report_mode in ("prometheus", "both")
def compute_world_size(server_args: ServerArgs) -> int:
"""Return the total GPU count across all data-parallel replicas."""
return (
(1 if server_args.enable_dp_attention else server_args.dp_size)
* server_args.tp_size
* server_args.pp_size
)
def m3_fp8_attn_gemm_enabled(args) -> bool:
"""Whether MiniMax-M3 attention GEMMs run in fp8 (no opt-in flag; active
whenever possible): fp8_e4m3 main + index KV caches, fp8-cast q, fp8