Skip to content

CollectiveX: capture rank alignment before graph timing - #3727

Merged
Oseltamivir merged 4 commits into
SemiAnalysisAI:mainfrom
nv-lschneider:collectivex-graph-rank-alignment
Oct 14, 2026
Merged

Oseltamivir merged 4 commits into
SemiAnalysisAI:mainfrom
nv-lschneider:collectivex-graph-rank-alignment

Conversation

@nv-lschneider

@nv-lschneider nv-lschneider commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Move the AllReduce rank-alignment barrier inside the CUDA graph, before the timing events. Remove the host-side handoff and alignment spin kernel. This reduces rank skew without including alignment in the measured interval.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@nv-lschneider
nv-lschneider force-pushed the collectivex-graph-rank-alignment branch from d86b979 to e0e26e2 Compare October 5, 2026 16:34
@nv-lschneider nv-lschneider changed the title CollectiveX: capture rank alignment before graph timing CollectiveX: capture rank alignment before graph timing / CollectiveX: 在图计时前捕获 rank 对齐操作 Oct 5, 2026
Launching the graph separately after the rank barrier lets CPU launch
overhead reintroduce rank skew, which can inflate measured latency.
Capture the AllReduce before the graph's timing events to remove that
host-side gap and the alignment spin, while keeping alignment outside
the measured interval.

Signed-off-by: Ludwig Schneider <[email protected]>
@nv-lschneider nv-lschneider changed the title CollectiveX: capture rank alignment before graph timing / CollectiveX: 在图计时前捕获 rank 对齐操作 CollectiveX: capture rank alignment before graph timing Oct 5, 2026
@nv-lschneider
nv-lschneider force-pushed the collectivex-graph-rank-alignment branch from e0e26e2 to 0cf40b1 Compare October 5, 2026 16:40

@kwen2501 kwen2501 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvement!

@Oseltamivir

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

@Oseltamivir
Oseltamivir merged commit b5b7b0b into SemiAnalysisAI:main Oct 14, 2026
3 checks passed
Oseltamivir added a commit that referenced this pull request Oct 15, 2026
…sed methodology

Graphed fresh-entry rows published only p50 because a rank that launched its replay late stalled
the others inside the window (gb200 flashinfer EP8 T=1 roundtrip p99 858 us against a combine p99
of 30 us). Since #3727 captures the alignment all-reduce in the graph, a late launch waits at that
barrier before any window opens. A recheck on 2026-10-15 measured that cell at 49 us p99 against
46 us p50, and graphed decode roundtrip p99 at 1.01-1.19x p50 on h200, gb200 and mi325x, in line
with each row's own pair-period tails, so graphed rows now publish every percentile. Eager rows
keep their miss and stall gate.

docs/methodology-summary.md states the methodology in brief (scope, workload, per-backend
contracts, both timing families, what is published, correctness, reading results, limits); the
README and methodology.md link it. The README no longer says MoRI stays eager: it replays graphs in
both phases.

中文:公开 CUDA graph 行的 fresh-entry 尾部延迟,并新增精简版方法说明。

此前 graph 行的 fresh-entry 序列只公开 p50,因为某个 rank 较晚发起 replay 时,会在计时窗口内拖住其他
rank(gb200 flashinfer EP8 T=1 的 roundtrip p99 为 858 us,而 combine p99 只有 30 us)。#3727 把对齐用的
all-reduce 捕获进 graph 后,较晚的发起会在任何窗口打开之前于该屏障处等待。2026-10-15 的复查中,该用例
p99 为 49 us、p50 为 46 us;h200、gb200 和 mi325x 上 graph 化 decode 的 roundtrip p99 为 p50 的
1.01-1.19 倍,与各行自身 pair-period 的尾部一致,因此 graph 行现在公开所有百分位。eager 行保留基于未对齐与
主机停顿样本的门控。

docs/methodology-summary.md 简要说明方法(范围、负载、各后端约定、两类计时、公开内容、正确性、结果解读、
局限),README 和 methodology.md 均链接到它。README 不再声称 MoRI 保持 eager:它在两个阶段都使用 graph
replay。
Oseltamivir added a commit that referenced this pull request Oct 15, 2026
…sh graphed tails / CollectiveX:统一各后端的计时窗口并公开 graph 尾部延迟 (#4101)

* feat(collectivex): publish graphed fresh-entry tails and add a condensed methodology

Graphed fresh-entry rows published only p50 because a rank that launched its replay late stalled
the others inside the window (gb200 flashinfer EP8 T=1 roundtrip p99 858 us against a combine p99
of 30 us). Since #3727 captures the alignment all-reduce in the graph, a late launch waits at that
barrier before any window opens. A recheck on 2026-10-15 measured that cell at 49 us p99 against
46 us p50, and graphed decode roundtrip p99 at 1.01-1.19x p50 on h200, gb200 and mi325x, in line
with each row's own pair-period tails, so graphed rows now publish every percentile. Eager rows
keep their miss and stall gate.

docs/methodology-summary.md states the methodology in brief (scope, workload, per-backend
contracts, both timing families, what is published, correctness, reading results, limits); the
README and methodology.md link it. The README no longer says MoRI stays eager: it replays graphs in
both phases.

中文:公开 CUDA graph 行的 fresh-entry 尾部延迟,并新增精简版方法说明。

此前 graph 行的 fresh-entry 序列只公开 p50,因为某个 rank 较晚发起 replay 时,会在计时窗口内拖住其他
rank(gb200 flashinfer EP8 T=1 的 roundtrip p99 为 858 us,而 combine p99 只有 30 us)。#3727 把对齐用的
all-reduce 捕获进 graph 后,较晚的发起会在任何窗口打开之前于该屏障处等待。2026-10-15 的复查中,该用例
p99 为 49 us、p50 为 46 us;h200、gb200 和 mi325x 上 graph 化 decode 的 roundtrip p99 为 p50 的
1.01-1.19 倍,与各行自身 pair-period 的尾部一致,因此 graph 行现在公开所有百分位。eager 行保留基于未对齐与
主机停顿样本的门控。

docs/methodology-summary.md 简要说明方法(范围、负载、各后端约定、两类计时、公开内容、正确性、结果解读、
局限),README 和 methodology.md 均链接到它。README 不再声称 MoRI 保持 eager:它在两个阶段都使用 graph
replay。

* fix(collectivex): make eager and graphed timing windows consistent across backends

From the per-backend methodology audit:
- Graphed captures put a calibrated spin ahead of the in-graph all-reduce. HIP submits a
  replay node by node from the host, so on ROCm a host lagging after the all-reduce opened its
  peers' windows early (mi300x MoRI graphed p99/p50 1.30-1.55 vs 1.02-1.14 eager on the same
  node). A replay call that outlasts the spin counts as missed and gates tails like an eager
  miss; graphed rows now carry rank_alignment.
- Capture uses torch's default (global) mode, as vLLM and SGLang capture.
- The replay value check rescales the inputs by 2 between the upload replay and the checked one,
  and every timed capture's poison verdict is ANDed, not only the last.
- Eager leads run through the timed op's enqueue; GC is off per series; a host-synced dispatch
  ahead of a timed stage/combine runs before the alignment instead of spending the spin.
- Eager combine is a fresh pair with the hoisted stage, as graph replay times it.
- Eager chain siblings align with the all-reduce alone; host-synced chains hold each sibling,
  restart it on every rank when any host throttled around it (up to 3 times), and publish
  chain_health.host_retried_siblings / host_stalled_trials; a still-stalled trial keeps only the
  period p50.
- isolated_sum is dispatch + combine on every row (stage was summed on eager rows only).
- implementation.library_config carries the adapter's realized configuration.

中文:
根据逐后端的方法学审计,统一 eager 与 graph 计时窗口:graph 捕获在图内 all-reduce 前加入校准的 spin
(HIP 由主机逐节点提交 replay,ROCm 上主机滞后会提前打开其他 rank 的窗口),超过 spin 的 replay
调用计为 missed 并像 eager 一样门控尾部;捕获使用 torch 默认(global)模式,与 vLLM、SGLang 一致;
replay 值检查在两次 replay 之间将输入乘 2,且对每次计时捕获的 poison 结果取与;eager 的 lead 覆盖
被计时操作的入队,每个序列关闭 GC,需主机同步的 dispatch 在对齐之前执行;eager combine 改为带提升
stage 的新鲜 pair;eager 链只用 all-reduce 对齐,需主机同步的链逐段门控并重试,发布重试与停顿计数;
isolated_sum 统一为 dispatch + combine;implementation.library_config 记录适配器实际使用的配置。

* fix(collectivex): keep same-second hand runs of one shard out of each other's stage

Two run.sh invocations of the same shard started in the same second (a graphed and an eager
run, say) built the same execution id, so the second found the first's stage directory and
exited 1 before submitting. The id now carries the launching shell's pid.

中文:同一秒内启动的同一分片的两次 run.sh(例如 graph 与 eager 各一次)会生成相同的执行 ID,
第二次会撞上第一次的 stage 目录并在提交前以 1 退出。现在执行 ID 带上启动 shell 的 pid。

* fix(collectivex): keep garbage collection off inside eager chains

Fresh-entry series already ran with GC off; a host-bound eager chain's pair window carries the
host's pace, so a collection there lands in the period too.

中文:fresh-entry 序列已经在关闭 GC 的情况下运行;受主机限制的 eager 链的 pair 窗口反映主机节奏,
链内的垃圾回收同样会计入周期,因此链内也关闭 GC。

* fix(collectivex): poison the staged combine input in the graph replay check

An FP8 row's staged BF16 payload was left intact between the upload replay and the checked one,
so a replay that skipped the captured stage still passed. The check now poisons
handle.combine_input with dispatch's outputs.

中文:FP8 行的暂存 BF16 载荷在上传用 replay 与被检查的 replay 之间没有被覆盖,跳过捕获的 stage 的
replay 仍能通过检查。现在检查会与 dispatch 的输出一起覆盖 handle.combine_input。

* refactor(collectivex): share the implementation_details hook text with the backend branches

中文:与各后端分支共用 implementation_details 钩子的文本与位置,便于合并。

* docs(collectivex): describe the consistent timing windows and the AMD graph-replay fix

methodology.md, the condensed summary and the README now state the captured spin and replay-call
misses (with the mi300x/mi325x before/after), the global capture mode, the rescaled replay check,
the eager lead and GC rules, the one combine window, the all-reduce-only eager chain and the
host-gated chains, isolated_sum and implementation.library_config.

中文:methodology.md、精简版说明和 README 现在说明:graph 捕获中的 spin 与 replay 调用 missed
计数(附 mi300x/mi325x 前后对比)、global 捕获模式、带输入缩放的 replay 检查、eager 的 lead 与 GC
规则、统一的 combine 窗口、只用 all-reduce 对齐的 eager 链和带主机门控的链、isolated_sum 以及
implementation.library_config。

* docs(collectivex): add the mi300x spread change to the graph-replay evidence

中文:在 graph replay 证据中补充 mi300x 跨 rank 离散度的变化。

* docs(collectivex): name the staged combine input in the replay check's docstring

中文:在 replay 检查的 docstring 中写明被覆盖的暂存 combine 输入。

* docs(collectivex): say graphed rows share the suspect gate, and match slow_gpu in the summary

中文:说明 graph 行同样经过可疑样本门控,并让精简说明中的 slow_gpu 条件与实现一致。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants