Support EPLB balancedness prometheus metric without GPU->CPU synchronize (#15401)
This commit is contained in:
@@ -68,6 +68,7 @@ from sglang.srt.elastic_ep.elastic_ep import ElasticEPStateManager
|
||||
from sglang.srt.environ import envs
|
||||
from sglang.srt.eplb.eplb_manager import EPLBManager
|
||||
from sglang.srt.eplb.expert_distribution import (
|
||||
ExpertDistributionMetrics,
|
||||
ExpertDistributionRecorder,
|
||||
get_global_expert_distribution_recorder,
|
||||
set_global_expert_distribution_recorder,
|
||||
@@ -272,6 +273,7 @@ class RankZeroFilter(logging.Filter):
|
||||
class ModelRunnerOutput:
|
||||
logits_output: Union[LogitsProcessorOutput, PPProxyTensors]
|
||||
can_run_graph: bool
|
||||
expert_distribution_metrics: Optional[ExpertDistributionMetrics] = None
|
||||
|
||||
|
||||
class ModelRunner:
|
||||
@@ -2738,7 +2740,7 @@ class ModelRunner:
|
||||
with get_global_expert_distribution_recorder().with_forward_pass(
|
||||
self.forward_pass_id,
|
||||
forward_batch,
|
||||
):
|
||||
) as recorder_outputs:
|
||||
output = self._forward_raw(
|
||||
forward_batch,
|
||||
skip_attn_backend_init,
|
||||
@@ -2746,6 +2748,7 @@ class ModelRunner:
|
||||
reinit_attn_backend,
|
||||
split_forward_count,
|
||||
)
|
||||
output.expert_distribution_metrics = recorder_outputs.get("metrics")
|
||||
|
||||
if self.eplb_manager is not None:
|
||||
self.eplb_manager.on_forward_pass_end()
|
||||
|
||||
Reference in New Issue
Block a user