Skip to content

Commit e5a021d

Browse files
hbarclayclaude
andcommitted
Place launch-less device work in its step by device time
Muse Spark's prefill all-gathers (layernorm sequence parallelism) run as 64 MiB peer copies issued through driver calls Kineto does not record: 2046 per rank per prefill window on B200 (run 38948461605), all unattributed and unstepped. Such work now joins the step whose device span on its rank contains it (step_inferred: device_time); all 2046 land in a step. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 20bcfa8 commit e5a021d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎inferencex-e2e/benchmarks/profiling/extract.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ def extract_replay(trace, captured, rank, window, step_log, copies, clocks, rout
10281028
key = step_key(row.get("marks") or {})
10291029
row["step"] = list(key) if key else None
10301030
by_step[key].append(row)
1031+
place_by_device_time(by_step)
10311032

10321033
rank_dir = os.path.join(out_dir, f"window{window}", str(rank))
10331034
os.makedirs(rank_dir, exist_ok=True)
@@ -1073,6 +1074,31 @@ def extract_replay(trace, captured, rank, window, step_log, copies, clocks, rout
10731074
return entry, index
10741075

10751076

1077+
def place_by_device_time(by_step):
1078+
"""Device work with no CPU launch (copies a library issues through driver calls Kineto
1079+
does not record, e.g. Muse Spark's copy-engine all-gathers under layernorm sequence
1080+
parallelism: 64 MiB peer copies) goes in the step whose device span on this rank
1081+
contains it, marked step_inferred; outside every step it stays unstepped."""
1082+
loose = by_step.get(None) or []
1083+
spans = sorted((min(r["ts_us"] for r in rows), max(r["ts_us"] + r["dur_us"] for r in rows), key)
1084+
for key, rows in by_step.items() if key is not None and rows)
1085+
if not loose or not spans:
1086+
return
1087+
starts = [s for s, _, _ in spans]
1088+
kept = []
1089+
for row in loose:
1090+
k = bisect.bisect_right(starts, row["ts_us"]) - 1
1091+
if row["source"] == "unattributed" and k >= 0 and row["ts_us"] + row["dur_us"] <= spans[k][1]:
1092+
key = spans[k][2]
1093+
row["step"], row["step_inferred"] = list(key), "device_time"
1094+
by_step[key].append(row)
1095+
else:
1096+
kept.append(row)
1097+
by_step[None] = kept
1098+
if not kept:
1099+
del by_step[None]
1100+
1101+
10761102
def stream_successors(trace):
10771103
"""device activity index -> start of the next activity on its device and stream."""
10781104
streams = collections.defaultdict(list)

0 commit comments

Comments
 (0)