Repository navigation
CollectiveX: keep the FP8 dequant out of the chained roundtrip - #2348
Conversation
`stage` converts the dispatched FP8 back to BF16 for combine, and it exists only for
FP8 (`stage_device_work = self._fp8`). Because the chained roundtrip called it inline,
FP8 and BF16 were timed through structurally different pipelines -- on exactly the axis
the comparison is for. `dispatch` and `combine` were never affected; they run `stage` in
time_us's untimed `pre`.
Production FP8 MoE does not have that pass. SGLang's DeepEP dispatcher contains no
dequant at all: it pre-quantises with `sglang_per_token_group_quant_fp8(hidden, 128, ...)`
and hands FP8 + scales straight to DeepGEMM. vLLM only dequantises as a quant-format
MISMATCH fallback -- when `block_k == DEEPEP_QUANT_BLOCK_SIZE` it returns the dispatched
FP8 + scales untouched ("DeepEP kernels did the quantization for us"). The deepseek-v3
block-128 FP8 workload this suite runs takes the matched branch.
So model that path by default: `EPBackend.fp8_consume = "native"` materialises the
combine input once, untimed, and `run_roundtrip` accepts it via `combine_input_attr`
(NCCL EP names its tensor `combine_input_t`). `CX_FP8_CONSUME=dequant` restores the
inline stage as a verification hatch for vLLM's mismatch path; it is not a sweep axis,
because the mismatch cost is derivable as `roundtrip + stage` (+2.4%..-0.1%) while the
reverse subtraction errs -11.6% at T=1. Artifacts record which model produced them under
`implementation.fp8_consume`.
Measured on b200 deepep-v2 low-latency FP8, one node, three runs:
T native dequant bf16 control
1 61.3 302.0 63.7
64 74.8 312.6 84.6
256 126.5 357.4 153.4
The verdict inverts: the old chain said FP8 was 4.7x slower than BF16 at T=1; FP8 is in
fact faster, by a margin that grows 3.8% -> 17.5% with tokens, which is the signature of
a bandwidth saving rather than a fixed conversion pass. The hatch reproduces the historical
number (302.0 vs 302.5), and BF16 is unmoved. Latency now agrees with `byte_provenance`
instead of contradicting it -- at T=256 dispatch is 68.1 FP8 vs 84.9 BF16 for half the
bytes, while combine is 75.8 vs 78.8 because both send BF16 on the wire.
Across the existing corpus this flips the FP8-vs-BF16 verdict in 39 of 51 comparisons.
There was a problem hiding this comment.
Approving — the one finding is a real but minor nit (Nit-severity, measurement-only bench code in experimental/CollectiveX), so it does not block this PR.
Extended reasoning...
Overview
This PR changes how benchmark_roundtrip in experimental/CollectiveX/bench/ep_backend.py models FP8 consumption in the chained dispatch->stage->combine roundtrip, adding a fp8_consume ("native" default vs "dequant") toggle and a fast path that materializes the combine input once, untimed, instead of re-running stage() every iteration. It also adds combine_input_attr so adapters can name their combine-input tensor, updates ep_nccl.py accordingly, threads the new field into the emitted artifact in ep_harness.py, and adds a focused unit test file exercising the staging contract with a stub backend.
Security risks
None. This is measurement-only benchmarking code inside experimental/CollectiveX; it does not touch auth, crypto, permissions, or any production inference path. No user input or network-facing surface is affected.
Level of scrutiny
Low-to-moderate. The change is scoped to an experimental benchmarking harness that gates nothing downstream, but the logic (precisely when the new fast path is safe to take) is subtle enough that it warranted a careful read of each adapter (ep_deepep_v2.py, ep_uccl.py, ep_nccl.py, ep_mori.py) rather than a rubber-stamp.
Other factors
The one finding surfaced (MoRI BF16 intra-node incorrectly taking the new native-staging fast path because MoRI defines stage_device_work = self._fp8 or not self._external_input, not self._fp8 alone) is real — I independently confirmed MoRI's stage() does a genuine device buffer copy in that branch, verified deepep-v2/uccl do satisfy the assumed stage_device_work => fp8 premise, and confirmed it only shifts the BF16 control baseline for MoRI's intra-node case without affecting the FP8-vs-FP8 or dispatch/combine measurements. Given it's flagged as a Nit in non-production measurement code with a clear, narrow fix available, it does not rise to a blocking concern.
…ice_work Review catch: `stage_device_work` does not imply FP8. deepep-v2 and uccl set it to `self._fp8`, but MoRI sets `self._fp8 or not self._external_input`, so its scale-up kernels (IntraNode/IntraNodeLL) report True for BF16 as well -- and MoRI's BF16 stage() is not a no-op there, it copies into the registered combine-input buffer (`buffer[:rows, :].copy_(...)`, ep_mori.py:271-277). Gating the new fast path on `stage_device_work` alone therefore lifted that copy out of the BF16 timed region for every MoRI scale-up case, which is precision-asymmetric in exactly the way this change exists to remove, and falsifies the claim that BF16 is unmoved. Gate on `precision == "fp8"` as well, via a named `stages_fp8_natively` property so the condition is testable without a GPU. deepep-v2 and uccl are unaffected (the two conditions coincide there), so the b200 validation numbers still stand. Whether MoRI's registered-buffer copy is a production cost or a harness artefact is a real open question -- a native integration may have the expert GEMM write straight into that buffer -- but it applies to both precisions equally, needs its own evidence, and does not belong in an FP8 change.
- Image rocm/atom-dev:nightly_202609211553 (ATOM 0.1.7.dev517+g52a6a96fd) -> nightly_202610181506 (ATOM 0.1.8.dev77+gdf86c4829); the atomesh router container_image digest moves from f00a9dc5 (nightly_202609161445) to 1bb1909a, the same nightly as the workers. - Settings follow the GLM-5.2 recipe in ROCm/ATOM PR 2632 (open; recipe document only, measured on df86c4829). - Add TP4 C1 (TP4 now C1-C10) and restore the TP4+DCP4 arm at C16-C48 with the LMCache DRAM tier (0.5.6.dev139+gf22dec28), which #3463 dropped with the other search-space entries without an srt-recipe; TP8 C1-C4 unchanged. - dram-utilization 0.171 -> 0.74, so TOTAL_CPU_DRAM_GB is 1109 GB per TP4 server, covering the 4 x 256 GiB LMCache tier. - TP4 C1 and C2 run GLM-5.2 mono decode (ATOM_MONO_ENABLE=1) at 3 draft tokens (golden AL 2.99), max-num-seqs equal to the concurrency, graphs [1] and [1,2]; C2 was 5 draft tokens, max-num-seqs 4, graphs [1,2,4]. - Every other point sets ATOM_MONO_ENABLE=0, which the new ATOM defaults on; TP4 C4/C8 (5 drafts, AL 3.61), C10 (4, AL 3.33) and TP8 keep their settings. - DCP4 points: decode-context-parallel-size 4, ATOM_DCP_PREFILL_QREP=1, LMCache 256 GiB per rank via extra-kv-connectors lmcache_offload, 2x admission, 4 draft tokens (AL 3.33), 3 at C48 (AL 2.99). - Relevant ATOM changes: GLM-5.2 mono decode (#2479, #2483, #2535); DCP prefill QREP and QREP with MTP (#2437, #2290); DCP prefill fixes with MTP (#2430, #2496, #2506, #2348); MTP verify/draft-graph fixes (#2451, #2367, #2566, #2495); lmcache_offload fixes (#2305, #2339, #2547) and the LMCache pin (#2438). - Draft data types unchanged: the BF16 MTP layer 78 stays BF16 (excluded from ptpc_fp8 by model.layers.78.*), with the target's FP8 KV and FP4 indexer cache; mono decode covers only target layers 0-77. - 镜像 rocm/atom-dev:nightly_202609211553(ATOM 0.1.7.dev517+g52a6a96fd)-> nightly_202610181506(ATOM 0.1.8.dev77+gdf86c4829);atomesh router 的 container_image digest 从 f00a9dc5(nightly_202609161445)改为 1bb1909a,与 worker 使用同一 nightly。 - 设置与 ROCm/ATOM PR 2632 中的 GLM-5.2 recipe 一致(该 PR 尚未合并,只改 recipe 文档,测量基于 df86c4829)。 - 新增 TP4 C1(TP4 覆盖 C1-C10),并恢复带 LMCache DRAM 层(0.5.6.dev139+gf22dec28)的 TP4+DCP4 C16-C48 分支;该分支曾在 #3463 中随其他没有 srt-recipe 的搜索空间条目一起被删除。TP8 C1-C4 不变。 - dram-utilization 0.171 -> 0.74,每个 TP4 服务的 TOTAL_CPU_DRAM_GB 为 1109 GB,可容纳 4 x 256 GiB 的 LMCache 层。 - TP4 C1 和 C2 以 3 个 draft token(golden AL 2.99)运行 GLM-5.2 mono decode(ATOM_MONO_ENABLE=1),max-num-seqs 等于并发数,graph 为 [1] 和 [1,2];C2 原为 5 个 draft token、max-num-seqs 4、graph [1,2,4]。 - 其他点位都设置 ATOM_MONO_ENABLE=0(新 ATOM 默认开启);TP4 C4/C8(5 个 draft,AL 3.61)、C10(4 个,AL 3.33)和 TP8 设置不变。 - DCP4 点位:decode-context-parallel-size 4,ATOM_DCP_PREFILL_QREP=1,通过 extra-kv-connectors lmcache_offload 每个 rank 使用 256 GiB LMCache,准入为 2 倍并发,4 个 draft token(AL 3.33),C48 为 3 个(AL 2.99)。 - 相关 ATOM 改动:GLM-5.2 mono decode(#2479、#2483、#2535);DCP prefill QREP 及 QREP 与 MTP 同时使用(#2437、#2290);DCP prefill 与 MTP 的修复(#2430、#2496、#2506、#2348);MTP verify/draft graph 修复(#2451、#2367、#2566、#2495);lmcache_offload 修复(#2305、#2339、#2547)和 LMCache 版本固定(#2438)。 - Draft 数据类型不变:BF16 的 MTP 第 78 层保持 BF16(被 model.layers.78.* 排除在 ptpc_fp8 之外),与 target 共用 FP8 KV cache 和 FP4 indexer cache;mono decode 只覆盖 target 第 0-77 层。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…181506 / feat(agentx):基于 nightly_202610181506 重新调优 GLM-5.2 FP4 MI355X ATOM recipe (#4308) * feat(agentx): retune GLM5.2 FP4 MI355X ATOM recipe on _1018 docker Track the GLM-5.2 standalone recipe of ROCm/ATOM PR 2632 on rocm/atom-dev:nightly_202610181506. - TP4 C1/C2 run the GLM-5.2 mono decode at 3 draft tokens (AL 2.99); every other point sets ATOM_MONO_ENABLE=0, which ATOM defaults on. - C1 joins the TP4 arm; C4/C8 stay at MTP5 and C10 at MTP4. - Restore the TP4+DCP4 arm at C16-C48 with ATOM_DCP_PREFILL_QREP=1 and the LMCache DRAM tier at 256 GiB per rank via extra-kv-connectors (MTP4, MTP3 at C48). - dram-utilization 0.171 -> 0.74 so TOTAL_CPU_DRAM_GB (1109 GB) covers the 4 x 256 GiB = 1099.5 GB LMCache tier. 中文:按 ROCm/ATOM PR 2632 的 GLM-5.2 单机配方更新 MI355X ATOM AgentX 配置,镜像换为 rocm/atom-dev:nightly_202610181506。TP4 C1/C2 使用 GLM-5.2 mono decode,3 个 draft token(AL 2.99),其余点显式设置 ATOM_MONO_ENABLE=0(ATOM 默认开启);TP4 新增 C1,C4/C8 保持 MTP5, C10 保持 MTP4。恢复 TP4+DCP4 臂(C16-C48),开启 ATOM_DCP_PREFILL_QREP=1,并通过 extra-kv-connectors 接入每 rank 256 GiB 的 LMCache DRAM 层(MTP4,C48 为 MTP3)。dram-utilization 由 0.171 调为 0.74,使 TOTAL_CPU_DRAM_GB(1109 GB)覆盖 4 x 256 GiB = 1099.5 GB 的 LMCache 层。 Signed-off-by: zhuyuhua-v <[email protected]> * feat(agentx): cap GLM5.2 FP4 MI355X ATOM TP4 C1/C2 at max-num-seqs CONC Track ROCm/ATOM PR 2632: TP4 C1 and C2 start the server with max-num-seqs 1 and 2 (exactly CONC) and capture graphs only up to it. * docs(changelog): rewrite GLM-5.2 FP4 MI355X ATOM block from the diff - Image rocm/atom-dev:nightly_202609211553 (ATOM 0.1.7.dev517+g52a6a96fd) -> nightly_202610181506 (ATOM 0.1.8.dev77+gdf86c4829); the atomesh router container_image digest moves from f00a9dc5 (nightly_202609161445) to 1bb1909a, the same nightly as the workers. - Settings follow the GLM-5.2 recipe in ROCm/ATOM PR 2632 (open; recipe document only, measured on df86c4829). - Add TP4 C1 (TP4 now C1-C10) and restore the TP4+DCP4 arm at C16-C48 with the LMCache DRAM tier (0.5.6.dev139+gf22dec28), which #3463 dropped with the other search-space entries without an srt-recipe; TP8 C1-C4 unchanged. - dram-utilization 0.171 -> 0.74, so TOTAL_CPU_DRAM_GB is 1109 GB per TP4 server, covering the 4 x 256 GiB LMCache tier. - TP4 C1 and C2 run GLM-5.2 mono decode (ATOM_MONO_ENABLE=1) at 3 draft tokens (golden AL 2.99), max-num-seqs equal to the concurrency, graphs [1] and [1,2]; C2 was 5 draft tokens, max-num-seqs 4, graphs [1,2,4]. - Every other point sets ATOM_MONO_ENABLE=0, which the new ATOM defaults on; TP4 C4/C8 (5 drafts, AL 3.61), C10 (4, AL 3.33) and TP8 keep their settings. - DCP4 points: decode-context-parallel-size 4, ATOM_DCP_PREFILL_QREP=1, LMCache 256 GiB per rank via extra-kv-connectors lmcache_offload, 2x admission, 4 draft tokens (AL 3.33), 3 at C48 (AL 2.99). - Relevant ATOM changes: GLM-5.2 mono decode (#2479, #2483, #2535); DCP prefill QREP and QREP with MTP (#2437, #2290); DCP prefill fixes with MTP (#2430, #2496, #2506, #2348); MTP verify/draft-graph fixes (#2451, #2367, #2566, #2495); lmcache_offload fixes (#2305, #2339, #2547) and the LMCache pin (#2438). - Draft data types unchanged: the BF16 MTP layer 78 stays BF16 (excluded from ptpc_fp8 by model.layers.78.*), with the target's FP8 KV and FP4 indexer cache; mono decode covers only target layers 0-77. - 镜像 rocm/atom-dev:nightly_202609211553(ATOM 0.1.7.dev517+g52a6a96fd)-> nightly_202610181506(ATOM 0.1.8.dev77+gdf86c4829);atomesh router 的 container_image digest 从 f00a9dc5(nightly_202609161445)改为 1bb1909a,与 worker 使用同一 nightly。 - 设置与 ROCm/ATOM PR 2632 中的 GLM-5.2 recipe 一致(该 PR 尚未合并,只改 recipe 文档,测量基于 df86c4829)。 - 新增 TP4 C1(TP4 覆盖 C1-C10),并恢复带 LMCache DRAM 层(0.5.6.dev139+gf22dec28)的 TP4+DCP4 C16-C48 分支;该分支曾在 #3463 中随其他没有 srt-recipe 的搜索空间条目一起被删除。TP8 C1-C4 不变。 - dram-utilization 0.171 -> 0.74,每个 TP4 服务的 TOTAL_CPU_DRAM_GB 为 1109 GB,可容纳 4 x 256 GiB 的 LMCache 层。 - TP4 C1 和 C2 以 3 个 draft token(golden AL 2.99)运行 GLM-5.2 mono decode(ATOM_MONO_ENABLE=1),max-num-seqs 等于并发数,graph 为 [1] 和 [1,2];C2 原为 5 个 draft token、max-num-seqs 4、graph [1,2,4]。 - 其他点位都设置 ATOM_MONO_ENABLE=0(新 ATOM 默认开启);TP4 C4/C8(5 个 draft,AL 3.61)、C10(4 个,AL 3.33)和 TP8 设置不变。 - DCP4 点位:decode-context-parallel-size 4,ATOM_DCP_PREFILL_QREP=1,通过 extra-kv-connectors lmcache_offload 每个 rank 使用 256 GiB LMCache,准入为 2 倍并发,4 个 draft token(AL 3.33),C48 为 3 个(AL 2.99)。 - 相关 ATOM 改动:GLM-5.2 mono decode(#2479、#2483、#2535);DCP prefill QREP 及 QREP 与 MTP 同时使用(#2437、#2290);DCP prefill 与 MTP 的修复(#2430、#2496、#2506、#2348);MTP verify/draft graph 修复(#2451、#2367、#2566、#2495);lmcache_offload 修复(#2305、#2339、#2547)和 LMCache 版本固定(#2438)。 - Draft 数据类型不变:BF16 的 MTP 第 78 层保持 BF16(被 model.layers.78.* 排除在 ptpc_fp8 之外),与 target 共用 FP8 KV cache 和 FP4 indexer cache;mono decode 只覆盖 target 第 0-77 层。 Co-Authored-By: Claude Opus 5.5 <[email protected]> * eval(agentx): cover GLM-5.2 mono decode with a TP4 C2 GSM8K The default agentic selector evals only the highest concurrency, DCP4 C48, where ATOM_MONO_ENABLE is 0. TP4 C1/C2 are the points that turn the new mono-decode kernel on, so add an evals-only key whose highest point is C2. Co-authored-by: Cursor <[email protected]> --------- Signed-off-by: zhuyuhua-v <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: seungrokj <[email protected]> Co-authored-by: seungrokj <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
CollectiveX's chained
roundtripcalledstageinline, andstage— the conversion of the dispatched FP8 back to BF16 for combine — exists only for FP8 (stage_device_work = self._fp8). FP8 and BF16 were therefore timed through structurally different pipelines, on precisely the axis the comparison exists to measure.dispatchandcombinewere never affected: they runstageinsidetime_us's untimedpre. Only the chained roundtrip mixed it in.Why
nativeis the right defaultProduction FP8 MoE has no such pass:
token_dispatcher/deepep.py) contains no dequant at all. It pre-quantises withsglang_per_token_group_quant_fp8(hidden, 128, ...)in DeepGEMM scale format, dispatches FP8 + scales, and hands both straight to DeepGEMM.prepare_finalize/deepep_ll.py) dequantises only as a quant-format mismatch fallback. Whenblock_k == DEEPEP_QUANT_BLOCK_SIZEit returns the dispatched FP8 + scales untouched — "DeepEP kernels did the quantization for us". Otherwise it materialises the full padded[experts, max_tokens, hidden]tensor to fp32 and re-quantises.The deepseek-v3 block-128 FP8 workload this suite runs takes the matched branch, so the dequant was modelling a path this workload never executes.
Change
EPBackend.fp8_consume=native(default) |dequant, selectable withCX_FP8_CONSUME.benchmark_roundtripmaterialises the combine input once, untimed in native mode;run_roundtrip(problem, staged=None)installs it via the newcombine_input_attr(NCCL EP names its tensorcombine_input_t).dequantis retained as a verification hatch, not a second metric — it costs nothing (BF16 needs the samestaged is Nonebranch) and reproduces historical numbers for regression checks. It is not a sweep axis, because the mismatch cost is derivable from fields every run already emits:dequant roundtrip ≈ roundtrip + stage(+2.4% .. −0.1%). The reverse does not hold — reconstructing native asdequant − stageerrs by −11.6% at T=1, worst exactly in the decode regime the headline reports.implementation.fp8_consume.tests/test_roundtrip_staging.pypins both paths, the adapter attribute contract, and the default.Validation — b200 deepep-v2 low-latency, one node, three runs
The verdict inverts. The old chain said FP8 was 4.7× slower than BF16 at T=1; FP8 is in fact faster, by a margin that grows 3.8% → 17.5% with tokens. Growth with payload is the signature of a bandwidth saving; the old flat ≈ −240 µs penalty was the signature of a fixed conversion pass. The hatch reproduces the historical number (302.0 vs 302.5), and BF16 is unmoved (63.7 → 153.4 vs 64.8 → 153.9 before the change,
stage0.0 throughout).Latency now agrees with
byte_provenanceinstead of contradicting it: at T=256, dispatch is 68.1 FP8 vs 84.9 BF16 for half the bytes, while combine is 75.8 vs 78.8 because both send BF16 on the wire.Across the existing corpus this flips the FP8-vs-BF16 verdict in 39 of 51 comparisons; measured transport-only (
dispatch + combine, identical treatment for both precisions) at the headline rungs, FP8 is faster in 40 of 51, topping out at +30.2%.Scope / risk
Measurement-only, inside
experimental/CollectiveX, which gates nothing. Existing FP8 artifacts remain readable and are distinguishable by the absence ofimplementation.fp8_consume. Test suite green (58 tests, 6 skipped).BF16 is unmoved, and that is enforced by the gate rather than assumed. The first revision of this PR gated the fast path on
stage_device_workalone, on the premise that it implies FP8. That holds for deepep-v2 and uccl (self.stage_device_work = self._fp8) but not for MoRI, which usesself._fp8 or not self._external_input— so its scale-up kernels reportTrueat BF16, and theirstage()really does copy into the registered combine-input buffer (ep_mori.py:271-277). That would have lifted a real BF16 device copy out of the timed region for every MoRI scale-up case: precision-asymmetric in exactly the way this PR exists to remove. Caught in review, fixed in 956b9c7 by gating onprecision == "fp8"through a namedstages_fp8_nativelyproperty, with three regression tests pinning it. deepep-v2 and uccl are unaffected — the two conditions coincide there — so the b200 numbers above still stand.Deliberately out of scope: whether MoRI's registered-buffer copy is a production cost or a harness artefact. A native integration may have the expert GEMM write straight into that buffer, but the question applies to both precisions equally and needs its own evidence, so BF16 keeps paying it inline here.