[Feat] profiler: Add the forward pass id to detailed step span labels (#44775)

Co-authored-by: metamergebot <metamergebot@users.noreply.github.com>
Co-authored-by: charlotte12l <charlotte12l@users.noreply.github.com>
This commit is contained in:
metamergebot
2026-10-16 16:51:20 -07:00
committed by GitHub
co-authored by metamergebot charlotte12l
parent 36cf028346
commit d230f2c35b
3 changed files with 40 additions and 1 deletions
@@ -1811,7 +1811,11 @@ class ModelRunner:
# Step span
step_span_ctx = profile_range(
build_step_span_name(forward_batch, is_draft_worker=self.is_draft_worker)
build_step_span_name(
forward_batch,
is_draft_worker=self.is_draft_worker,
forward_id=self.forward_pass_id,
)
)
canary_ctx = (
+5
View File
@@ -464,6 +464,7 @@ def build_step_span_name(
detailed_annotations: bool | None = None,
*,
is_draft_worker: bool = False,
forward_id: int | None = None,
) -> str:
"""Build the profile-trace span name for one forward step.
@@ -475,6 +476,8 @@ def build_step_span_name(
The target-verify step is labeled ``VERIFY``; every step a draft model
runner emits is labeled ``DRAFT`` (some draft paths borrow the TARGET_VERIFY
mode, so the mode name alone cannot tell the two models apart).
When detailed annotations are enabled, ``forward_id`` binds the span to
the expert-distribution recorder's forward ID for this model runner.
"""
if detailed_annotations is None:
detailed_annotations = detailed_annotations_enabled()
@@ -497,4 +500,6 @@ def build_step_span_name(
suffix = build_detailed_annotation_suffix(forward_batch)
if suffix:
base = f"{base} {suffix}"
if forward_id is not None:
base = f"{base} forward_id={forward_id}"
return f"{base}]"