Google Cloud TPU & vLLM Architecture Analysis

Qwen 3.5 397B-A17B 推理张量流动图 Qwen 3.5 397B-A17B Inference Tensor Dataflow

展示 Qwen 3.5 在单层 Transformer Block 内的完整张量流动生命周期,包含 GQA (3:1)QK-Norm (Qwen 原创特色)★★★ KV Cache 显存物理驻留点 ★★★ 以及 MoE (共享专家 + 512 细粒度路由专家)。精确映射 Xprof Trace 中的 fusion.243 (QKV GEMM) 算子。
⚠ 部署形态:Prefill 节点 PCP=8 + EP=8(8 芯片),Decode 节点 TP=2 × DP=4 + EP=8(8 芯片),一对 PD 共 16 芯片。PCP / TP / EP 是同一组 8 芯片上的不同切分轴,不相乘。两阶段的张量形状与显存数字仍需分开读。
The full tensor lifecycle inside one Qwen 3.5 Transformer block: GQA (3:1), QK-Norm (a Qwen signature), the ★★★ physical KV-cache residency point ★★★, and MoE (shared expert + 512 fine-grained routed experts) — mapped onto the fusion.243 (QKV GEMM) operator from an Xprof trace.
⚠ Deployed topology: prefill node PCP=8 + EP=8 (8 chips), decode node TP=2 × DP=4 + EP=8 (8 chips), 16 chips per PD pair. PCP / TP / EP are different partitioning axes over the same 8 chips — they do not multiply. Shapes and memory figures still have to be read per-phase.

模型规格Model
Qwen3.5-397B-A17B
硬件平台Hardware
TPU v7 Ironwood
Prefill 节点 (8 芯片)Prefill node (8 chips)
PCP=8 + EP=8
Decode 节点 (8 芯片)Decode node (8 chips)
TP=2 × DP=4 + EP=8
MoE 拓扑 (两阶段一致)MoE topology (both phases)
EP=8 (64 experts/chip)
注意力架构 (混合)Attention (hybrid)
15 层 GQA + 45 层 GDN15 GQA + 45 GDN
Trace 核心算子Trace hot op
fusion.243 (50.00 µs)
🎬 128K Token 生命周期动态流向仿真(端到端实测 4.62 s · 显微级放慢观察) 128K token lifecycle simulator (measured end-to-end 4.62 s, replayed in slow motion)
TPU v7 动态时序引擎就绪 TPU v7 timing engine ready
实测基准: 4.62 秒(128K prefill · 8 芯片切片 Measured baseline: 4.62 s (128K prefill on an 8-chip slice)
⚠ 标定基线:8 芯片 prefill 节点 · 60 层混合架构 ⚠ Calibration baseline: 8-chip prefill node, 60-layer hybrid build
时间轴回放的是 bodaborg-tpu7x-nap8 芯片 prefill 节点(PCP=8 + EP=8)· 60 层混合架构(45 GDN + 15 GQA) 那次压测,端到端 4.62 s。 这就是本文档的主口径 —— 联合优化文档记录的上线部署形态即为「1 Prefill node (8 chips, PCP8+EP8) → 1 Decode node (8 chips),一对共 16 芯片」, PCP / TP / EP 是同一组 8 芯片上的不同切分轴,不相乘,不存在 64 芯片实例。 4.62 s 的对照组是同样 8 芯片上的 DP8(128K 单请求 TTFT 32 s),因此 6.9× 是「同硬件下 DP → PCP 的收益」,不是扩容到更多芯片的超线性加速。 This timeline replays one stress run on bodaborg-tpu7x-nap: an 8-chip prefill node (PCP=8 + EP=8) running a 60-layer hybrid build (45 GDN + 15 GQA), 4.62 s end to end. This is the document's main configuration — the joint-optimization record describes the deployed form as "1 prefill node (8 chips, PCP8+EP8) → 1 decode node (8 chips), 16 chips per pair". PCP / TP / EP are different partitioning axes over the same 8 chips and do not multiply; there is no 64-chip instance. The 4.62 s baseline is DP8 on the very same 8 chips (128K single-request TTFT 32 s), so the 6.9× is "DP → PCP on identical hardware", not superlinear scaling to more chips.
时间线缩放:Timeline scale:
物理时间: Physical time: 0.000 s / 4.620 s
回放耗时: Playback elapsed: 0.0 s / 46.2 s
当前阶段: Current stage:
STAGE 1
① 128K 批次切分① 128K chunking
0 ~ 0.40 s
STAGE 2
② GDN 线性状态② GDN linear state
0.40 ~ 1.25 s
STAGE 3
③ PCP8 环形注意力③ PCP8 ring attention
1.25 ~ 3.10 s
STAGE 4
④ MoE 动态路由④ MoE routing
3.10 ~ 4.10 s
STAGE 5
⑤ MTP 投机推测⑤ MTP speculation
4.10 ~ 4.48 s
STAGE 6
⑥ DCN 跨切片直传⑥ DCN handoff
4.48 ~ 4.62 s
🖥️ 活跃执行硬件核🖥️ Active compute unit
⚡ 片间通信 / 路由引擎⚡ Interconnect / routing
📊 张量维度与内存流向📊 Tensor shape & memory path
🚀 当前阶段特化优化🚀 Optimization in play
📌 Qwen 3.5 单层推理数据流动图 (Mermaid · Prefill 视角,8 路头切分 + 8 路序列切分(形状取自 trace)) Single-layer dataflow (Mermaid · prefill view: 8-way head split + 8-way sequence split, shapes taken from the trace)
⚠ 本图是 Prefill 视角,Decode (TP=2 × DP=4) 有五处不同;切分轴的口径存疑说明见「Xprof 算子深度映射」页 ⚠ Prefill view; decode (TP=2 × DP=4) differs in five places. See the Xprof deep-dive tab for the open question about which axes these shapes reflect

① 每卡 Q 头 12 → 48,KV 头 4 → 16(TP=2);
fusion.243 的输出列 2560 → 10240,o_proj 为 6144 → 4096
③ Attn 后的 All-Reduce 域从 8 卡缩为 2 卡;4 个 DP 副本各处理不同请求,互不通信;
PCP 消失:decode 时 T=1,序列维无可切分,因此没有 ring/all-gather,每卡持有完整序列的 KV;
⑤ 注意力是 DP=4 而 MoE 是 EP=8,进出 MoE 需要一次 DP↔EP 的 All-to-All 重排
⑥ PD 交接:KV 要从 prefill 8 卡的布局重排为 decode 8 卡上的 (16 头, 全序列) —— 跨节点搬运且需重分布,是 PD 分离的主要固有开销(#554 / #582)。本图未画。
① Q heads per chip 12 → 48, KV heads 4 → 16 (TP=2);
fusion.243 output columns 2560 → 10240, o_proj becomes 6144 → 4096;
③ the post-attention All-Reduce domain shrinks from 8 chips to 2; the 4 DP replicas serve different requests and never talk;
PCP disappears: at decode T=1, so there is nothing to split along the sequence — no ring/all-gather, and each chip holds the full-length KV;
⑤ attention is DP=4 while MoE is EP=8, so entering and leaving the MoE needs a DP↔EP All-to-All reshuffle.
⑥ PD handoff: KV is reshaped from the prefill layout on 8 chips into (16 heads, full S) on the 8 decode chips — a cross-node move plus a redistribution, and the dominant intrinsic cost of PD disaggregation (#554 / #582). Not drawn here.

归一化 Norm (Pre-Norm / QK-Norm)Normalization (Pre-Norm / QK-Norm)
密集矩阵乘 GEMM / MXU 算子Dense GEMM / MXU op
★★★ KV Cache 显存物理驻留点 ★★★★★★ Physical KV cache residency ★★★
MoE 混合专家模块 (Shared + Routed)MoE block (shared + routed)
跨卡通信 (All-Reduce / All-to-All / Ring)Cross-chip collective (All-Reduce / All-to-All / Ring)
flowchart TD In["输入残差流: [B, T, 4096]"] In --> Attn_Norm["① Pre-Attn RMSNorm (attn_norm)"] In ----> Res_Add1{"⊕ 残差相加 1"} Attn_Norm --> QKV_GEMM["★ fusion.243 (QKV 融合投影)
[T/8=4096, 4096] × [4096, 2560]
trace 为 TP=8 变体列切 · M 为本地 token (50.00 µs)"] QKV_GEMM --> QKV_Tensor["[B, T/8, 2560] (单卡分片)"] QKV_Tensor -->|"slice.7534 (切前 1536 列)"| Q_Tensor["Q: [B, T/8, 12, 128]"] QKV_Tensor -->|"切后 1024 列 (前 512)"| K_Tensor["K: [B, T/8, 4, 128]"] QKV_Tensor -->|"切后 1024 列 (后 512)"| V_Tensor["V: [B, T/8, 4, 128]"] Q_Tensor --> Q_Norm["② Q-RMSNorm (Qwen 特色)"] K_Tensor --> K_Norm["③ K-RMSNorm (Qwen 特色)"] Q_Norm --> Q_RoPE["Q-RoPE 旋转位置编码"] K_Norm --> K_RoPE["K-RoPE 旋转位置编码"] K_RoPE --> KV_Cache["★★★ KV Cache 物理驻留点 ★★★
Prefill: 单卡 4 头 × 全序列, 等体积于 32 头 × S/8
Decode: [B, S, 16, 128] × 2
(单卡 0.47 GiB @32K fp8 · 15 层 FA)"] V_Tensor --> KV_Cache KV_Cache --> CP_Ring["PCP=8 Ring / All-Gather KV
(仅 Prefill: 每 rank 只有 S/8 个 token)"] Q_RoPE --> GQA_Op{"GQA 注意力计算 (Flash/Splash)
12 个 Q 头 共享 4 组 KV (3:1)
Softmax(Q·K^T / √128) · V"} CP_Ring -->|"补齐全序列 Key/Value"| GQA_Op GQA_Op --> Attn_Out["注意力输出: [B, T/8, 12, 128]"] Attn_Out --> O_Proj["Out Proj 线性层: 1536 → 4096"] O_Proj --> Attn_AllReduce["跨 8 卡 All-Reduce 通信求和
(Decode 时缩为 TP=2, 2 卡)"] Attn_AllReduce --> Res_Add1 Res_Add1 --> Res_Tensor1["Attn 输出残差流: [B, T, 4096]"] Res_Tensor1 --> FFN_Norm["④ Post-Attn RMSNorm (ffn_norm)"] Res_Tensor1 ----> Res_Add2{"⊕ 残差相加 2"} FFN_Norm --> Shared_Exp["Qwen 共享专家 (Shared Expert)
4096 → 5632 → 4096 (SwiGLU)"] FFN_Norm --> Router["Router 门控网络
GEMM 4096 → 512 (选 Top-8)"] Router --> MoE_Dispatch["EP=8 Token 分发 (All-to-All)
每卡常驻 64 个专家"] MoE_Dispatch --> Routed_Exps["Top-8 细粒度路由专家
4096 → 1408 → 4096 (SwiGLU)"] Routed_Exps --> MoE_Combine["加权求和 & All-to-All 回传"] Shared_Exp --> MoE_Sum{"专家输出合并"} MoE_Combine --> MoE_Sum MoE_Sum --> Res_Add2 Res_Add2 --> Final_Out["层输出残差流: [B, T, 4096]"] style Attn_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style Q_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style K_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style FFN_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style QKV_GEMM fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style O_Proj fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style KV_Cache fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style GQA_Op fill:#e0e7ff,stroke:#4338ca,stroke-width:2px,color:#312e81 style Shared_Exp fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Router fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Routed_Exps fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style CP_Ring fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Attn_AllReduce fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Dispatch fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Combine fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b
flowchart TD In["Input residual stream: [B, T, 4096]"] In --> Attn_Norm["① Pre-Attn RMSNorm (attn_norm)"] In ----> Res_Add1{"⊕ Residual Add 1"} Attn_Norm --> QKV_GEMM["★ fusion.243 (fused QKV projection)
[T/8=4096, 4096] × [4096, 2560]
TP=8-variant column split · M is chip-local (50.00 µs)"] QKV_GEMM --> QKV_Tensor["[B, T/8, 2560] (per-chip shard)"] QKV_Tensor -->|"slice.7534 (first 1536 cols)"| Q_Tensor["Q: [B, T/8, 12, 128]"] QKV_Tensor -->|"next 1024 cols (first 512)"| K_Tensor["K: [B, T/8, 4, 128]"] QKV_Tensor -->|"next 1024 cols (last 512)"| V_Tensor["V: [B, T/8, 4, 128]"] Q_Tensor --> Q_Norm["② Q-RMSNorm (Qwen signature)"] K_Tensor --> K_Norm["③ K-RMSNorm (Qwen signature)"] Q_Norm --> Q_RoPE["Q-RoPE rotary embedding"] K_Norm --> K_RoPE["K-RoPE rotary embedding"] K_RoPE --> KV_Cache["★★★ Physical KV cache residency ★★★
Prefill: 4 heads × full S per chip, same volume as 32 heads × S/8
Decode: [B, S, 16, 128] × 2
(0.47 GiB/chip @32K fp8, 15 FA layers)"] V_Tensor --> KV_Cache KV_Cache --> CP_Ring["PCP=8 ring / all-gather of KV
(prefill only: each rank owns S/8 tokens)"] Q_RoPE --> GQA_Op{"GQA attention (Flash/Splash)
12 Q heads share 4 KV groups (3:1)
Softmax(Q·K^T / √128) · V"} CP_Ring -->|"complete the full-length Key/Value"| GQA_Op GQA_Op --> Attn_Out["Attention output: [B, T/8, 12, 128]"] Attn_Out --> O_Proj["Out projection: 1536 → 4096"] O_Proj --> Attn_AllReduce["All-Reduce sum across 8 chips
(shrinks to TP=2, 2 chips, at decode)"] Attn_AllReduce --> Res_Add1 Res_Add1 --> Res_Tensor1["Post-attention residual: [B, T, 4096]"] Res_Tensor1 --> FFN_Norm["④ Post-Attn RMSNorm (ffn_norm)"] Res_Tensor1 ----> Res_Add2{"⊕ Residual Add 2"} FFN_Norm --> Shared_Exp["Qwen shared expert
4096 → 5632 → 4096 (SwiGLU)"] FFN_Norm --> Router["Router gate network
GEMM 4096 → 512 (pick Top-8)"] Router --> MoE_Dispatch["EP=8 token dispatch (All-to-All)
64 experts resident per chip"] MoE_Dispatch --> Routed_Exps["Top-8 fine-grained routed experts
4096 → 1408 → 4096 (SwiGLU)"] Routed_Exps --> MoE_Combine["Weighted sum & All-to-All combine"] Shared_Exp --> MoE_Sum{"Merge expert outputs"} MoE_Combine --> MoE_Sum MoE_Sum --> Res_Add2 Res_Add2 --> Final_Out["Layer output residual: [B, T, 4096]"] style Attn_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style Q_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style K_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style FFN_Norm fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e style QKV_GEMM fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style O_Proj fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style KV_Cache fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style GQA_Op fill:#e0e7ff,stroke:#4338ca,stroke-width:2px,color:#312e81 style Shared_Exp fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Router fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Routed_Exps fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style CP_Ring fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Attn_AllReduce fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Dispatch fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Combine fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b
📌 Qwen 3.5 PD 分离推理架构全景张量流向图(Prefill ➔ DCN 直传 ➔ Decode 自回归) PD-disaggregated panorama (prefill ➔ DCN handoff ➔ autoregressive decode)
⚠ 本图的 µs / ms 标注来自 8 芯片 · 60 层混合架构那次压测 ⚠ The µs / ms annotations come from the 8-chip, 60-layer hybrid run
图中绝对耗时均取自 bodaborg-tpu7x-nap · 2×48 芯片 prefill 节点 · 45 GDN + 15 GQA 的压测。 引用前请先看数字溯源: ✓ 有联合优化文档背书 —— 128K 单请求 TTFT DP8 32 s → PCP8 4.62 s、decode 5,650 tok/s(TP2DP4 + owner_output 分支)、单网卡 P→D 峰值 > 12.5 GB/s(线速 25 GB/s,达标线为其 50%)、prefill 分层耗时 full 492 µs × 15 层 / linear 774 µs × 45 层 / MoE 1.41 ms × 60 层△ 自洽但属推算 —— 1.92 GB 可由 [131072, 15, 4, 128] FP8 × 2(K,V) 反算得到,是单卡份额(精确值 1.875 GiB;8 卡合计 15 GiB = 整请求 15 层 FA 的 KV),账对得上;但 450 ms → 138 ms(3.2×)是 1.92 GB 分别除以 4.2 / 13.6 GB/s 的算术结果,而文档只背书「峰值超过 12.5 GB/s」。按 12.5 GB/s 应为 ~154 ms✗ 与实测冲突 —— 22.45 → 11.20 ms/tok(2.0×):实测 TPOT 为 25.4 ~ 28.4 ms,MTP 在 coding 场景的典型加速比是 1.34× 而非 2.0×。 Absolute latencies come from a stress run on bodaborg-tpu7x-nap · 2×4: an 8-chip prefill node running 45 GDN + 15 GQA layers. Check provenance before quoting: ✓ Corroborated by the joint-optimization record — 128K single-request TTFT 32 s under DP8 → 4.62 s under PCP8, decode 5,650 tok/s (TP2DP4 on the owner_output branch), single-NIC P→D peak > 12.5 GB/s (line rate 25 GB/s; the target was 50% of it), per-layer prefill cost full 492 µs × 15 / linear 774 µs × 45 / MoE 1.41 ms × 60. △ Self-consistent but derived1.92 GB falls out of [131072, 15, 4, 128] FP8 × 2 (K,V) and is the per-chip share (exactly 1.875 GiB; 8 chips = 15 GiB, i.e. the whole request's KV over 15 FA layers), so the arithmetic checks out. But 450 ms → 138 ms (3.2×) is just 1.92 GB divided by 4.2 and 13.6 GB/s, whereas the record only backs "peak above 12.5 GB/s" — which would give ~154 ms. ✗ Contradicted by measurement22.45 → 11.20 ms/tok (2.0×): measured TPOT is 25.4–28.4 ms, and MTP's typical coding-workload speedup is 1.34×, not 2.0×.
密集计算算子 ⏱️ (Compute Bound)Dense compute op ⏱️ (compute bound)
跨卡通讯 ⚡ (ICI / DCN)Cross-chip collective ⚡ (ICI / DCN)
★ 专项工程优化点★ Targeted engineering optimization
★★★ KV Cache 物理驻留点 ★★★★★★ Physical KV residency ★★★
🌐 1P1D DCN 跨切片传输🌐 1P1D DCN inter-slice transfer
flowchart TD subgraph Prefill_Slice ["🟦 【Prefill 切片】1P 预填充节点 (PCP8 环形并行 · 128K 超长 Prompt)"] direction TB In["输入残差流: [B, 128K, 4096]"] In --> Attn_Norm["① Pre-Attn RMSNorm
⏱️ 312 µs"] In ----> Res_Add1{"⊕ 残差相加 1"} Attn_Norm --> GDN_Op["★【优化 1】GDN 线性注意力 (45 层)
🔗 vllm-torchtpu#766 / #1082 (QK 复制) / #873
📄 实测分层: linear 774 µs × 45 层
🔴 优化前 4.12 ms (反复写回 HBM)
🟢 优化后 0.84 ms (FP8 融合状态, 零写回)
🚀 4.9× · 维持 O(1) 状态"] Attn_Norm --> QKV_GEMM["fusion.243 (QKV 融合投影)
[16384, 4096] × [4096, 2560]
⏱️ 50.00 µs (MXU)"] QKV_GEMM --> QKV_Tensor["[B, T/8, 2560] (单卡分片)"] QKV_Tensor -->|"slice.7534 (前 1536 列)
⏱️ 3.25 µs"| Q_Tensor["Q: [B, T/8, 12, 128]"] QKV_Tensor -->|"后 1024 列 (前 512)"| K_Tensor["K: [B, T/8, 4, 128]"] QKV_Tensor -->|"后 1024 列 (后 512)"| V_Tensor["V: [B, T/8, 4, 128]"] Q_Tensor --> Q_Norm["② Q-RMSNorm & RoPE
⏱️ 85.00 µs"] K_Tensor --> K_Norm["③ K-RMSNorm & RoPE
⏱️ 85.00 µs"] K_Norm --> KV_Cache_Local["★★★【优化 2】SEQ_ON_LANE 物理驻留 ★★★
🔗 vllm-torchtpu#608 / #606 / #750 (HND)
KV Heads 维前置, 消除跨切片 Reshard 拷贝
📈 decode 吞吐 700 → 5,790 tok/s
📦 单卡载荷 1.92 GB = [131072, 15, 4, 128] FP8 ×2"] V_Tensor --> KV_Cache_Local subgraph Overlap_Box ["★【优化 3】PCP8 Ring Attention 双缓冲异步重叠 (PR #366 / #414 / #863)"] direction TB Q_Norm --> Ring_Compute["【计算流 · MXU】
FlashAttention 矩阵乘
⏱️ 实测 492 µs / 层 · 15 层合计 ≈ 7.4 ms
📄 实测分层: full 492 µs × 15 层
🔴 DP8 TTFT ~32.0 s → 🟢 PCP8 4.62 s (同 8 芯片)"] KV_Cache_Local -->|"双缓冲拉取"| Ring_Comm["【通信流 · ICI DMA】
环形传递下一个 16K KV Chunk
⚡ 950 µs
🟢 100% 藏在 4,120 µs 计算阴影下 (Bubble = 0)"] Ring_Compute -.->|"异步重叠遮蔽"| Ring_Comm end Ring_Compute --> Attn_Out["注意力输出: [B, T/8, 12, 128]"] Attn_Out --> O_Proj["Out Proj: 1536 → 4096"] O_Proj --> Attn_AllReduce["片内 All-Reduce (all-reduce.45)
⚡ Prefill 域 8 卡
(Decode 侧缩为 TP=2, ~85 µs)"] Attn_AllReduce --> Res_Add1 Res_Add1 --> Res_Tensor1["Attn 残差流: [B, 128K, 4096]"] Res_Tensor1 --> FFN_Norm["④ Post-Attn RMSNorm
⏱️ 312 µs"] Res_Tensor1 ----> Res_Add2{"⊕ 残差相加 2"} FFN_Norm --> Shared_Exp["共享专家 (Shared)
4096 → 5632 → 4096 (SwiGLU)"] FFN_Norm --> Router["Router 门控 (fusion.815)
4096 → 512, 选 Top-8
⏱️ 145 µs"] Router --> MoE_Dispatch["EP8 Token 分发 (all-to-all.18)
⚡ 954 µs"] MoE_Dispatch --> Routed_Exps["★【优化 4】owner_output 专家直聚
🔗 vllm-torchtpu#628
fusion.246 / 816 (Owner Core 原地聚合)
📈 decode 5,500 → 5,650 tok/s
🔴 3.10 ms → 🟢 2.14 ms (+31%)"] Routed_Exps --> MoE_Combine["EP8 专家汇聚 (all-to-all.19)
⚡ 961 µs"] MoE_Combine --> TP_MoE_Sync["TP MoE 输出规约 (all-reduce.46)
⚡ 88.0 µs"] Shared_Exp --> MoE_Sum{"专家输出合并"} TP_MoE_Sync --> MoE_Sum MoE_Sum --> Res_Add2 Res_Add2 --> Prefill_Out["Prefill 尾层隐状态
[B, 1, 4096] (首字 Logits 输入)"] end subgraph DCN_Transfer_Highway ["🌐 【PD 分离高速公路】1P ➔ 1D DCN 跨切片直传"] direction TB DCN_Op["★★ DCN KV Cache 网络直传 ★★
🔗 vllm-torchtpu#554 (PCP8>DP8 重排修复) & #582 (控制器)
• 介质: 单张 200 Gbps DCN 网卡 (线速 25 GB/s)
🟢 实测峰值 > 12.5 GB/s (达标线 = 线速 50%)
📦 单卡载荷 1.875 GiB (8 卡合计 15 GiB / 请求)
🔴 未重排 4.2 GB/s · ~450 ms → 🟢 ~138 ms (推算)
⚠ 13.6 GB/s 为推算值; 文档背书 >12.5 GB/s → ~154 ms
🚧 双网卡 (400 Gbps) 仍是阻塞项
b/558565285 · Multi-NIC C=1 问题排查中"] end KV_Cache_Local ==>|"① Prefill 完结: 导出完整 KV"| DCN_Op Prefill_Out ==>|"② 传递首字隐状态与元数据"| Decode_Input subgraph Decode_Slice ["🟩 【Decode 切片】1D 解码节点 (TP2 × DP4 × EP8 · 高并发流式吐字)"] direction TB Decode_Input["Decode 接收端: 首字输入 [B, 1, 4096]"] Decode_KV_Resident["★★★ Decode 端 KV Cache 就位 ★★★
全量 128K 历史注入 Decode HBM
后续每步仅追加 1 Token (O(1) 增量)"] Decode_Input --> Dec_Attn_Norm["Decode RMSNorm & QKV GEMM
单步 ~1.20 ms"] Decode_KV_Resident -.->|"自回归加载历史 KV"| Dec_Step_Attn Dec_Attn_Norm --> Dec_Step_Attn["Decode 单步注意力 (FlashDecode)
⏱️ 1,850 µs"] Dec_Step_Attn --> Dec_MoE["Decode EP8 MoE 门控与专家计算
⚡ 分发 620 µs + 汇聚 615 µs"] Dec_MoE --> LM_Head["LM Head 词表投影 (fusion.988)
vocab 248,320 · [4096, 248320]
⏱️ 1,820 µs + ⚡ all-reduce.88: 112 µs"] LM_Head --> MTP_Verify["★【优化 5】MTP 多 Token 投机验证
🔗 vllm-torchtpu#1008 (RPAd 路由, 已合入) & #559
fusion.990 (单步命中 2 Token)
🟢 实测 coding 场景加速比 1.34×
🚀 吞吐 5,650 tok/s (TP2DP4 + owner_output)
⚠ 22.45 → 11.20 ms/tok (2.0×) 与实测 TPOT 25~28 ms 冲突"] MTP_Verify --> Token_Emit["🎉 流式吐出 Token: [T+1, T+2]"] Token_Emit -.->|"自回归循环"| Decode_Input end DCN_Op ==>|"③ DCN 直传注入 Decode 显存 (> 12.5 GB/s)"| Decode_KV_Resident style Prefill_Slice fill:#0b132b,stroke:#3b82f6,stroke-width:2px,color:#93c5fd style Decode_Slice fill:#06231a,stroke:#10b981,stroke-width:2px,color:#6ee7b7 style DCN_Transfer_Highway fill:#231a06,stroke:#facc15,stroke-width:3px,color:#fef08a style DCN_Op fill:#422006,stroke:#eab308,stroke-width:3px,color:#fef08a style GDN_Op fill:#fff7ed,stroke:#ea580c,stroke-width:2px,color:#9a3412 style Ring_Compute fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Ring_Comm fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Overlap_Box fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#93c5fd style KV_Cache_Local fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style Decode_KV_Resident fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style Routed_Exps fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Attn_AllReduce fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style TP_MoE_Sync fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Dispatch fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Combine fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MTP_Verify fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Attn_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Q_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style K_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style FFN_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style QKV_GEMM fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style O_Proj fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Shared_Exp fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Router fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style LM_Head fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Prefill_Out fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#334155 style Decode_Input fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_Attn_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_Step_Attn fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_MoE fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Token_Emit fill:#f0fdf4,stroke:#16a34a,stroke-width:3px,color:#15803d
flowchart TD subgraph Prefill_Slice ["🟦 Prefill slice (1P) — PCP8 ring parallel, 128K prompt"] direction TB In["Input residual: [B, 128K, 4096]"] In --> Attn_Norm["① Pre-Attn RMSNorm
⏱️ 312 µs"] In ----> Res_Add1{"⊕ Residual add 1"} Attn_Norm --> GDN_Op["★ Opt 1: GDN linear attention (45 layers)
🔗 vllm-torchtpu#766 / #1082 (QK replication) / #873
📄 Measured per-layer: linear 774 µs × 45
🔴 before 4.12 ms (repeated HBM write-back)
🟢 after 0.84 ms (FP8 fused state, zero write-back)
🚀 4.9× · O(1) state retained"] Attn_Norm --> QKV_GEMM["fusion.243 (fused QKV projection)
[16384, 4096] × [4096, 2560]
⏱️ 50.00 µs (MXU)"] QKV_GEMM --> QKV_Tensor["[B, T/8, 2560] (per-chip shard)"] QKV_Tensor -->|"slice.7534 (first 1536 cols)
⏱️ 3.25 µs"| Q_Tensor["Q: [B, T/8, 12, 128]"] QKV_Tensor -->|"next 1024 cols (first 512)"| K_Tensor["K: [B, T/8, 4, 128]"] QKV_Tensor -->|"next 1024 cols (last 512)"| V_Tensor["V: [B, T/8, 4, 128]"] Q_Tensor --> Q_Norm["② Q-RMSNorm & RoPE
⏱️ 85.00 µs"] K_Tensor --> K_Norm["③ K-RMSNorm & RoPE
⏱️ 85.00 µs"] K_Norm --> KV_Cache_Local["★★★ Opt 2: SEQ_ON_LANE residency ★★★
🔗 vllm-torchtpu#608 / #606 / #750 (HND)
KV-head axis hoisted, kills cross-slice reshard copies
📈 decode throughput 700 → 5,790 tok/s
📦 Per-chip payload 1.92 GB = [131072, 15, 4, 128] FP8 ×2"] V_Tensor --> KV_Cache_Local subgraph Overlap_Box ["★ Opt 3: PCP8 ring attention, double-buffered async overlap (PR #366 / #414 / #863)"] direction TB Q_Norm --> Ring_Compute["Compute stream · MXU
FlashAttention matmul
⏱️ Measured 492 µs / layer · ≈7.4 ms for 15
📄 Measured per-layer: full 492 µs × 15
🔴 DP8 TTFT ~32.0 s → 🟢 PCP8 4.62 s (same 8 chips)"] KV_Cache_Local -->|"double-buffered prefetch"| Ring_Comm["Comm stream · ICI DMA
Ring-forward the next 16K KV chunk
⚡ 950 µs
🟢 100% hidden under 4,120 µs of compute (bubble = 0)"] Ring_Compute -.->|"async overlap"| Ring_Comm end Ring_Compute --> Attn_Out["Attention output: [B, T/8, 12, 128]"] Attn_Out --> O_Proj["Out projection: 1536 → 4096"] O_Proj --> Attn_AllReduce["Intra-slice All-Reduce (all-reduce.45)
⚡ 8-chip domain at prefill
(shrinks to TP=2, ~85 µs, at decode)"] Attn_AllReduce --> Res_Add1 Res_Add1 --> Res_Tensor1["Post-attention residual: [B, 128K, 4096]"] Res_Tensor1 --> FFN_Norm["④ Post-Attn RMSNorm
⏱️ 312 µs"] Res_Tensor1 ----> Res_Add2{"⊕ Residual add 2"} FFN_Norm --> Shared_Exp["Shared expert
4096 → 5632 → 4096 (SwiGLU)"] FFN_Norm --> Router["Router gate (fusion.815)
4096 → 512, pick Top-8
⏱️ 145 µs"] Router --> MoE_Dispatch["EP8 token dispatch (all-to-all.18)
⚡ 954 µs"] MoE_Dispatch --> Routed_Exps["★ Opt 4: owner_output direct gather
🔗 vllm-torchtpu#628
fusion.246 / 816 (in-place on the owner core)
📈 decode 5,500 → 5,650 tok/s
🔴 3.10 ms → 🟢 2.14 ms (+31%)"] Routed_Exps --> MoE_Combine["EP8 expert combine (all-to-all.19)
⚡ 961 µs"] MoE_Combine --> TP_MoE_Sync["TP MoE output reduce (all-reduce.46)
⚡ 88.0 µs"] Shared_Exp --> MoE_Sum{"Merge expert outputs"} TP_MoE_Sync --> MoE_Sum MoE_Sum --> Res_Add2 Res_Add2 --> Prefill_Out["Final-layer hidden state
[B, 1, 4096] (feeds first-token logits)"] end subgraph DCN_Transfer_Highway ["🌐 PD handoff highway — 1P ➔ 1D DCN direct transfer"] direction TB DCN_Op["★★ DCN KV cache direct transfer ★★
🔗 vllm-torchtpu#554 (PCP8>DP8 reshard fix) & #582 (controller)
• Medium: one 200 Gbps DCN NIC (25 GB/s line rate)
🟢 Measured peak > 12.5 GB/s (target = 50% of line rate)
📦 Per-chip payload 1.875 GiB (8 chips = 15 GiB/request)
🔴 Unlaid-out 4.2 GB/s · ~450 ms → 🟢 ~138 ms (derived)
⚠ 13.6 GB/s is derived; the record backs >12.5 GB/s → ~154 ms
🚧 Dual-NIC (400 Gbps) is still a blocker
b/558565285 · Multi-NIC C=1 issue under investigation"] end KV_Cache_Local ==>|"① prefill done: export the full KV"| DCN_Op Prefill_Out ==>|"② pass first-token hidden state + metadata"| Decode_Input subgraph Decode_Slice ["🟩 Decode slice (1D) — TP2 × DP4 × EP8, high-concurrency streaming"] direction TB Decode_Input["Decode ingress: first token [B, 1, 4096]"] Decode_KV_Resident["★★★ KV cache resident on decode side ★★★
Full 128K history injected into decode HBM
each later step appends just 1 token (O(1))"] Decode_Input --> Dec_Attn_Norm["Decode RMSNorm & QKV GEMM
~1.20 ms per step"] Decode_KV_Resident -.->|"autoregressively read history KV"| Dec_Step_Attn Dec_Attn_Norm --> Dec_Step_Attn["Single-step attention (FlashDecode)
⏱️ 1,850 µs"] Dec_Step_Attn --> Dec_MoE["Decode EP8 MoE gate + experts
⚡ dispatch 620 µs + combine 615 µs"] Dec_MoE --> LM_Head["LM head vocab projection (fusion.988)
vocab 248,320 · [4096, 248320]
⏱️ 1,820 µs + ⚡ all-reduce.88: 112 µs"] LM_Head --> MTP_Verify["★ Opt 5: MTP multi-token speculative verify
🔗 vllm-torchtpu#1008 (route via RPAd, merged) & #559
fusion.990 (2 tokens accepted per step)
🟢 Measured coding-workload speedup 1.34×
🚀 5,650 tok/s (TP2DP4 + owner_output)
⚠ 22.45 → 11.20 ms/tok (2.0×) conflicts with measured TPOT 25–28 ms"] MTP_Verify --> Token_Emit["🎉 Stream out tokens: [T+1, T+2]"] Token_Emit -.->|"autoregressive loop"| Decode_Input end DCN_Op ==>|"③ DCN direct-inject into decode HBM (> 12.5 GB/s)"| Decode_KV_Resident style Prefill_Slice fill:#0b132b,stroke:#3b82f6,stroke-width:2px,color:#93c5fd style Decode_Slice fill:#06231a,stroke:#10b981,stroke-width:2px,color:#6ee7b7 style DCN_Transfer_Highway fill:#231a06,stroke:#facc15,stroke-width:3px,color:#fef08a style DCN_Op fill:#422006,stroke:#eab308,stroke-width:3px,color:#fef08a style GDN_Op fill:#fff7ed,stroke:#ea580c,stroke-width:2px,color:#9a3412 style Ring_Compute fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Ring_Comm fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Overlap_Box fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#93c5fd style KV_Cache_Local fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style Decode_KV_Resident fill:#dcfce7,stroke:#16a34a,stroke-width:3px,color:#166534 style Routed_Exps fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Attn_AllReduce fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style TP_MoE_Sync fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Dispatch fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MoE_Combine fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style MTP_Verify fill:#fff7ed,stroke:#ea580c,stroke-width:3px,color:#9a3412 style Attn_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Q_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style K_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style FFN_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style QKV_GEMM fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style O_Proj fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Shared_Exp fill:#f3e8ff,stroke:#9333ea,stroke-width:2px,color:#6b21a8 style Router fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style LM_Head fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Prefill_Out fill:#f1f5f9,stroke:#64748b,stroke-width:2px,color:#334155 style Decode_Input fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_Attn_Norm fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_Step_Attn fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af style Dec_MoE fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b style Token_Emit fill:#f0fdf4,stroke:#16a34a,stroke-width:3px,color:#15803d
核心机制:Ring Attention 的跨卡通讯如何 100% 藏进计算? Core mechanism: how does ring attention hide 100% of its cross-chip traffic? Bubble = 0 µs

传统模式是「先算完再通信」或「先等数据到齐再开算」,计算单元会大量闲置等待,形成通信气泡(bubble)。 在 PCP8 Ring Attention 里,TPU 的 MXU 计算引擎ICI 片间互联 DMA 引擎在硬件层面完全解耦,配合双缓冲,计算与通信 100% 异步并发: The naive pattern is compute, then communicate — or wait for the data, then start computing — which leaves the compute units idle and opens a communication bubble. Under PCP8 ring attention the TPU's MXU compute engine and its ICI interconnect DMA engine are fully decoupled in hardware; combined with double buffering, compute and communication run 100% concurrently:

⏱️ 单个 Ring Step 的硬件并发时序(时间轴 0 ~ 4,120 µs) ⏱️ Hardware concurrency within one ring step (axis 0 ~ 4,120 µs)
【计算流 · MXU】FlashAttention 矩阵乘(处理第 k 块 KV) Compute stream · MXU — FlashAttention matmul on KV chunk k ⏱️ 4,120 µs
⚡ Q × Kᵀ & Softmax & V 矩阵乘(4,120 µs 满载) ⚡ Q × Kᵀ, softmax and ·V (4,120 µs at full load)
【通信流 · ICI DMA】后台环传下一块 KV(预取第 k+1 块) Comm stream · ICI DMA — ring-forward the next KV chunk (prefetch k+1) ⚡ 950 µs
ICI 950 µs
🟢 完全落在计算阴影内(3,170 µs 裕量) 🟢 Entirely inside the compute shadow (3,170 µs of slack)
【外部观察】端到端有效墙钟 External observation — effective wall clock ✅ 仅 4,120 µs✅ 4,120 µs only
端到端只感知到 4,120 µs 计算耗时(通信对总延迟贡献 = 0) End to end only 4,120 µs of compute is observable — communication contributes 0 to latency
① 双缓冲预取① Double-buffered prefetch
计算单元在处理第 k 块 KV 时,独立 DMA 引擎已经通过 ICI 把邻居的第 k+1 块推进片上 SRAM 备用。 While the compute unit chews on KV chunk k, an independent DMA engine has already pulled the neighbour's chunk k+1 over ICI into on-chip SRAM.
② 算力/通信比 4.34×② Compute-to-comm ratio of 4.34×
计算 4,120 µs 是通信 950 µs 的 4.34 倍,通信时间完整落在计算的时间阴影内,不产生阻塞。
⚠ 这里的 4,120 µs 与文档实测的 492 µs/层 不是同一口径(见「算子级优化与 Xprof 大盘」页校准说明 ①)。结论只依赖 4.34× 这个比值,不依赖绝对值。
4,120 µs of compute against 950 µs of transfer is a 4.34× margin, so the transfer fits entirely inside the compute shadow and never stalls anything.
⚠ This 4,120 µs is not the same figure as the record's measured 492 µs per layer (see calibration note ① on the operator-optimization tab). The conclusion rests on the 4.34× ratio, not on the absolute value.
③ DP8 → PCP8 提速 6.9×(同 8 芯片)③ 6.9× from DP8 → PCP8 (same 8 chips)
正因为通信被完全隐藏,同样 8 芯片下把序列切分开做才划算:128K 单请求 TTFT 从 DP8 的 ~32.0 s 降到 PCP8 的 4.62 s这是并行策略换取的收益,不是扩容带来的超线性加速 —— 两组数字跑在同一组 8 芯片上。 Because the transfers are fully hidden, splitting the sequence pays off on the very same 8 chips: 128K single-request TTFT drops from ~32.0 s under DP8 to 4.62 s under PCP8. That is a parallelism-strategy win, not superlinear scaling — both numbers ran on the same 8 chips.
🔬 Xprof Trace 算子微观剖析:fusion.243 到底在干什么? Xprof trace micro-analysis: what is fusion.243 actually doing?
📍 Trace 时间窗口:1389.979 ms ~ 1390.079 ms (整整 100.00 µs) 📍 Trace window: 1389.979 ms – 1390.079 ms (exactly 100.00 µs)

这段窗口完整切下了 Qwen 3.5 397B 进入 Attention 模块时的 QKV 融合投影流水线。三个算子合计约 71.06 µs,加上指令发射与对齐填满 100 µs。 The window captures one complete fused QKV projection pipeline as Qwen 3.5 397B enters its attention block. The three ops total ≈71.06 µs; issue and alignment overhead fill the remaining 100 µs.

1. 动态量化: clamp_convert_fusion.117 (17.81 µs) 1. Dynamic quantization: clamp_convert_fusion.117 (17.81 µs)

• 输入:bf16[4096, 4096](来自 Pre-RMSNorm 的激活)
• 输出:f8e4m3fn[4096, 4096]
• 逻辑:扫描激活绝对值极大值求 Scale,再把 BF16 压成 FP8 送入 MXU。占整个投影 ~25%
• Input: bf16[4096, 4096] (activations out of Pre-RMSNorm)
• Output: f8e4m3fn[4096, 4096]
• Logic: scan for the absolute max to derive a scale, then squeeze BF16 into FP8 for the MXU. About 25% of the whole projection.

2. 核心 GEMM 与反量化: fusion.243 (50.00 µs) 2. Core GEMM and dequantization: fusion.243 (50.00 µs)

• 算子:convolution.708(MXU 脉动阵列)
• 计算:[4096, 4096] × [4096, 2560] → f32[4096, 2560]
• 流水线反量化:片上连续两次广播乘(mul.14009 / mul.14007)乘以输入与权重 Scale,再 convertbf16
• Op: convolution.708 (MXU systolic array)
• Compute: [4096, 4096] × [4096, 2560] → f32[4096, 2560]
• Pipelined dequant: two back-to-back on-chip broadcast multiplies (mul.14009 / mul.14007) apply the input and weight scales, then convert back to bf16.

3. GQA 头部分解切片: slice.7534 (3.25 µs) 3. GQA head decomposition: slice.7534 (3.25 µs)

从单卡 bf16[4096, 2560] 中切分:
Query 分支slice.7534):前 [0:1536] 列 = 12 个 Q 头(12 × 128),送往 Q-RMSNorm;
Key & Value 分支copy-start.766):后 [1536:2560] 共 1024 列 = 4 个 K 头 + 4 个 V 头,送往 K-RMSNorm 并写入 ★★★ KV Cache ★★★
Splitting the per-chip bf16[4096, 2560]:
Query branch (slice.7534): columns [0:1536] = 12 Q heads (12 × 128), on to Q-RMSNorm;
Key & Value branch (copy-start.766): columns [1536:2560], 1024 wide = 4 K heads + 4 V heads, on to K-RMSNorm and then written to the ★★★ KV cache ★★★.

4. Roofline 校验:这两个算子跑得够快吗?(TPU v7 Ironwood) 4. Roofline check: are these two ops fast enough? (TPU v7 Ironwood)
算子工作量实测达成率结论
OperatorWorkMeasuredAttainmentVerdict
fusion.243 GEMM 2×4096×4096×2560 = 85.9 GFLOP
算术强度arithmetic intensity 1781 FLOP/byte
50.00 µs → 1.72 PFLOP/s 37.2% of 4614 TFLOPS (fp8) 理想 18.6 µs,慢 2.7× — 确认为真实低效 ideal 18.6 µs, 2.7× slower — a genuine inefficiency
clamp_convert_fusion.117 两遍:absmax 读 33.5 + convert 读 33.5 + 写 16.8 = 83.9 MB two passes: absmax read 33.5 + convert read 33.5 + write 16.8 = 83.9 MB 17.81 µs → 4.71 TB/s 64% of 7.37 TB/s 访存受限算子,达成率健康(按单遍 50.3 MB 算只有 38%,与实际不符) memory-bound and healthy (a single-pass model would give only 38%, which does not match)

① GEMM 的 37% 不是 roofline 造成的,两条辩解都已排除:
• 算术强度 1781 FLOP/byte ≫ v7 拐点 312.9(2306 TFLOPS bf16 ÷ 7.37 TB/s),纯 compute-bound;
• v7 的 MXU 为 256×256,本 GEMM 切成 M=16 × K=16 × N=10 个 tile 全部整除,无边角浪费。
→ 嫌疑集中在 epilogue:尾部两次反量化广播乘与 convert 是否被计入这 50 µs。下一步应把 fusion 内部逐指令展开。

② 量化那 17.81 µs 应融进上游 Pre-RMSNorm 的 epilogue:激活 [4096,4096] bf16 = 32 MiB,v7 VMEM 为 64 MiB/core,整块可驻留。在 RMSNorm 输出还在 VMEM 时完成 absmax 与 convert,可省掉 两遍 HBM 读(约 67 MB)。

③ 另需单独检查注意力核心的 Q·Kᵀ:head_dim = 128 只填满 256 宽 MXU 的一半,那里才是形状对齐的真实受害者(本 GEMM 收缩维是 4096,不受影响)。
① The GEMM's 37% is not a roofline effect — both excuses are ruled out:
• arithmetic intensity 1781 FLOP/byte ≫ the v7 ridge point of 312.9 (2306 TFLOPS bf16 ÷ 7.37 TB/s), so it is purely compute-bound;
• the v7 MXU is 256×256, and this GEMM tiles into M=16 × K=16 × N=10all exact, no ragged edges.
→ Suspicion lands on the epilogue: whether the two trailing dequant broadcast multiplies and the convert are counted inside these 50 µs. Next step is an instruction-level expansion of the fusion.

② Fold that 17.81 µs quantization into the Pre-RMSNorm epilogue: the [4096,4096] bf16 activation is 32 MiB against 64 MiB/core of v7 VMEM, so the whole tile stays resident. Doing absmax and convert while the RMSNorm output is still in VMEM saves two HBM read passes (~67 MB).

③ Separately audit Q·Kᵀ in the attention core: head_dim = 128 fills only half of a 256-wide MXU — that is where shape misalignment actually bites (this GEMM contracts over 4096 and is unaffected).

📎 阶段归属说明📎 Which phase is this trace?

本段 trace 同时满足两个特征:QKV 输出 2560 列 = 20480/8(权重按头 8 路切 → TP=8),以及 M = 4096 = 32768/8(token 维 8 等分 → PCP=8 或 chunked prefill 的单块大小)。
⚠ 存疑未决:上线形态是 8 芯片 PCP8 + EP8,其中注意力权重是复制而非按头切分,不应出现 2560 列。因此本段 trace 更可能来自另一个 TP=8 的 prefill 变体(联合优化文档确实并列记录过 DP / TP / PCP 三种 prefill 配置),或 M=4096 只是 chunked prefill 的块大小而非 PCP 切分。在拿到原始 run 配置前,不要据此推断芯片数。 Decode (TP=2) 下同一算子输出应为 10240 列 且 M 不再被 8 整除,不要用本页的 µs 数字推 decode 延迟。
This trace satisfies two signatures at once: QKV output of 2560 columns = 20480/8 (weights split 8-way by head → TP=8), and M = 4096 = 32768/8 (the token axis in eight parts → PCP=8, or one chunked-prefill block).
⚠ Unresolved: the deployed form is 8 chips with PCP8 + EP8, where attention weights are replicated rather than head-sharded, so 2560 columns should not appear. This trace more likely comes from a different TP=8 prefill variant (the joint-optimization record does list DP / TP / PCP prefill configurations side by side), or M=4096 is simply the chunked-prefill block size rather than a PCP shard. Do not infer a chip count from this until the original run config is available. At decode (TP=2) the same op should emit 10240 columns with M no longer divided by 8 — do not use the µs figures on this page to infer decode latency.

📊 张量维度演进与拓扑切分速查表 (Prefill 8 卡 PCP=8+EP=8 / Decode 8 卡 TP=2×DP=4+EP=8 / 共 16 卡) Shape evolution and sharding cheat sheet (prefill 8 chips, PCP=8+EP=8 / decode 8 chips, TP=2×DP=4+EP=8 / 16 chips total)
计算阶段 / 算子 单卡形状 (Prefill, 取自 TP=8 变体 trace ⚠) 全局形状 精度 物理驻留 功能与架构含义
输入残差流 [B, T/8, 4096] [B, T, 4096] bf16 HBM 主干隐藏激活;PCP 沿序列维切 8 份
Pre-Attn RMSNorm [B, T/8, 4096] [B, T, 4096] bf16 VPU 逐 token 归一化,与切分方式无关
FP8 动态量化 (clamp_convert) [4096, 4096] f8e4m3fn VMEM (32 MiB / 64 MiB) 两遍 absmax + convert,17.81 µs,达峰值带宽 64%
★ QKV GEMM (fusion.243) [4096, 2560] [T, 20480] FP8 → bf16 MXU 256×256 M=4096 是 PCP 本地 token;2560 是 TP 列分片。50.00 µs,峰值 37.2%
QKV Slice (slice.7534) Q: [B, T/8, 12, 128]
KV: [B, T/8, 8, 128]
Q: [B, T, 96, 128]
KV: [B, T, 64, 128]
bf16 VPU 从 2560 列解构出 12 个 Q 头与 4+4 个 KV 头
Q-RMSNorm & K-RMSNorm [B, T/8, 12, 128]
[B, T/8, 4, 128]
[B, T, 96, 128]
[B, T, 32, 128]
bf16 VPU Qwen 核心设计:限制 Q/K 模长,杜绝超长文本 Softmax 溢出。V 不参与
★★★ KV Cache (Prefill) ★★★ [B, S/8, 4, 128] × 2 [B, S, 32, 128] × 2 fp8 / bf16 HBM 单卡 0.47 GiB @32K fp8(15 层 FA)。切分轴存疑:trace 形状读作 4 头 × 全序列,而记录中的部署形态 PCP=8 应为 32 头 × S/8 —— 两者体积完全相同,详见 Xprof 页存疑说明
★★★ KV Cache (Decode) ★★★ [B, S, 16, 128] × 2 [B, S, 32, 128] × 2 fp8 / bf16 HBM 只切头不切序列,且 DP=4 不切 KV → 单卡 1.88 GiB @32K fp8(15 层 FA),是 prefill 单卡的 4 倍,容量瓶颈以此行为准
PD 交接 KV Reshard Prefill 8 卡 (单卡 0.47 GiB @32K)Decode 8 卡 (16 头, 全序列, 1.88 GiB) fp8 / bf16 跨实例网络 头与序列两个维度同时重分布,并跨节点搬运,是 PD 分离的主要固有开销(对应 vllm-torchtpu#554 / #582)
PCP Ring / All-Gather [B, S, 4, 128] × 2 (补齐后) bf16 ICI 仅 Prefill:每 rank 只有 S/8 个 token,注意力需沿 CP 维环形传递 KV
GQA FlashAttention [B, T/8, 12, 128] [B, T, 96, 128] bf16 MXU + VPU 12 个 Q 头共享 4 组 KV (3:1)。head_dim=128 只填满 256 宽 MXU 一半
Out Proj & All-Reduce [B, T/8, 4096] [B, T, 4096] bf16 ICI 行并行汇聚:Prefill 8 卡,Decode 仅 2 卡(DP 副本之间不通信)
Qwen 共享专家 (Shared) [B, T/8, 4096] [B, T, 4096] bf16/fp8 MXU 常驻激活,中间维 5632,承载通用常识
路由专家 (512 选 Top-8) [B, T/8, 4096] [B, T, 4096] bf16/fp8 ICI All-to-All (EP=8) 中间维 1408;EP=8 下每卡常驻 64 个专家,两阶段一致。Decode 时注意力 DP=4 与此处 EP=8 不一致,需额外一次重排
Stage / operator Per-chip shape (prefill, from the TP=8-variant trace ⚠) Global shape Precision Resides in What it means
Input residual stream [B, T/8, 4096] [B, T, 4096] bf16 HBM Backbone hidden activations; PCP splits the sequence 8 ways
Pre-Attn RMSNorm [B, T/8, 4096] [B, T, 4096] bf16 VPU Per-token normalization; indifferent to how tokens are sharded
FP8 dynamic quant (clamp_convert) [4096, 4096] f8e4m3fn VMEM (32 of 64 MiB) Two passes, absmax + convert; 17.81 µs at 64% of peak bandwidth
★ QKV GEMM (fusion.243) [4096, 2560] [T, 20480] FP8 → bf16 MXU 256×256 M=4096 is the PCP-local token count; 2560 is the TP column shard. 50.00 µs, 37.2% of peak
QKV slice (slice.7534) Q: [B, T/8, 12, 128]
KV: [B, T/8, 8, 128]
Q: [B, T, 96, 128]
KV: [B, T, 64, 128]
bf16 VPU Recovers 12 Q heads and 4+4 KV heads out of the 2560 columns
Q-RMSNorm & K-RMSNorm [B, T/8, 12, 128]
[B, T/8, 4, 128]
[B, T, 96, 128]
[B, T, 32, 128]
bf16 VPU A Qwen signature: bounds the Q/K norms so long-context softmax cannot blow up. V is not normalized
★★★ KV cache (prefill) ★★★ [B, S/8, 4, 128] × 2 [B, S, 32, 128] × 2 fp8 / bf16 HBM 0.47 GiB per chip at 32K fp8 (15 FA layers). The axis is unresolved: the traced shape reads as 4 heads × full S, while the documented PCP=8 form implies 32 heads × S/8 — identical volume either way; see the open question on the Xprof tab
★★★ KV cache (decode) ★★★ [B, S, 16, 128] × 2 [B, S, 32, 128] × 2 fp8 / bf16 HBM Heads split, sequence not, and DP=4 does not shard KV1.88 GiB per chip at 32K fp8 (15 FA layers), 4× the prefill figure; this row sets the capacity limit
PD handoff KV reshard 8 prefill chips (0.47 GiB each @32K)8 decode chips (16 heads, full S, 1.88 GiB) fp8 / bf16 Cross-instance network Redistributes along both the head and sequence axes and crosses nodes — the dominant intrinsic cost of PD disaggregation (vllm-torchtpu#554 / #582)
PCP ring / all-gather [B, S, 4, 128] × 2 (after gather) bf16 ICI Prefill only: each rank owns S/8 tokens, so attention must circulate KV around the CP axis
GQA FlashAttention [B, T/8, 12, 128] [B, T, 96, 128] bf16 MXU + VPU 12 Q heads share 4 KV groups (3:1). head_dim=128 fills only half a 256-wide MXU
Out proj & All-Reduce [B, T/8, 4096] [B, T, 4096] bf16 ICI Row-parallel reduction: 8 chips at prefill, only 2 at decode (DP replicas never communicate)
Qwen shared expert [B, T/8, 4096] [B, T, 4096] bf16/fp8 MXU Always active, intermediate dim 5632, carries general knowledge
Routed experts (Top-8 of 512) [B, T/8, 4096] [B, T, 4096] bf16/fp8 ICI All-to-All (EP=8) Intermediate dim 1408; EP=8 keeps 64 experts resident per chip in both phases. At decode, attention is DP=4 while this is EP=8, so one extra reshuffle is required
🧮 Qwen 3.5 397B KV Cache 显存 / 并发容量核算器 (TPU v7 Ironwood) Qwen 3.5 397B KV cache memory & concurrency calculator (TPU v7 Ironwood)

Prefill 把 KV 摊到 8 卡上,单卡 1.88 GiB @128K(记录中的 PCP=8 形态读作 32 头 × S/8,trace 形状读作 4 头 × 全序列,体积相同、轴存疑);Decode 沿 头 (TP=2) 切且 DP 不切 KV(每个 DP 副本完整保存自己那批请求的全序列)。 结果是单卡 KV 相差 4 倍,真正的容量约束永远来自 decode。注意只有 15 层 full-attention 产生 KV,45 层 GDN 不产生。 Prefill spreads KV over 8 chips at 1.88 GiB each @128K (the documented PCP=8 form reads as 32 heads × S/8, the traced shape as 4 heads × full S — same volume, axis unresolved); decode splits heads (TP=2) and DP does not shard KV, since each DP replica keeps the full-length cache for its own requests. The result is a gap in per-chip KV, and the real capacity limit always comes from decode. Note that only the 15 full-attention layers produce KV; the 45 GDN layers do not.

拓扑 / 芯片总数Topology / total chips
单卡 KV 头数 × 本地 token 数KV heads × local tokens per chip
单请求单卡缓存 (15 层 FA,GDN 层无 KV)Per request, per chip (15 FA layers; GDN layers hold no KV)
单卡承担请求数 (= ⌈B / DP⌉)Requests per chip (= ⌈B / DP⌉)
单卡 KV / 权重 / 余量Per chip: KV / weights / free
★ 可支撑的最大全局并发★ Max sustainable global concurrency
* TPU v7 Ironwood 单芯片 7.37 TB/s / 4614 TFLOPS(fp8) / MXU 256×256 / VMEM 64 MiB per core,roofline 拐点 312.9 FLOP/byte;此处预留 8 GiB 给激活与临时缓冲。
* HBM 这里按 189.5 GiB 算,不是规格页上的 192 GiB。v7 一颗芯片是两颗 chiplet,各自是独立 device、各自 96 GiB;XLA 在单个 device 上实际肯接受的最大分配是 94.74 GiB(读自一条 OOM 报错),两颗合起来 2 × 94.74 = 189.5 GiB,比标称少 2.5 GiB。其中那一小截运行时预留是反推出来的,不是公布常数 —— 而且两份材料给的值就对不上:一处是 95.93 − 94.74 = 1.19 GiB,另一处是 95.38 − 94.74 = 656.93 MiB(≈0.64 GiB)。这恰好证明它不是常数,别当常数用。
* 顺带把进制钉死:94.74 本来就是 GiB,证据是那条报错串 95.38G − 94.74G = 656.93M 只有按 1024 才对得上。所以百分比一律按字节同进制相除,不要先换算分子 —— 讲义里有一次「纠正」正是这样把对的改成了错的。
* 更要紧的是 94.74 GiB 是「单次分配」上限:一块 buffer 不能横跨两颗 chiplet,跨了要显式 D2D。所以「一块 192 GiB 的芯片」在分配器眼里是两个 94.74。口径出处:专题二 §1.1 + 附录 A;Google Cloud 自己的 TPU7x 页面在同一页上同时写了 192 GiB 和 192 GB。
* Prefill 的「最大并发」指同时在 8 卡 prefill 节点上做 prefill 的请求数,通常不是瓶颈;排容量以 decode 行为准
* ⚠ 这个核算器贴着上限那一带会失灵。远离 189.5 时它可信;逼近 189.5 的那条窄带里判不准,而值得一试的配置恰好都挤在那条窄带里。原因是显存不是模型的属性,是「模型 × 实现 × 编译器」三者的属性 —— 同样的配置换个算子实现,需求就变,方向还不固定。另外「编译过了 ≠ 装得下」,而真正的编译失败常被报成「装不下」,会把人引去调小 batch。请只用它排除明显不行的配置,最后那个决定它不替你做。 (出处:专题一 §7.5)
* 一个不在这张表里、也不随并行度缩小的峰值:出口 logits。词表 248,320(比 DeepSeek V3 的 129,280 大 92%),每个位置 485 KiB;一个 16K chunk 若不先切到最后一个位置就过 lm_head,会物化 7.58 GiB(bf16)/15.2 GiB(fp32)。prefill 其实只需要最后一个位置的 485 KiB —— 差 16,384 倍这是一个便宜的检查项,不是已知缺陷。
* TPU v7 Ironwood per chip: 7.37 TB/s / 4614 TFLOPS (fp8) / MXU 256×256 / 64 MiB VMEM per core, ridge point 312.9 FLOP/byte; 8 GiB is reserved here for activations and scratch.
* HBM is budgeted at 189.5 GiB here, not the 192 GiB on the spec sheet. A v7 chip is two chiplets, each an independent device with its own 96 GiB. The largest allocation XLA will actually accept on one device is 94.74 GiB (read off an OOM message), so the pair gives 2 × 94.74 = 189.5 GiB — 2.5 GiB short of nominal. The sliver of runtime reserve inside that is back-derived, not a published constant — and the two sources disagree about it: one gives 95.93 − 94.74 = 1.19 GiB, the other 95.38 − 94.74 = 656.93 MiB (≈0.64 GiB). Which is precisely the proof that it is not a constant — do not reuse it as one.
* While we are here, pin the base down: 94.74 is already GiB. The evidence is that the error string 95.38G − 94.74G = 656.93M only reconciles base-1024. So percentages are taken byte-wise in a single base; never convert the numerator first — one lecture "corrected" a right answer into a wrong one exactly that way.
* What matters more: 94.74 GiB is a single-allocation ceiling. One buffer cannot straddle the two chiplets; crossing is explicit D2D. So a "192 GiB chip" is two 94.74s as far as the allocator is concerned. Provenance: topic-02 §1.1 + Appendix A. Google Cloud's own TPU7x page writes both 192 GiB and 192 GB on the same page.
* The prefill "max concurrency" counts requests prefilling simultaneously on the 8-chip prefill node and is rarely the bottleneck — size the fleet from the decode row.
* ⚠ This calculator goes blind in the band right up against the ceiling. Far from 189.5 it is reliable; in the narrow band approaching 189.5 it cannot call it — and the configurations worth trying are all crowded into exactly that band. The reason is that memory is not a property of the model; it is a property of model × implementation × compiler — swap one operator implementation and the requirement moves, in an unpredictable direction. Also, "it compiled" is not "it fits", and a genuine compilation failure is often reported as an out-of-memory, sending people off to shrink the batch. Use this to rule out the clearly impossible; it does not make the last call for you. (Source: topic-01 §7.5)
* A peak that appears in no weight table and does not shrink with parallelism: the exit logits. The vocabulary is 248,320 (92% larger than DeepSeek V3's 129,280), i.e. 485 KiB per position; a 16K chunk that reaches lm_head without first slicing to the last position materializes 7.58 GiB in bf16 or 15.2 GiB in fp32. Prefill actually needs only the last position's 485 KiB — a factor of 16,384. A cheap thing to check, not a known defect.
📜 完整端到端 ASCII 张量流向 (Prefill 视角,8 路头切分 + 8 路序列切分) End-to-end ASCII pipeline (prefill view: 8-way head split + 8-way sequence split)

Decode 差异:每卡 12Q/4KV → 48Q/16KV2560 → 10240 列,o_proj 6144→4096,All-Reduce 域 8 卡 → 2 卡,PCP ring 整段消失,并额外需要注意力 DP=4 与 MoE EP=8 之间的 All-to-All 重排。 Decode differences: 12Q/4KV → 48Q/16KV per chip, 2560 → 10240 columns, o_proj 6144→4096, the All-Reduce domain shrinks from 8 chips to 2, the PCP ring stage disappears entirely, and a DP=4 ↔ EP=8 All-to-All reshuffle is added around the MoE.


                                [B, T, D]
                              [B, T, 4096]  (主干残差流)
                                   │
               ┌───────────────────┴───────────────────┐ (残差旁路)
               ▼                                       │
     【Pre-Attn RMSNorm】 (attn_norm)                  │
               │                                       │
          [B, T/8, 4096]  (PCP=8 切序列)               │
               │                                       │
               ▼                                       │
  ┌─────────────────────────┐                          │
  │ ★ fusion.243 (QKV 投影) │ (trace: TP=8 变体列切)   │
  │   4096 → 2560           │ (全局 4096 → 20,480)     │
  │   M = T/8 = 4096        │ (PCP 本地 token 数)      │
  └────────────┬────────────┘                          │
               │                                       │
         [B, T/8, 2560]                                │
               │                                       │
  ┌────────────┴────────────┐ (下游切片 slice.7534)    │
  ▼                         ▼                          │
Q 投影                   KV 投影                       │
2560 切出前 1536          2560 切出后 1024             │
[B, T/8, 12, 128]        [B, T/8, 8, 128]              │
  │                         ├── K: [B, T/8, 4, 128]    │
  │                         └── V: [B, T/8, 4, 128]    │
  ▼                                 │       │          │
【Q-RMSNorm】 (Qwen 特色)            │       │          │
  │                         ┌───────┘       │          │
  ▼                         ▼               │          │
[B, T/8, 12, 128]      【K-RMSNorm】 (Qwen) │          │
  │                         │               │          │
  ▼                         ▼               │          │
[Q-RoPE 旋转编码]      [K-RoPE 旋转编码]    │          │
  │                         │               │          │
  ▼                         ▼               ▼          │
[B, T/8, 12, 128]    [B, T/8, 4, 128] [B, T/8, 4, 128] │
  │                         │               │          │
  │               ┌─────────┴───────────────┴────────┐ │
  │               │ ★★★ KV Cache 显存物理驻留点 ★★★   │ │
  │               │ Prefill: [B, S/8, 4, 128] × 2    │ │
  │               │ Decode : [B, S,  16, 128] × 2    │ │
  │               └─────────────────┬────────────────┘ │
  │                                 │                  │
  │          【PCP=8 Ring / All-Gather KV】            │
  │          仅 Prefill:每 rank 只有 S/8 个 token     │
  │                                 │                  │
  └─────────────────┬───────────────┘                  │
                    ▼                                  │
                 /──────────────────────\              │
                <  GQA Flash/SplashAttn  >             │
                < Softmax(Q·K^T / √128)·V>             │
                 \──────────────────────/              │
                            │                          │
                    [B, T/8, 12, 128]                  │
                            │ (展平为 [B, T/8, 1536])  │
                            ▼                          │
                   【Out Proj (o_proj)】               │
                   1536 → 4096 (单卡局部)              │
                            │                          │
                            ▼                          │
              【All-Reduce】Prefill 8 卡 / Decode 2 卡 │
                            │                          │
                      [B, T, 4096]                     │
                            │                          │
                            ▼                          │
                 【残差相加 ① (Residual Add)】 ◄───────┘
                            │
                      [B, T, 4096]
                            │
               ┌────────────┴────────────┐ (残差旁路)
               ▼                         │
     【Post-Attn RMSNorm】 (ffn_norm)    │
               │                         │
     ┌─────────┴─────────┐               │
     ▼                   ▼               │
【共享专家 (Shared)】  【Router 路由器】 │
 4096 → 5632         4096 → 512 专家     │
 (SwiGLU 常驻激活)   Softmax 选 Top-8    │
     │                   │               │
     │      All-to-All 派发 (EP=8)       │
     │      每卡常驻 64 个专家           │
     │                   ▼               │
     │        【8 个路由专家 (Routed)】   │
     │         4096 → 1408 (SwiGLU)      │
     │                   │               │
     │      加权求和 & All-to-All 回传   │
     │                   ▼               │
[B, T, 4096]        [B, T, 4096]         │
     └─────────┬─────────┘               │
               ▼                         │
        【MoE 合并相加】                 │
               │                         │
               ▼                         │
    【残差相加 ② (Residual Add)】 ◄──────┘
               │
          [B, T, 4096]  (输出送入下一层 Transformer)
      

                        [B, T, 4096]   residual stream
                             │
         ┌───────────────────┴──────────────────────────────┐  residual bypass
         ▼                                                  │
  [Pre-Attn RMSNorm]  (attn_norm)                           │
         │                                                  │
         ▼                                                  │
  ┌────────────────────────────────┐                        │
  │ * fusion.243   QKV projection  │  TP=8-variant col split│
  │   4096 -> 2560   per chip      │  (global 20,480)       │
  │   M = T/8        PCP=8 local   │                        │
  └───────────────┬────────────────┘                        │
                  │                                         │
           [B, T/8, 2560]                                   │
                  │                                         │
  ┌───────────────┴──────────────┐   slice.7534             │
  ▼                              ▼                          │
 Q   [0:1536]                 KV   [1536:2560]              │
 [B, T/8, 12, 128]            [B, T/8, 8, 128]              │
  │                              ├── K  [B, T/8, 4, 128]    │
  │                              └── V  [B, T/8, 4, 128]    │
  ▼                                  │        │             │
 [Q-RMSNorm]  Qwen                   │        │             │
  │                            ┌─────┘        │             │
  ▼                            ▼              │             │
 [Q-RoPE]                 [K-RMSNorm] Qwen    │             │
  │                            │              │             │
  │                            ▼              │             │
  │                       [K-RoPE]            │             │
  │                            │              │             │
  │             ┌──────────────┴──────────────┘             │
  │             ▼                                           │
  │  ╔═══════════════════════════════════════╗              │
  │  ║  *** KV CACHE   HBM resident ***      ║              │
  │  ║  prefill : [B, S/8,  4, 128]  x2      ║              │
  │  ║  decode  : [B, S,   16, 128]  x2      ║              │
  │  ╚═══════════════════╤═══════════════════╝              │
  │                      │                                  │
  │   ring / all-gather KV over the 8 PCP ranks             │
  │   (prefill only: each rank owns S/8 tokens)             │
  │                      │                                  │
  └──────────┬───────────┘                                  │
             ▼                                              │
   /─────────────────────────────────────\                  │
  <  GQA Flash / Splash Attention          >                │
  <  softmax(Q.K^T / sqrt(128)) . V        >                │
  <  12 Q heads share 4 KV groups (3:1)    >                │
   \─────────────────────────────────────/                  │
             │                                              │
      [B, T/8, 12, 128] -> flat [B, T/8, 1536]              │
             ▼                                              │
   [Out Proj (o_proj)]   1536 -> 4096                       │
             │                                              │
             ▼                                              │
   [All-Reduce]  prefill 8 chips / decode 2 chips           │
             │                                              │
             ▼                                              │
   [Residual Add 1]  <──────────────────────────────────────┘
             │
       [B, T, 4096]
             │
  ┌──────────┴──────────────────────────────┐  residual bypass
  ▼                                         │
 [Post-Attn RMSNorm]  (ffn_norm)            │
  │                                         │
  ├──────────────────┐                      │
  ▼                  ▼                      │
 [Shared Expert]    [Router]                │
 4096->5632->4096   4096 -> 512 experts     │
 SwiGLU, always on  softmax, pick Top-8     │
  │                  │                      │
  │        All-to-All dispatch              │
  │        (EP=8, 64 experts per chip)      │
  │                  ▼                      │
  │        [Top-8 Routed Experts]           │
  │         4096->1408->4096  SwiGLU        │
  │                  │                      │
  │        weighted sum + All-to-All combine│
  │                  ▼                      │
  └────────┬─────────┘                      │
           ▼                                │
    [MoE Merge Add]                         │
           │                                │
           ▼                                │
    [Residual Add 2]  <─────────────────────┘
           │
     [B, T, 4096]  -> next Transformer layer
      
🔬 核心工程优化与 Xprof 硬件微秒级 Trace 剖析大盘 Core optimizations under a microsecond-resolution Xprof hardware trace
实测环境: Test bed: bodaborg-tpu7x-nap (cloud-tpu-shared-capacity) · 2×4

跨卡大模型剖析有个众所周知的坑:单次采样超过 1 s 就容易撑爆片上环形 buffer,导出的 trace 又会把浏览器 Chrome Trace Viewer 撑到 OOM。 本大盘改用外科手术式分阶段采样(每窗口 ≤ 160 ms),精确透视 5 处核心突破的微观硬件执行状态,并配齐对应的 Xprof 剖面视图与代码 PR。 Profiling a multi-chip model has a well-known trap: sample for more than about a second and the on-chip ring buffer overflows, while the exported trace is large enough to OOM Chrome's trace viewer. This board instead uses surgical per-stage sampling with windows of 160 ms or less, giving a clean view of the micro-architectural state behind each of the five breakthroughs, alongside the matching Xprof view and code PR.

⚠ 标定基线与两处未闭合项(引用前请读) ⚠ Calibration baseline and two unreconciled items (read before quoting)
基线:下表与三张 trace 卡片的实测值均采自 bodaborg-tpu7x-nap · 2×4 上的 8 芯片 prefill 节点 / 60 层混合架构(45 GDN + 15 GQA),这也是本文档的主口径(PCP=8 + EP=8,无 64 芯片实例)。
① 492 µs 是「每层」还是「每跳」:原始材料里「492 µs × 15 层」与表中「4,120 µs / 16K chunk」相差约 8×,曾被解读为漏乘了环形的 8 跳。 现按全局预算改判为「每层」:联合优化文档给出的 prefill 分层是 full 492 µs × 15 / linear 774 µs × 45 / MoE 1.41 ms × 60,三项相加 = 126.8 ms,落在文档记录的 158 ms 总时延之内(余量给 embedding / LM head / 通信与空隙); 若按 492 µs/跳 × 8 跳 计,仅 FA 一项就是 59.0 ms,三项合计 178.5 ms > 158 ms与文档自相矛盾。故取 492 µs / 层 → 15 层合计 ≈ 7.4 ms仍未解释:表中 4,120 µs 的那条读数来源不明(可能是另一配置、或含 MoE 的整层耗时),不要与 492 µs 混用
② 阶段时间轴与算子表仍不闭合:按上述口径,15 层 FA 合计约 7.4 ms、整个 prefill 分层合计约 126.8 ms,而「张量流动图」阶段带给 PCP8 环形注意力分配了 1.85 s —— 与 FA 项差约 250×,与整段 prefill 差约 15×。 本文档未替你强行调平——阶段带是那次压测的墙钟相位划分,算子表是单层 / 单 chunk 的采样窗口,缺少把二者连起来的中间层数据。 对外汇报时请勿把这两套数字放在同一张表里相加。
Baseline: every measurement in the table and the three trace cards below was taken on bodaborg-tpu7x-nap · 2×4 from an 8-chip prefill node running the 60-layer hybrid build (45 GDN + 15 GQA), which is also this document's main configuration (PCP=8 + EP=8; there is no 64-chip instance).
① Is 492 µs "per layer" or "per hop": the source material's "492 µs × 15 layers" disagrees with the table's "4,120 µs per 16K chunk" by roughly 8×, which was once read as a dropped ring-hop factor. The global budget settles it as per-layer: the joint-optimization record's prefill breakdown — full 492 µs × 15, linear 774 µs × 45, MoE 1.41 ms × 60 — sums to 126.8 ms, comfortably inside the 158 ms total the same record reports (the rest going to embedding, LM head, communication and gaps). Under the ×8-hop reading, full attention alone is 59.0 ms and the three terms sum to 178.5 ms > 158 ms, contradicting the record itself. So: 492 µs per layer → ≈7.4 ms for all 15. Still unexplained: where the 4,120 µs figure comes from (possibly another configuration, or a whole layer including MoE) — do not mix it with the 492 µs figure.
② The stage timeline and the operator table still do not close: on the reading above, the 15 FA layers total about 7.4 ms and the whole per-layer prefill breakdown about 126.8 ms, while the stage ribbon on the dataflow tab allots 1.85 s to PCP8 ring attention — roughly 250× the FA term and 15× the whole prefill. This has deliberately not been force-fitted: the ribbon is a wall-clock phase breakdown of that stress run, the operator table is a single-layer, single-chunk sampling window, and the intermediate data needed to bridge them is missing. Do not add figures from these two systems together in the same table when presenting.

⚡ 算子级微架构分析表(HLO Op-Level Breakdown) ⚡ Operator-level microarchitectural breakdown (HLO)

基于 Xprof 捕获的 XLA HLO IR、物理硬件单元(MXU / VPU / DMA)、访存吞吐与算术强度(roofline)实测 From Xprof-captured XLA HLO IR: physical unit (MXU / VPU / DMA), memory traffic and arithmetic intensity (roofline)
Single-op granularity
优化项 / 模块 XLA HLO 算子名 物理执行硬件 张量 Shape 与 Dtype 实测耗时 访存流量与算术强度 微架构瓶颈与突破点
【优化 1】
GDN 线性状态更新
%fusion.gdn_v3_recurrent
(fused_decay_outer_prod)
TPU VPU
8×128 向量寄存器 + VMEM
S: [H, 128, 128] FP8
Q/K/V: [4K, H, 128] FP8
α/β: [4K, H] BF16
4,120 µs
840 µs
(4.9× 提速,每层)
流量 16 KB/head
强度 64 FLOPs/B
零写回 HBM
原生痛点:memory-bound,反复读写 32 KB 的 BF16 状态。
算子突破:FP8 压缩把 128×128 状态矩阵降到 16 KB,完全锁在片上 VMEM,内层展开为连续 FMA 原地更新,显存落盘归零。
【优化 3a】
PCP8 Ring 计算
%custom-call[FlashAttention]
(dot_general_matmul)
TPU MXU
128×128 脉动阵列
Q: [16K, 128] BF16
K/V: [16K, 128] BF16
Tile: [128, 128] FP32 acc
492 µs / 层
15 层合计 ≈ 7.4 ms
⚠ 另有 4,120 µs 读数,来源不明
FLOPs 8.59 TFLOP
强度 168 FLOPs/B
Compute-bound
算子执行:脉动阵列以双缓冲流水吸收来自 VMEM 的 Q 与 K 分块。
重叠屏障:4,120 µs 的计算时长构成「算力保护伞」,为下方通信提供充裕的遮蔽窗口。
【优化 3b】
PCP8 ICI 环形通信
%collective-permute.async-start
(ring_p2p_transfer)
ICI DMA 引擎
Optical / copper direct bus
KV chunk [16K, 4, 128]
数据量 16.38 MB
Dtype BF16
物理耗时 950 µs
显式气泡 0 µs
(100% 隐藏)
带宽 17.24 GB/s
单卡双向环路
双缓冲 ping-pong
原生痛点:All-Gather 广播引发网络拥塞与显存膨胀。
算子突破:改为 P2P 邻居环形搬运,用异步 XLA start/done 注解把 950 µs 传输整个塞进 4,120 µs 的计算内部。
【优化 2】
DCN 跨切片直传
%dcn_rdma_send_stream
(seq_on_lane_transfer)
200G DCN NIC
PCIe Gen5 + RDMA/TCP
128K KV cache
[131072, 15, 4, 128] FP8
单卡载荷 1.92 GB
(= 1.875 GiB · 8 卡合计 15 GiB)
450 ms
138.0 ms
(3.2× 提速)
推算 13.6 GB/s
文档背书 >12.5 GB/s
(线速 25 GB/s)
Zero-copy
原生痛点:离散排布导致 scatter-gather DMA 握手延迟,带宽利用率不足 30%。
算子突破SEQ_ON_LANE 在生成时前置 KV heads 维,形成物理连续大块,一笔就能拉满网卡线速。
口径换算:1.92 GB (= 1.875 GiB) 是单卡份额,8 卡合计 15 GiB / 请求(15 层 FA × 32 KV 头,FP8)。138 ms 是 1.92 GB ÷ 13.6 GB/s 的推算值;按文档背书的 >12.5 GB/s 则为 ~154 ms。双网卡(400 Gbps)尚未交付,仍是阻塞项 b/558565285。
【优化 4】
MoE 专家原地聚合
%fusion.owner_output_combine
(in_place_weighted_reduce)
TPU VPU / ALU
Owner core 本地累加器
Top-8 专家输出
[8, hidden] BF16
weights [8] FP32
3,100 µs
2,140 µs
(+31%)
显存申请 0 B
(消灭临时 buffer)
节省显存带宽 65%
原生痛点:通用框架在接收端分配临时 buffer 倒手三遍,频繁触发分配器锁竞争。
算子突破:数据流式到达宿主卡时,直接在本地累加器上原地乘加门控权重,中间显存分配彻底消失。
【优化 5】
MTP RPA 投机验证
%fusion.rpa_verify_speculative
(tree_mask_flash_decode)
TPU MXU + VPU
流水线分块执行
候选 token 2~3
speculative mask [3, 3]
KV cache: paged blocks
22.45 ms/tok
11.20 ms/tok
(单步命中 2 词)
权重复用率 2.0×
(单次 HBM 读权重产出双词)
吞吐 5,650 tok/s
原生痛点:树状推测 mask 导致脉动阵列计算不对齐,产生分支气泡。
算子突破:RPA verify 特化把多候选验证与主前向按规则分块对齐,额外验证耗时趋近 0,硬件算力利用率从 12% 提升到 25%。
Optimization / module XLA HLO op Physical unit Tensor shape & dtype Measured latency Traffic & arithmetic intensity Microarchitectural bottleneck and fix
Opt 1
GDN linear state update
%fusion.gdn_v3_recurrent
(fused_decay_outer_prod)
TPU VPU
8×128 vector registers + VMEM
S: [H, 128, 128] FP8
Q/K/V: [4K, H, 128] FP8
α/β: [4K, H] BF16
4,120 µs
840 µs
(4.9× per layer)
Traffic 16 KB/head
Intensity 64 FLOPs/B
Zero HBM write-back
Original: memory-bound, re-reading and rewriting a 32 KB BF16 state every step.
Fix: FP8 shrinks the 128×128 state to 16 KB so it stays pinned in on-chip VMEM; the inner loop unrolls into contiguous in-place FMAs and nothing spills to HBM.
Opt 3a
PCP8 ring compute
%custom-call[FlashAttention]
(dot_general_matmul)
TPU MXU
128×128 systolic array
Q: [16K, 128] BF16
K/V: [16K, 128] BF16
Tile: [128, 128] FP32 acc
492 µs / layer
15 layers ≈ 7.4 ms
⚠ a 4,120 µs reading also exists, source unknown
FLOPs 8.59 TFLOP
Intensity 168 FLOPs/B
Compute-bound
Execution: the systolic array absorbs Q and K tiles from VMEM through a double-buffered pipeline.
Overlap barrier: 4,120 µs of compute acts as an umbrella, leaving a wide window underneath for the transfer to hide in.
Opt 3b
PCP8 ICI ring transfer
%collective-permute.async-start
(ring_p2p_transfer)
ICI DMA engine
Optical / copper direct bus
KV chunk [16K, 4, 128]
Payload 16.38 MB
Dtype BF16
Physical 950 µs
Explicit bubble 0 µs
(100% hidden)
Bandwidth 17.24 GB/s
Bidirectional ring per chip
Double-buffered ping-pong
Original: an All-Gather broadcast congested the network and inflated memory.
Fix: replaced by nearest-neighbour P2P ring transfers; async XLA start/done annotations tuck the whole 950 µs inside the 4,120 µs of compute.
Opt 2
DCN inter-slice transfer
%dcn_rdma_send_stream
(seq_on_lane_transfer)
200G DCN NIC
PCIe Gen5 + RDMA/TCP
128K KV cache
[131072, 15, 4, 128] FP8
Per-chip 1.92 GB
(= 1.875 GiB · 15 GiB over 8 chips)
450 ms
138.0 ms
(3.2×)
Derived 13.6 GB/s
record backs >12.5 GB/s
(25 GB/s line rate)
Zero-copy
Original: the scattered layout forced scatter-gather DMA handshakes, holding link utilization under 30%.
Fix: SEQ_ON_LANE hoists the KV-head axis at generation time into one physically contiguous block that saturates the NIC in a single descriptor.
Conversion: 1.92 GB (= 1.875 GiB) is the per-chip share; across 8 chips that is 15 GiB per request (15 FA layers × 32 KV heads, FP8). The 138 ms is 1.92 GB ÷ 13.6 GB/s; at the documented >12.5 GB/s it would be ~154 ms. Dual-NIC (400 Gbps) is not delivered — still blocked, b/558565285.
Opt 4
In-place MoE expert combine
%fusion.owner_output_combine
(in_place_weighted_reduce)
TPU VPU / ALU
Owner-core local accumulator
Top-8 expert outputs
[8, hidden] BF16
weights [8] FP32
3,100 µs
2,140 µs
(+31%)
Allocation 0 B
(temporary buffers gone)
65% less memory bandwidth
Original: the generic path allocated receive-side temporaries and passed the data through three times, hammering the allocator lock.
Fix: as results stream into the owner chip, the gating weights are multiplied and accumulated in place in a local accumulator — no intermediate allocation at all.
Opt 5
MTP RPA speculative verify
%fusion.rpa_verify_speculative
(tree_mask_flash_decode)
TPU MXU + VPU
Pipelined tiled execution
Candidate tokens 2–3
speculative mask [3, 3]
KV cache: paged blocks
22.45 ms/tok
11.20 ms/tok
(2 tokens accepted/step)
Weight reuse 2.0×
(one HBM weight read, two tokens)
5,650 tok/s
Original: the tree-shaped speculative mask misaligned the systolic array and opened branch bubbles.
Fix: the specialized RPA verify aligns multi-candidate verification with the main forward pass on a regular tiling, so the extra verification cost approaches zero and utilization climbs from 12% to 25%.

优化项 1 & 3 — GDN FP8 融合状态更新 + PCP8 Ring Attention 异步双缓冲 Opt 1 & 3 — GDN FP8 fused state update + PCP8 ring attention double buffering

🔗 vllm-torchtpu#766 / #1082 / #873 (GDN) & #366 / #414 / #863 (PCP8 ring + 双缓冲 DMA)
🚀 在 Xprof 打开切片 (1383~1417 ms)Open slice in Xprof (1383–1417 ms)
🔴 优化前原生瓶颈🔴 Before
GDN 4.12 ms/层 · 无重叠 TTFT ~32.0 sGDN 4.12 ms/layer · unoverlapped TTFT ~32.0 s 状态频繁落盘到慢速 HBM;单缓冲使通信与计算串行干等。 State spilled constantly to slow HBM, and single buffering serialized transfer against compute.
🟢 优化后硬件收益🟢 After
GDN 0.84 ms (4.9×) · 通信气泡 0 µs · TTFT 4.62 sGDN 0.84 ms (4.9×) · 0 µs bubble · TTFT 4.62 s FP8 紧凑状态锁在片上 VMEM 零写回;双缓冲把通信 100% 藏进计算阴影。 The compact FP8 state is pinned in VMEM with zero write-back, and double buffering hides the transfer entirely under compute.
Xprof Trace Viewer | Session: felixli-10869217132326050871 | Window: 1383.169 – 1417.539 ms (Δt = 34.37 ms) Zoom 100% · Buffer 0% dropped
1383.169 ms1390.0001400.0001410.0001417.539 ms
TPU:0 Core 0 [MXU systolic array — compute stream]
★ GQA Full-Attention Core (FlashAttention_Ring · 实测 492 µs/层 · 本窗口 34.37 ms 覆盖的层数未定) ★ GQA full-attention core (FlashAttention_Ring · measured 492 µs/layer · layer coverage of this 34.37 ms window undetermined)
TPU:0 Core 0 [VPU vector unit — GDN FP8 recurrent]
★ GDN V3 FP8 融合状态更新 (VMEM 原地 · 0.84 ms/层 · 零 HBM 往返) ★ GDN V3 FP8 fused state update (in-place in VMEM · 0.84 ms/layer · zero HBM round-trip)
TPU:0 ICI DMA engine [inter-chip interconnect — double-buffered P2P]
ICI P2P 950 µs
🛡️ 100% 隐藏在 MXU 计算阴影中 · 显式气泡 = 0 µs 🛡️ Fully hidden in the MXU compute shadow · explicit bubble = 0 µs
💡 剖析定性:ICI DMA 通信条被 MXU 计算条完整包裹吞噬,双缓冲零等待闭环 —— 这是本图最确凿的结论。但 34.37 ms 这个窗口对应几层并不确定:15 层 FA 按 492 µs/层 只有 7.4 ms,故本窗口必然还含 GDN / MoE,不能当作纯 FA 波形读。 💡 Reading: the ICI DMA bar is entirely swallowed by the MXU bar — double buffering closes the loop with zero wait, and that is the solid conclusion here. How many layers this 34.37 ms window spans is not settled: at 492 µs per layer the 15 FA layers total only 7.4 ms, so the window must also contain GDN and MoE work and cannot be read as pure full attention.

优化项 2 — SEQ_ON_LANE 零拷贝内存重构与 DCN 跨切片直传 Opt 2 — SEQ_ON_LANE zero-copy layout and the DCN inter-slice handoff

🔗 vllm-torchtpu#554 (PCP8 → DP8/DP16 fix) & #582 (controller process)
🚀 在 Xprof 打开切片 (4480~4620 ms)Open slice in Xprof (4480–4620 ms)
🔴 优化前未重排排布🔴 Before (unlaid-out)
DCN 吞吐仅 4.2 GB/s · 耗时 ~450 ms4.2 GB/s · ~450 ms 碎步网格排布迫使网卡做数千次散乱小包 scatter-gather DMA,握手停顿严重。 The strided layout forced thousands of small scatter-gather DMA descriptors, and the handshake stalls dominated.
🟢 SEQ_ON_LANE 收益🟢 After SEQ_ON_LANE
DCN 吞吐 13.6 GB/s (3.2×) · 耗时 138.0 ms13.6 GB/s (3.2×) · 138.0 ms KV heads 维前置后形成连续巨型流(类比 jumbo frame),网卡单次连续 DMA 就灌满带宽。 With the KV-head axis hoisted the payload becomes one contiguous stream — jumbo-frame-like — and a single DMA saturates the link.
Xprof Trace Viewer | Stage 2: DCN highway | Window: 4480.000 – 4620.000 ms (Δt = 140.0 ms) Line rate 13.6 GB/s · wire speed
4480.000 ms (60 层算完)4480.000 ms (all layers done) 4515.0004550.0004585.000 4618.000 ms (移交完毕)4618.000 ms (handoff complete)
Prefill host 200 Gbps DCN NIC [RDMA / TCP direct pipeline]
⚡ 1.92 GB KV Cache 连续直流 (13.6 GB/s · 138.0 ms) ➔ Decode 节点 ⚡ 1.92 GB KV cache streamed contiguously (13.6 GB/s · 138.0 ms) ➔ decode node
Prefill slice TPU cluster status
Waiting for DCN ACK (138 ms) ✓ Waiting for DCN ACK (138 ms) ✓
💡 剖析定性:DCN 网卡波形是毫无停顿的单一饱满矩形,小包重连气泡彻底消失,移交延迟锁死在 138 ms。注意:1.92 GB (= 1.875 GiB) 是单卡份额,整请求 8 卡合计 15 GiB138 ms 系按 13.6 GB/s 推算;联合优化文档只背书单网卡峰值 >12.5 GB/s(线速 25 GB/s 的 50%),对应 ~154 ms。双网卡 400 Gbps 尚未交付。 💡 Reading: the NIC waveform is one uninterrupted saturated rectangle — the small-packet reconnect bubbles are gone and handoff latency is pinned at 138 ms. Note: 1.92 GB (= 1.875 GiB) is the per-chip share; the whole request is 15 GiB across 8 chips. The 138 ms is derived from 13.6 GB/s; the joint-optimization record only backs a single-NIC peak above 12.5 GB/s (50% of the 25 GB/s line rate), i.e. ~154 ms. Dual-NIC at 400 Gbps is not yet delivered.

优化项 4 & 5 — MoE 专家直聚 (owner_output) + MTP 多 Token 投机验证特化 Opt 4 & 5 — MoE direct gather (owner_output) + specialized MTP speculative verify

🔗 vllm-torchtpu#628 (owner_output combine) & #1008 / #559 (MTP speculative verify)
🚀 在 Xprof 打开切片 (4620~4700 ms)Open slice in Xprof (4620–4700 ms)
🔴 优化前逐字解码瓶颈🔴 Before (token-at-a-time decode)
22.45 ms/tok · 吞吐 < 2,800 tok/s22.45 ms/tok · under 2,800 tok/s 每生成一个词就要重跑一遍全部层;MoE 汇聚层层申请临时显存中转。 Every token re-ran the whole stack, and the MoE combine allocated staging memory at each layer.
🟢 特化后收益🟢 After specialization
摊销 11.20 ms/tok (2.0×) · 吞吐 5,650 tok/s11.20 ms/tok amortized (2.0×) · 5,650 tok/s MTP 单步命中 2 token;owner core 原地加权聚合铲平显存申请气泡。 MTP accepts 2 tokens per step, and the owner core's in-place weighted gather flattens the allocation bubble.
Xprof Trace Viewer | Stage 3: decode MTP | Window: 4620.000 – 4700.000 ms (Δt = 80.0 ms) Amortized 11.20 ms/tok · accepted 2 tok/step
4620.0 ms (step 0)4642.4 (step 1)4664.8 (step 2)4687.2 (step 3)4700.0 ms
TPU decode slice [forward pass + MTP verify, 4 steps]
Forward 9.8 ms
MTP +2 tok
Forward 9.8 ms
MTP +2 tok
Forward 9.8 ms
MTP +2 tok
Forward 9.8 ms
MTP +2 tok
TP=2 All-Reduce [on-package bus]
TP2 All-Reduce 每步仅 85 µs · 占比 < 2.7% · 零气泡支撑 5,650 tok/s 85 µs per step · under 2.7% of the step · zero bubble, sustaining 5,650 tok/s
💡 剖析定性:4 个解码步的波形完全规整,每步 forward 9.8 ms 后紧跟一次 MTP 验证并吐出 2 个 token,摊销到 11.20 ms/tok。TP2 All-Reduce 只占每步 85 µs,说明 decode 端瓶颈仍是权重的 HBM 读取而非通信 —— 这正是 MTP「一次读权重产出两词」奏效的原因。 💡 Reading: the four decode steps are perfectly regular — 9.8 ms of forward pass, then one MTP verification that emits 2 tokens, amortizing to 11.20 ms/tok. The TP2 All-Reduce costs only 85 µs per step, which says the decode bottleneck is still reading weights out of HBM rather than communication — exactly why MTP's "one weight read, two tokens" pays off.
📹 阿里 6.18 联合技术对齐 ➔ 9.18 工业级落地:三月攻坚脉络与实录资产 Alibaba 6.18 Joint Tech Alignment ➔ 9.18 Production Delivery: 3-Month Trajectory & Recording Assets
实录归档 · 诉求对齐 · 落地验收 Recordings · Alignment · Milestones 🌐 EN / 中文

2026年6月18日,Google Core ML 与阿里联合召开了三场关键技术专题攻坚会(由 Terance Sum 发起,Felix Li 等核心技术专家主讲), 针对 Qwen 3.5 397B-A17B 落地 Google Cloud TPU v7x(Ironwood)展开了涵盖「单层算子优化与 MoE 调度」「P/D 分离传输架构」「KV Cache 池化与长上下文显存治理」的三维深度对齐。 历经整整 3 个月的联合工程攻关(2026-06-18 ➔ 2026-09-18),最初梳理的原型缺陷、理论假设与客户核心卡点,已全量转化为确定性、工业级的量化交付战果: On June 18, 2026, Google Core ML and Alibaba convened three deep-dive technical sessions (organized by Terance Sum, led by Felix Li and core engineers), establishing a 3D joint technical alignment for deploying Qwen 3.5 397B-A17B onto Google Cloud TPU v7x (Ironwood) across "Single-Layer Operator & MoE Scheduling", "P/D Disaggregation Transport Architecture", and "KV Cache Pooling & Long-Context Memory Containment". Through 3 months of intensive co-engineering (2026-06-18 ➔ 2026-09-18), the initial architectural bottlenecks, compiler bugs, and customer pain points have been fully resolved into validated production deliverables:

🔬 专题一:Qwen 3.5 397B 算子优化与并行架构深度剖析 Deep Dive: Qwen 3.5 397B Operator Optimization & SPMD 06/18 11:00 HKT
主讲/参会:Terance Sum, Felix Li, Gang Ji, Sixiang Si, Weiren Yu, Yixin Shi, Alex Zhang, Chris Yang, Eason Gao, Jason Wang, Leo Zhao, Chris Chan, Lichun Li, Yuyan Peng Speakers/Attendees: Terance Sum, Felix Li, Gang Ji, Sixiang Si, Weiren Yu, Yixin Shi, Alex Zhang, Chris Yang, Eason Gao, Jason Wang, Leo Zhao, Chris Chan, Lichun Li, Yuyan Peng
⚠️ 6.18 原始诉求与核心痛点6.18 Initial Demands & Bottlenecks
• 512 细粒度专家路由调度碎片化,All-to-All 回传后存在多次中间显存拷贝与 CPU 调度空洞;
• 密集 Kernel 启动带来高昂 HBM 往返开销;XLA 意外将 FP 权重解包为 INT8 导致 Vector Spill 寄存器溢出与访存气泡。
• 512-expert routing fragmentation; redundant intermediate HBM staging copies & CPU gaps after All-to-All; XLA compiler unpacking FP weights into INT8 before loading, causing vector spills.
9.18 闭环成果与量化交付9.18 Resolution & Measured Deliverable
• 研发并合并 handsomehow/owner_output 原地汇聚分支,消除中间拷贝气泡;Decode 吞吐实测达标 5,650 tok/s • Merged handsomehow/owner_output direct gather branch; decode throughput verified at 5,650 tok/s (target met).
🌐 专题二:P/D 分离架构细节、跨机传输与最佳实践 Deep Dive: P/D Disaggregation Details & Inter-Slice DCN 06/18 14:00 HKT
主讲/参会:Terance Sum, Felix Li, Chris Yang, Eason Gao, Felix Zhao, Leo Zhao, Sixiang Si, Jason Wang, Alex Zhang, Lichun Li, Chris Chan, Weiren Yu, Gang Ji, Yuyan Peng Speakers/Attendees: Terance Sum, Felix Li, Chris Yang, Eason Gao, Felix Zhao, Leo Zhao, Sixiang Si, Jason Wang, Alex Zhang, Lichun Li, Chris Chan, Weiren Yu, Gang Ji, Yuyan Peng
⚠️ 6.18 原始诉求与核心痛点6.18 Initial Demands & Bottlenecks
• 单实例内 Prefill 计算与 Decode 互相干扰;
• Prefill(PCP 拓扑)传至 Decode(TP/DP 拓扑)时动态 Reshard 产生海量 CPU/DMA 内存转置,DCN 网卡带宽无法打满;Host 内存上传瓶颈严重。
• Monolithic interference between prefill and decode; severe dynamic resharding transposes when streaming KV from PCP to TP/DP, throttling DCN wire throughput; Host memory upload limits.
9.18 闭环成果与量化交付9.18 Resolution & Measured Deliverable
• 固化 1P1D(16芯片) 标准拓扑;研发 SEQ_ON_LANE 零拷贝连续布局,DCN 单网卡峰值突破 >12.5 GB/s(达 25 GB/s 线速 50%)。 • Standardized 1P1D (16-chip) topology; deployed SEQ_ON_LANE zero-copy layout; DCN peak >12.5 GB/s (50% of 25 GB/s line rate).
🧮 专题三:KV Cache 显存预算、池化与长上下文卸载 Deep Dive: KV Cache Budget, Pooling & Offloading 06/18 15:42 HKT
主讲/参会:Terance Sum, Felix Li, Chris Yang, Yixin Shi, Felix Zhao, Leo Zhao, Sixiang Si, Jason Wang, Alex Zhang, Lichun Li, Eason Gao, Chris Chan, Weiren Yu, Gang Ji, Yuyan Peng Speakers/Attendees: Terance Sum, Felix Li, Chris Yang, Yixin Shi, Felix Zhao, Leo Zhao, Sixiang Si, Jason Wang, Alex Zhang, Lichun Li, Eason Gao, Chris Chan, Weiren Yu, Gang Ji, Yuyan Peng
⚠️ 6.18 原始诉求与核心痛点6.18 Initial Demands & Bottlenecks
• 128K 超长上下文造成显存墙,HBM 无法支撑生产并发;Trunk 分片与 Roofline 边界不明确;
• 整机 DRAM RSS 飙升至 ~700 GB 无法释放导致 KVCM 无法拉起。
• 128K context hits HBM compute/capacity wall; trunk/slot boundaries unclear; whole-node DRAM RSS ballooned to ~700 GB and never released, preventing KVCM from launching.
9.18 闭环成果与量化交付9.18 Resolution & Measured Deliverable
• 落地 PCP=8 Ring Attention(计算通信 100% 重叠),128K TTFT 骤降至 4.62 s(加速 6.9×);jemalloc 替换彻底根除 700GB 内存泄漏。 • Implemented PCP=8 Ring Attention (100% overlap, 0 bubble); 128K TTFT dropped to 4.62 s (6.9× speedup); jemalloc swap-in cured 700GB leak.
📈 阶段验收:[External][Alibaba][TPU] 推理优化周会 Milestone Acceptance: Alibaba TPU Weekly Sync 09/04 09:57 CST
参会专家:Qi Zhou, Amy Lin, Jun Wan, Wenzhe Zhou, Xiaohang Yu (HandsomeHow), Felix Li, Chi Shuen Lee, Jimmy Tsai, Eason Gao, Gang Ji, etc. Attendees: Qi Zhou, Amy Lin, Jun Wan, Wenzhe Zhou, Xiaohang Yu (HandsomeHow), Felix Li, Chi Shuen Lee, Jimmy Tsai, Eason Gao, Gang Ji, etc.
📋 9.04 联合验收评审议题9.04 Joint Acceptance Review
• 审查全局 Registry 性能压测达标报告;
• 对齐 PCP 性能与 TP2DP4 解码器高并发配置,验证流量削峰限流与多轮对话系统稳定性。
• Global registry benchmark report review; alignment on PCP performance & TP2DP4 decoder configs; verified throttling and multi-turn conversational stability under peak load.
验收结论Verdict
• 核心指标全线收敛达标,压测结果达到 NVIDIA GB200 基准 90% 吞吐上线要求,转入生产级金标验证。 • Core metrics fully converged; achieved >90% of NVIDIA GB200 baseline throughput; approved for production golden-standard qualification.
📊 6.18 阿里技术诉求 vs. 9.18 工业级落地进展 全景对照表 Alibaba 6.18 Tech Demands vs. 9.18 Production Deliverables Comparison
攻坚技术维度Dimension 6.18 联合对齐原始诉求与核心痛点6.18 Initial Demands & Bottlenecks 9.18 闭环落地工程方案9.18 Resolution & Implementation 实测交付收益与量化指标Measured Deliverable / Metric 关联核心资产Associated Asset
128K 长上下文计算墙 (TTFT) 128K Context Wall (TTFT) DP8 架构下处理 128K 序列面临严重 HBM 访存墙,单 Prefill 过程拖死整个集群,TTFT 耗时高达 32.0 秒,严重超标。 DP8 hits severe HBM bandwidth wall on 128K sequence; prefill throttles cluster, causing unacceptable TTFT of 32.0 s. Prefill 节点采用 PCP=8 + EP=8,把 128K 序列切成 8 个 16K 分片,利用 TPU 片上大容量 SRAM 绕开 HBM,并以 Ring Attention 实现通信与计算 100% 重叠(Bubble = 0 µs)。 Prefill runs PCP=8 + EP=8, chunking 128K sequence into eight 16K shards in SRAM, with Ring Attention completely overlapping compute and ICI comms (0 µs bubble). 128K TTFT 4.62 s
(相比 DP8 提速 6.9×)
128K TTFT 4.62 s
(6.9× speedup vs DP8)
专题三录像 🔗Topic 3 Video 🔗
MoE 512 细粒度专家路由 MoE 512-Expert Routing 512 个细粒度专家在 All-to-All 路由回传后,通用框架存在多次中间显存拷贝与 CPU 调度空洞,吞吐长期徘徊在 5,500 tok/s 以下。 512 fine-grained experts had multiple redundant intermediate HBM copies and CPU scheduling gaps after All-to-All, capping throughput below 5,500 tok/s. 合并 handsomehow/owner_output 特化直聚分支,让负责计算专家的 Owner Core 在本地原地完成输出汇聚(direct gathering),彻底消除冗余内存中转气泡。 Merged specialized handsomehow/owner_output branch; owner core computes output gathering locally in-place, eliminating intermediate copy bubbles. Decode 5,650 tok/s
(由 5,500 稳步提升达标)
Decode 5,650 tok/s
(Target achieved)
专题一录像 🔗Topic 1 Video 🔗
P/D 跨拓扑 DCN 传输 Inter-Slice DCN Transport Prefill 切片(PCP 拓扑)传输至 Decode 切片(TP·DP 拓扑)时,动态 resharding 触发海量 CPU/DMA 内存转置,DCN 单网卡吞吐严重受挫。 Moving KV cache from prefill (PCP) to decode (TP/DP) triggered heavy dynamic resharding transposes, severely choking cross-slice DCN throughput. 设计并部署 SEQ_ON_LANE 零拷贝内存布局,将 KV Heads 维度前置,使跨机 DMA 引擎能够以单一连续内存流直接推入 DCN 网卡。 Deployed SEQ_ON_LANE zero-copy layout, hoisting KV heads axis so cross-host DMA engine pushes contiguous streams directly into DCN NIC. DCN 峰值 >12.5 GB/s
(达 25 GB/s 线速 50%)
DCN Peak >12.5 GB/s
(50% of wire speed)
专题二录像 🔗Topic 2 Video 🔗
Host 内存泄漏治理 Host DRAM Leak Fix 早期压测中 8-device 整机 DRAM RSS 飙升至 ~700 GB 且长期不释放,导致后续 KV 管理服务(KVCM)无法拉起,系统濒临 OOM 崩溃。 Whole-node DRAM RSS climbed to ~700 GB across 8 devices and never freed, preventing KVCM from initializing and triggering system-level OOMs. ① 缩容 premapped VMA 配额(原 16 GiB);② 全面引入 jemalloc 替换 glibc 内存分配器;③ 完善 prefix-aware 动态加载逻辑。 (1) Shrunk premapped VMA quota (was 16 GiB); (2) Replaced glibc allocator with jemalloc; (3) Added prefix-aware dynamic memory loading. DRAM 稳定受控释放
(多轮长对话冒烟全通)
DRAM Stable & Released
(Multi-turn tests pass)
专题三纪要 🔗Topic 3 Notes 🔗
部署拓扑与并发容量 Topology & Concurrency 原先缺乏高性价比物理拓扑标准,社区方案甚至提出动用 64 芯片实例,成本极高且资源利用率严重不均衡。 Lack of standardized production topology; theoretical proposals assumed 64-chip instances, which were economically infeasible and unbalanced. 固化 1P1D(共 16 芯片) 部署形态:Prefill 采用 PCP8+EP8(8 芯片)→ Decode 采用 TP2·DP4·EP8(8 芯片),TP2 将 Dense 显存减半支撑 Batch=64 满并发。 Established 1P1D (16 chips total) topology: Prefill runs PCP8+EP8 (8 chips) → Decode runs TP2·DP4·EP8 (8 chips); TP=2 halves dense weights to allow full Batch=64 concurrency. 16 芯片对齐 1P1D
(TP2 All-Reduce 仅 85µs)
16-Chip 1P1D Pair
(TP2 All-Reduce 85 µs)
9.04 周会纪要 🔗9.04 Sync Notes 🔗
🔥 Qwen 3.5 专项工程优化体系复盘与量化战果 Qwen 3.5 engineering optimization campaign — retrospective and quantified results

Qwen 3.5 397B 在 Google Cloud TPU v7 上落地过程中,针对超长上下文算力墙、MoE 输出搬运气泡、跨机 Reshard 内存转置损耗、DRAM 内存泄漏等工业级痛点,实施了多项系统级与 Kernel 级攻坚,全面达成并超越压测指标: Bringing Qwen 3.5 397B up on Google Cloud TPU v7 ran into four production-grade walls — the long-context compute wall, MoE output-movement bubbles, cross-host reshard transpose overhead, and a DRAM leak. Each was attacked at the system or kernel level, and every stress-test target was met or beaten:

⚠ 标定基线⚠ Calibration baseline
本页所有实测值来自 bodaborg-tpu7x-nap (cloud-tpu-shared-capacity) · 2×4 拓扑 上的 8 芯片 prefill 节点 / 60 层混合架构(45 GDN + 15 GQA)压测。 这就是本文档的主口径 —— 上线部署形态为 Prefill 节点 PCP=8 + EP=8(8 芯片)→ Decode 节点 TP=2 × DP=4 + EP=8(8 芯片),一对共 16 芯片,不存在 64 芯片实例。 Decode 侧 5,650 tok/s 有文档背书(TP2DP4 + owner_output 分支,由 5,500 提升而来);11.20 ms/tok 则与实测 TPOT 25 ~ 28 ms 冲突,引用前请核对 Every measured figure on this page comes from a stress run on bodaborg-tpu7x-nap (cloud-tpu-shared-capacity) · 2×4 topology using an 8-chip prefill node on the 60-layer hybrid build (45 GDN + 15 GQA). That is the document's main configuration: the deployed form is a prefill node with PCP=8 + EP=8 (8 chips) feeding a decode node with TP=2 × DP=4 + EP=8 (8 chips) — 16 chips per pair, with no 64-chip instance. Decode's 5,650 tok/s is corroborated (TP2DP4 on the owner_output branch, up from 5,500); 11.20 ms/tok, however, conflicts with the measured TPOT of 25–28 ms — verify before quoting.
🏗️
1P1D 部署拓扑deployment topology (PCP8 ➔ TP2·DP4·EP8)
打破 128K 算力墙与 Decode 显存瓶颈 Breaks the 128K compute wall and the decode memory bottleneck
架构层Architecture
Prefill 采用 PCP8 + EP8:把 128K 序列拆成 8 个 16K 分片,用 TPU 片上大容量 SRAM 绕开 HBM 访存墙,再靠 Ring Attention 把计算与通信 100% 重叠。
Decode 采用 TP2 · DP4 · EP8 复合切分:相比 DP8,TP=2 让 Dense 权重显存减半,腾出空间支撑 Batch=64 满并发;片内高速总线使 TP2 All-Reduce 只需 ~85 µs
Prefill runs PCP8 + EP8: the 128K sequence is cut into eight 16K shards so the TPU's large on-chip SRAM sidesteps the HBM bandwidth wall, and ring attention then overlaps compute with communication completely.
Decode runs a composite TP2 · DP4 · EP8 split: against a plain DP8, TP=2 halves the dense-weight footprint, freeing room for a full batch of 64; the on-package bus keeps the TP2 All-Reduce at roughly 85 µs.
实测工程战果Measured result
128K TTFT 4.62 s(DP8 32 s → PCP8,6.9×,同 8 芯片) 128K TTFT 4.62 s (DP8 32 s → PCP8, 6.9×, same 8 chips)
MoE owner_output 特化直聚分支direct-gather branch
handsomehow/owner_output
Kernel 级Kernel
痛点:512 个细粒度专家在 All-to-All 路由回传后,通用框架里存在多次中间显存拷贝与 CPU 调度空洞。
方案:特化分支让计算该专家的 Owner Core 在本地原地完成输出汇聚(direct gathering),消除冗余的内存中转气泡。
Problem: after the All-to-All returns results from 512 fine-grained experts, the generic framework path performs several intermediate HBM copies and leaves CPU scheduling gaps.
Fix: a specialized branch has the owner core that computed each expert do the output gather in place, locally — removing the redundant staging copies and the bubble they create.
实测工程战果Measured result
Decode 吞吐 5,500 ➔ 5,650 tok/s(达标) Decode throughput 5,500 ➔ 5,650 tok/s (target met)
🚀
SEQ_ON_LANE 零拷贝内存布局zero-copy layout
重排 KV Cache 布局,赋能 DCN 直传 Relays out the KV cache so DCN can stream it directly
数据链路Data path
痛点:从 Prefill 切片(PCP 拓扑)传到 Decode 切片(TP·DP 拓扑)时,动态 resharding 触发大量 CPU/DMA 内存转置,严重拖慢网络吞吐。
方案SEQ_ON_LANE 布局把 KV Heads 维度前置,让跨机 DMA 引擎能以连续内存流直接推入 DCN 网卡。
Problem: moving KV from the prefill slice (PCP topology) to the decode slice (TP·DP topology) triggered dynamic resharding, and the resulting CPU/DMA transposes throttled network throughput badly.
Fix: the SEQ_ON_LANE layout hoists the KV-head axis to the front, so the cross-host DMA engine can push one contiguous stream straight into the DCN NIC.
实测工程战果Measured result
DCN 单网卡峰值 >12.5 GB/s(线速 25 GB/s 的 50%) Single-NIC DCN peak >12.5 GB/s (50% of the 25 GB/s line rate)
🛡️
DRAM RSS 泄漏治理与系统加固DRAM RSS leak containment
jemalloc 替换 + premapped VMA 调优 jemalloc swap-in + premapped VMA tuning
稳定性Stability
痛点:压测初期 8-device 整机 DRAM RSS 高达 ~700 GB 且长期不释放,导致后续 KVCM 拉不起来。
方案:① 针对性缩容 premapped VMA 配额(原 16 GiB);② 用 jemalloc 替换 glibc 分配器;③ 完善 prefix-aware 动态加载。
Problem: early in the stress campaign, whole-node DRAM RSS across 8 devices climbed to about 700 GB and never came back down, which left KVCM unable to start afterwards.
Fix: (1) shrink the premapped VMA quota (was 16 GiB) where it actually mattered; (2) replace the glibc allocator with jemalloc; (3) round out prefix-aware dynamic loading.
实测工程战果Measured result
DRAM 稳定受控释放,多形状 / 多轮对话冒烟全通 DRAM releases predictably; multi-shape and multi-turn smoke tests all pass
⚖️ 异构芯片工业级对决:Google TPU v7x vs. NVIDIA GB200 (Qwen 实测全景对标) Hardware Benchmark Showdown: Google TPU v7x vs. NVIDIA GB200 on Qwen Serving
🌐 EN / 中文

依据 2026-09 阿里与 Google 联合性能优化实测记录(包括 09-1409-18 最新 4-Host 跨机压测), 系统以 NVIDIA GB200 (NVLink 全互联拓扑) 作为生产级黄金基准(Golden Baseline)。 双方联合设定的生产上线目标为 达到 GB200 的 90% 吞吐。以下为端到端实测达成情况与深层微架构对账: Based on joint Alibaba-Google performance benchmarks (including 09-14 and the latest 09-18 4-Host cluster runs), the system benchmarks against NVIDIA GB200 (NVLink-connected topology) as the industrial Golden Baseline. The production deployment target is set at 90% of GB200 throughput. Below is the verified scorecard and architectural breakdown:

Prefill 吞吐对标 (单机 8 芯片 / 1P) Prefill Throughput (Single-Node 8 Chips / 1P)
58,000 tok/s
78.4% 达成率
GB200 黄金基准: 74,000 tok/sGB200 Baseline: 74,000 tok/s
上线目标 (90%): 66,600 tok/s (74k × 0.9)Target (90%): 66,600 tok/s
TPU 实测: 58,000 tok/s (MoE 拆两段异步重叠优化)TPU Actual: 58,000 tok/s (2-stage MoE overlap)
Decode 吞吐对标 (单机 8 芯片 / 1D) Decode Throughput (Single-Node 8 Chips / 1D)
5,650 tok/s
85.6% 达成率
GB200 黄金基准: 6,600 tok/s (单卡 54 tok/s)GB200 Baseline: 6,600 tok/s (54 tok/s/chip)
上线目标 (90%): 5,940 tok/s (极度逼近目标线!)Target (90%): 5,940 tok/s (Close to target!)
TPU 实测: 5,650 tok/s (TP2·DP4·EP8 + owner_output 分支)TPU Actual: 5,650 tok/s (TP2DP4EP8 + owner_output)
128K 超长单请求首字延迟 (TTFT) 128K Single-Stream Long Context TTFT
4.62 ~ 4.70 s
~105% 微幅反超
GB200 实测: ~5.0 s (NVLink All-to-All 通信开销)GB200: ~5.0 s (NVLink all-to-all latency)
TPU DP 拓扑: 32.0 s (无序列切片,单卡算力严重过载)TPU DP: 32.0 s (Overloaded without sequence slicing)
TPU PCP8 环形拓扑: 4.62 s (ICI 纯硬件流动,时延反超 GPU)TPU PCP8: 4.62 s (Pure ICI pipelining beats GPU)
核心维度Dimension Google TPU v7x (Trillium / Ironwood)Google TPU v7x (Trillium) NVIDIA GB200 (Blackwell NVL72)NVIDIA GB200 (Blackwell NVL72)
计算核心 & GEMM 机制Compute Core & GEMM 256×256 脉动阵列 (MXU)
对 Qwen 3.5 纯 256 头维天然 100% 占满脉动格,零 Padding、零调度气泡;静态编译确定性时序。
256×256 Systolic Matrix Unit (MXU)
Naturally 100% saturated by Qwen 3.5's 256 head dim; zero padding, deterministic timing.
第 5 代 NVFP4 / FP8 Tensor Cores
理论密集 FLOPs 极高,Prefill 峰值算力占优;但需依赖 Warp 动态调度与 SM 资源抢占。
5th-Gen NVFP4 / FP8 Tensor Cores
Higher raw theoretical FLOPs in prefill, but relies on dynamic Warp scheduling & SM occupancy.
互联架构与通信域Interconnect & Domain ICI 2D Torus 直连环网 (Scale-up 至数千芯)
专为环形流水设计,PCP 序列切片通信 100% 隐藏于 MXU 算力下;单跳带宽略低于 NVLink 但超大域内零路由仲裁抖动。
ICI 2D Torus Direct Ring (Scales to 9k+ chips)
Designed for ring pipelining; PCP comms perfectly hidden behind compute; zero jitter across thousands of chips.
NVLink 5 铜缆全互联 (1.8 TB/s 双向)
机柜内 72 卡任意点对点低延迟 All-to-All;但跨机柜扩展需跨 IB/RoCE 网络,延迟陡增。
NVLink 5 Copper Mesh (1.8 TB/s bi-directional)
Ultra-fast low-latency all-to-all across up to 72 GPUs, but crosses high-latency InfiniBand/RoCE beyond rack.
MoE 专家调度与寻址MoE Routing & Dispatch 独立硬件协处理器 (SparseCore)
硬件级执行 Top-K 寻址路由与 Gather-Reduce-v3,主 MXU 核心 0 气泡;结合 owner_output 实现专家原地汇总。
Dedicated SparseCore Coprocessor
Offloads Top-K routing & Gather-Reduce-v3 entirely from MXU; uses owner_output for in-place expert reduction.
SM 核心通用线程调度 Gather/Scatter
在高并发长文本下容易出现非连续访存(Strided Memory Access)导致的 HBM 带宽打折。
GPU SM Kernel Gathering/Scattering
Prone to HBM bandwidth degradation under heavy concurrent token routing due to strided memory access.
显存容量与长文安全线Memory & Context Ceiling 96 GB HBM / 芯
通过 PCP8 环形切片将 128K KV Cache(1.92 GB)均匀压缩为 240 MB / 卡,结合 Host DRAM 动态流转彻底杜绝 OOM。
96 GB HBM / Chip
PCP8 slices 128K KV Cache (1.92 GB) down to 240 MB/chip; safe DRAM offloading completely eliminates OOM.
192 GB HBM3e / 芯
单卡容量极大,但在纯 DP 模式下高并发长文本仍会迅速触碰显存红线,需要大规整 KV 分块调度。
192 GB HBM3e / GPU
Enormous per-GPU capacity, but pure DP serving under heavy concurrent long context still exhausts HBM.
⚡ 2026-09-18 最新实测突破:4-Host 跨节点通信瓶颈与 PCP8 PP4 破局解法

跨机通信挑战(09-18 最新实测):当集群扩展至 4-Host(32 芯片)时,Prefill 吞吐从单机的 84k 跌落至 44k tok/s(预期 60k)。 周会纪要明确指出根因:节点超过 2-Host 后物理不再是全互联,Z 轴集合通信带宽不足严重拖累了 Fused MoE Token All-Gather
架构破局解法(流水线并行介入):阿里与 Google 团队联合推演并测试了 `PCP8 PP4`(流水线 + 环形混合并行) 方案: 相比单机 PP8(吞吐 80k、TTFT ~3s+),`PCP8 PP4` 在 4-Host 下不仅跑出了每 Rank 20k 的均衡吞吐,更将 TTFT 极速压减至 1.6 s,成功消除了非全连接拓扑下的通信气泡!
Multi-Host Bottleneck (09-18 Latest Finding): When scaling to 4-Host (32 chips), prefill dropped from 84k to 44k tok/s (target 60k). Joint analysis identified the root cause: beyond 2-Host the physical mesh is not fully connected, and insufficient Z-axis bandwidth throttles Fused MoE Token All-Gather.
Architectural Solution (Pipeline Parallelism Hybrid): Joint teams benchmarked `PCP8 PP4` (Pipeline + Ring Hybrid): Compared to single-node PP8 (80k tok/s, TTFT ~3s+), `PCP8 PP4` across 4 hosts achieves balanced 20k/rank throughput while slashing TTFT down to 1.6 s, effectively banishing communication bubbles in non-fully-connected fabrics!

📋 上线冲刺 PR 看板(2026-09-14 快照,状态校正至 09-17) 📋 Launch-sprint PR board (2026-09-14 snapshot, statuses corrected to 09-17)

⚠ 「是否阻塞上线」是这张表最关键的一列,切勿省略 ⚠ "Blocks launch?" is the most important column here — do not drop it
下表逐行对应联合优化记录中「Qwen3.5 397B 上生产」跟踪表。PR 编号凡记录中未给出的,均按私有库 vllm-torchtpu 实际合入情况回填并标注。 Each row maps to the "Qwen3.5 397B to production" tracking table in the joint-optimization record. Where the record gave no PR number, it has been back-filled from the private vllm-torchtpu history and marked as such.
工作项Item 优先级Pri PR / BugPR / bug 状态Status 阻塞上线?Blocks launch?
PCP SEQ_ON_LANE 代码合入PCP SEQ_ON_LANE landed P0 #608 / #606 / #750 (HND) 已合入merged yes
FusedMoE v2 NVFP4 + W4A8 合入FusedMoE v2 NVFP4 + W4A8 landed P0 #912 已合入merged yes
marconi-prefix-cache 使能(混合模型前缀缓存)marconi-prefix-cache enablement (hybrid-model prefix cache) P1 #765 完成done no
MTP 性能优化合入(batched_rpa long ctx + SEQ_ON_LANE)MTP perf work (batched_rpa long ctx + SEQ_ON_LANE) P0 #1008 (refactor #994) 已于 09-15 合入merged 09-15
(原表 09-14 记为「评审中」,现已过期)(the 09-14 table said "in review"; now stale)
yes
torchtpu mesh / runtime partition 修复torchtpu mesh / runtime partition fix P0 #952 📝 draft,存在正确性问题draft, correctness issues yes
PCP8 ➔ DP4TP2 KV transfer 验证 + 合入PCP8 ➔ DP4TP2 KV transfer validation + landing P0 b/561770137 🚧 被 #952 阻塞blocked by #952 是(上线部署形态)yes (this is the deployed form)
Raiden 双网卡功能交付(400 Gbps)Raiden dual-NIC delivery (400 Gbps) P0 b/558565285 · #839 阻碍;Multi-NIC 仍在排查 C=1 问题,PR 未合入blocked; Multi-NIC C=1 still under investigation, PR not merged yes
Raiden KV cache HBM ↔ DRAM 全量映射修复Raiden KV-cache HBM ↔ DRAM full-mapping fix P0 b/525910811 🚧 进行中in progress yes

🛡️ 容灾与长稳:已修 / 未修 / 待测 🛡️ Resilience and long-run stability: fixed / open / still to verify

⚠ 请勿把这一组笼统表述为「容灾体系已建成、零内存泄漏」 ⚠ Do not summarize this group as "resilience complete, zero memory leaks"
截至 2026-09-18 的稳定性测试记录中,四项里只有一项半是已完成状态。 In the 2026-09-18 stability-test record, only one and a half of these four are actually complete.
场景Scenario 真实状态Actual status 依据Evidence
Decode 阶段 client abort 的 KV / 请求泄漏KV / request leak on client abort during decode 已修复fixed #1039 (Raiden Stage-3 抢占路径)(Raiden Stage-3 preemption path)
Prefill 阶段 client abort 的 KV block 释放KV-block release on client abort during prefill 仍未解决still open 「Raiden KV Connector 不释放已中止请求的 KV block」——记录中为未关闭项"Raiden KV Connector won't release aborted requests' KV blocks" — open in the record
KV transfer 租约到期 / 超时处理KV-transfer lease expiration / timeout handling 是待办工作流,不是已建成的熔断机制;下挂两个未关闭缺陷an open workstream, not a delivered circuit breaker; two open defects under it Prefill 过早驱逐未被拉取的 KV block;缺少 client abort 时的主动 KV block 撤回prefill prematurely evicts unpulled KV blocks; no active KV-block revocation on client abort
长时间超限流量压测(2 小时)Prolonged over-capacity stress test (2 hours) 🧪 待验证,且已暴露 tpu-sync 线程栈映射泄漏to be verified; already surfaced a thread-stack-map leak in tpu-sync 测试口径原文是「QPS 超过服务端吞吐,排队请求数保持稳定且无 OOM / 泄漏」,并无「120% 理论吞吐」这一指标the spec reads "QPS above the server's throughput; queued-request count stays stable with no OOM or leak" — there is no "120% of theoretical throughput" metric
Raiden controller / vLLM worker 崩溃恢复Raiden controller / vLLM worker crash recovery 已通过passed 稳定性测试 4.1 / 4.2stability test 4.1 / 4.2

🔭 Qwen 3.8-Max 前瞻(9/30 机器交付后上线) 🔭 Qwen 3.8-Max outlook (launch after the 9/30 hardware delivery)

🧭
部署形态:PCP16·TP2 ➔ DCP32Deployment: PCP16·TP2 ➔ DCP32
32 ~ 64 device,CP16/32 + TP2 组合 32–64 devices, CP16/32 combined with TP2
架构层Architecture
PCP16TP2 与 TP32DCP8 两种形态均已拉起,最终部署形态定为 PCP16TP2 ➔ DCP32;PD 分离侧目前判断不需要 Raiden 改动b/562357557)。
DCP kernel 已存在,处于验证阶段(非从零原型);DCP + HND 的 PR 在途,VMEM 预估计算存在问题
• GDN 支持 Q/K 头复制#1082)、DCP 支持 HNDDCP for GQA#831)、#893 共用 PCP 的 group-layout / mesh 辅助函数。
Both PCP16TP2 and TP32DCP8 have been brought up; the final deployed form is PCP16TP2 ➔ DCP32, and the PD-disaggregation side currently looks like it needs no Raiden changes (b/562357557).
The DCP kernel already exists and is in validation — not a from-scratch prototype; the DCP + HND PR is in flight and its VMEM estimation is wrong.
• GDN gains Q/K head replication (#1082), DCP supports HND, DCP for GQA (#831), and #893 shares PCP's group-layout / mesh helpers with the DCP axis.
当前实测Measured so far
4host prefill 44k tok/s(目标 60k,差 27%) 4-host prefill 44k tok/s (target 60k — 27% short)
已知阻塞(上线前必须解决)Known blockers before launch
这几项在乐观版本的材料里常被略去 Routinely omitted from the optimistic version of this slide
风险Risk
Fused MoE token all-gather 性能退化严重:4 host 下 Z 轴带宽不足,影响端到端约 30% 性能,记录中标注「暂时无解」(P1)。
4 host 集合通信整体下降:超过 2 host 后拓扑不再是全连接,prefill 吞吐因此只到 44k tok/s。
Fused MoE v2 自适应双 buffer 尚未开发完:原型(W1×2 + W2×1 buffer)验证完成,自适应部分仍缺,阻碍 3.8 上线
Qwen 3.8 fused MoE + TP2 限制虽已放开,但存在重算性能问题PCP16TP2 仍有正确性问题(涉及 #414)。
Fused-MoE token all-gather regresses badly: at 4 hosts the Z-axis bandwidth is insufficient, costing roughly 30% of end-to-end performance, and the record marks it "no solution for now" (P1).
Collectives degrade across 4 hosts: past 2 hosts the topology is no longer fully connected, which is why prefill tops out at 44k tok/s.
Adaptive double-buffering in fused MoE v2 is unfinished: the prototype (W1×2 + W2×1 buffer) validated, but the adaptive half is missing — this gates the 3.8 launch.
Qwen 3.8 fused MoE + TP2 is unblocked but has a recompute performance problem, and PCP16TP2 still has correctness issues (involving #414).
对外汇报注意If you present this
「Marconi 降低 TTFT 60%」「dispatch −25%」「120% 过载 2 小时」三项在记录中均无出处 "Marconi cuts TTFT 60%", "−25% dispatch", "2 h at 120% overload" have no source in the record
💡 Qwen 3.5 config.json 参数矩阵与「人生哲学」隐喻指南 Qwen 3.5 config.json parameter matrix, read as a set of life metaphors 对齐本文档主口径Aligned to the main configuration
超参数不只是冰冷的数字,它们其实描述了一种心智模型与处世态度
下面按四大领域(基础骨干、注意力与记忆、细粒度 MoE、动态采样解码)逐项列出:每个参数的技术物理实质放在下半张卡,人生隐喻放在上半张卡,两者一一对应。
Hyperparameters are not just cold numbers — together they describe a way of thinking and of meeting the world.
Four domains follow (backbone, attention and memory, fine-grained MoE, sampling and decoding). On each card the engineering reality sits at the bottom and the life metaphor at the top, one mapped onto the other.
⚠ 口径说明⚠ Which configuration these numbers describe
⚠ 已按联合优化文档修正架构口径:实际部署的 Qwen 3.5 是混合架构 —— 约 15 层 full-attention (GQA) + 45 层 GDN 线性注意力,共 60 层(文档 prefill 分层实测:full 492 µs × 15 / linear 774 µs × 45 / MoE 1.41 ms × 60),GDN 并非某条实验分支上的可选优化,而是模型本身的组成部分。 其余架构参数为 96 Q 头 / 32 KV 头 (3:1) · head_dim 128 · hidden_size 4096 · vocab 248,320 · 512 专家 Top-8。 KV 只由 FA 层产生:15 × 32 × 128 × 2 × 131072 = 15 GiB/请求 (FP8),摊到 8 卡即单卡 1.875 GiB(实测记作 1.92 GB)。若误按 60 层甚至 80 层全部计 KV,会高估 4 ~ 5.3 倍。 采样段(temperature / top_p / top_k / presence_penalty / context_window / speculative_tokens)取自 generation_config.json 默认值,可拖动滑块实时体会。 ⚠ Architecture corrected against the joint-optimization record: the Qwen 3.5 actually deployed is a hybrid — roughly 15 full-attention (GQA) layers plus 45 GDN linear-attention layers, 60 in total (the record's measured prefill breakdown: full 492 µs × 15, linear 774 µs × 45, MoE 1.41 ms × 60). GDN is not an optional optimization on some experimental branch; it is part of the model. The remaining architecture figures are 96 Q heads / 32 KV heads (3:1) · head_dim 128 · hidden_size 4096 · vocab 248,320 · 512 experts, Top-8. Only the FA layers produce KV: 15 × 32 × 128 × 2 × 131072 = 15 GiB per request in FP8, or 1.875 GiB per chip across 8 chips (recorded as 1.92 GB). Counting all 60 — let alone all 80 — layers overstates KV by 4× to 5.3×. The sampling section (temperature / top_p / top_k / presence_penalty / context_window / speculative_tokens) comes from generation_config.json defaults; drag the sliders to feel each one.
🏗️ 第一领域:模型骨干与容量底座 🏗️ Domain 1 — Backbone and capacity —— 先天的身躯骨架、认知通道宽度与思维反刍深度 — the frame you were born with: how wide your channels are, how many times you turn a thought over
hidden_size (d_model)
残差流主干道向量维度Width of the residual-stream highway
4096
🧘 人生隐喻:心胸宽广与思维气量🧘 Metaphor: how much you can hold at once
主干道的宽度就是你的气量。道越宽(4096),能并行容纳的思维分支越多——理性、感性、道德与直觉并存不悖;气量窄(比如 1024),再宏大的思考塞进来也只会撞成一场思想上的交通堵塞。 The width of the highway is how much you can carry at once. Wide (4096) means many lines of thought run side by side — reason, feeling, conscience and instinct all fit. Narrow (say 1024) and however grand the thought, it arrives as a traffic jam.
⚙️ 底层原理:Reality: 决定 embedding 与每层输入输出张量的尺寸 [B, T, 4096]。4096 = 32 × 128,是 MXU 通道宽度的整数倍,GEMM 收缩维无 padding 损耗。 Sets the embedding and per-layer tensor shape [B, T, 4096]. 4096 = 32 × 128 is an exact multiple of the MXU lane width, so the GEMM contraction dimension wastes no padding.
num_hidden_layers
Transformer Block 堆叠总层数 · 15 层 FA + 45 层 GDNStacked transformer blocks · 15 FA + 45 GDN
60
📜 人生隐喻:阅历的沉淀与反刍📜 Metaphor: turning experience over
60 层意味着一句话要经历 60 轮抽象与再抽象。只有几层的网络像涉世未深的孩子,只看得见字面;反复萃取几十轮的大脑,才能穿过表象直击本质。当然,每一次深思都要花时间——这正是深度与延迟之间那笔永恒的交易。 Sixty layers means every sentence is abstracted and re-abstracted sixty times. A shallow network is a child who reads only the literal words; dozens of rounds of distillation is what it takes to see past the surface. Each round costs time, of course — that is the standing trade between depth and latency.
⚙️ 底层原理:Reality: 实际部署的是 60 层混合架构:15 层 full-attention (GQA) + 45 层 GDN 线性注意力,每层各自执行 RMSNorm、QK-Norm、注意力、残差与 MoE 路由。只有 FA 层产生 KV Cache:15 × 32 KV 头 × 128 × 2(K,V) × 131072 ≈ 15 GiB / 请求 (FP8)。若误把 60 层全部计入则为 60 GiB,按 80 层全 GQA 计则为 80 GiB —— 都是高估。 What is deployed is a 60-layer hybrid: 15 full-attention (GQA) layers plus 45 GDN linear-attention layers, each running RMSNorm, QK-Norm, attention, the residual add and MoE routing. Only the FA layers produce KV cache: 15 × 32 KV heads × 128 × 2 (K,V) × 131072 ≈ 15 GiB per request in FP8. Counting all 60 layers would give 60 GiB, and all 80 as GQA would give 80 GiB — both overstate it.
vocab_size
多语言与代码词表总规模Multilingual + code vocabulary
248,320
🌍 人生隐喻:表达与涉猎的广度🌍 Metaphor: the breadth of what you can name
词表是你一生中能辨识并说出口的概念总和。24.8 万个 token,是数百种语言、各类代码、数学符号与艺术隐喻的底气。见过星辰大海的人,面对再复杂的问题也总能找到那个恰好的词。 The vocabulary is the sum of everything you can recognize and put into words. 248,320 tokens covers hundreds of languages, code, mathematical notation and figurative language. Someone who has seen that much can usually find the exact word for a hard thing.
⚙️ 底层原理:Reality: embedding 矩阵与 LM Head 的分类维度,形状 [248320, 4096],BF16 下单个矩阵即 1.89 GiB。LM Head 的 fusion.988 就是在这个维度上做最终投影。 The classification dimension of both the embedding matrix and the LM head, shaped [248320, 4096]1.89 GiB per matrix in BF16. The LM head's fusion.988 projects onto exactly this axis.
tie_word_embeddings
输入嵌入与输出投影是否共享权重Whether input embedding and output projection share weights
false
🌱 人生隐喻:不忘初心 vs 游刃有余🌱 Metaphor: staying true vs. growing into range
绑定(true)意味着「我出发时理解的词义,和我最终说出口的判断,必须锁在同一个模具里」——质朴、省事。解耦(false)则允许「听得懂」和「说得出」各自长成不同的本事:既有聆听的敏锐,也有表达的练达。 Tying (true) says "what a word meant to me on the way in must be the same thing I mean on the way out" — simple and frugal. Untying (false) lets listening and speaking grow into separate skills: one sharp at taking things in, the other fluent at giving them back.
⚙️ 底层原理:Reality: 控制是否复用 embed_tokens.weight 作为 lm_head.weight。解耦多占 1.89 GiB 权重,换来更高的表征自由度与生成准确率。 Controls whether embed_tokens.weight is reused as lm_head.weight. Untying costs an extra 1.89 GiB of weights and buys representational freedom and generation accuracy.
rms_norm_eps
均方根归一化的数值平滑量Numerical floor inside RMSNorm
1e-06
⚖️ 人生隐喻:为人处世的容错缓冲⚖️ Metaphor: the slack you keep for yourself
防止除零崩溃的那个极小常数 ε,就像做人必须留的那 0.000001 的弹性底线。若毫无容错(ε = 0),一旦遇上归零式的打击,心态会瞬间炸成无穷大或 NaN。 The tiny constant that keeps a division from blowing up is the 0.000001 of slack a person has to keep. With none of it (ε = 0), the first blow that takes you to zero sends everything to infinity or NaN at once.
⚙️ 底层原理:Reality: y = x / sqrt(mean(x²) + ε) ⊙ γ。该常数保证激活在整条浮点链路上不会除以零,杜绝 NaN 传播。Qwen 还在 Q/K 上各加了一次 QK-Norm,用同一个 ε。 y = x / sqrt(mean(x²) + ε) ⊙ γ. The constant keeps activations from dividing by zero anywhere along the float path, so no NaN propagates. Qwen additionally applies QK-Norm to Q and K, using the same ε.
⚡ 第二领域:注意力与长距记忆 ⚡ Domain 2 — Attention and long-range memory —— 如何分配精力:哪些是过眼云烟,哪些值得刻在记忆里 — how attention gets rationed: what passes through, and what gets kept
num_attention_heads
Query 观察头数Query heads
96
👁️ 人生隐喻:看待问题的多维视角👁️ Metaphor: how many angles you see from
96 个 Query 头,意味着同时从 96 个切面审视眼前这件事:逻辑的拆解、共情的体悟、道德的审视、利弊的权衡。视角单一的人容易钻牛角尖,多头并进才看得清全貌。 Ninety-six query heads means looking at the same moment from ninety-six angles at once: the logical reading, the empathetic one, the ethical one, the practical one. One angle is how you end up stuck in a corner; many is how the whole shape becomes visible.
⚙️ 底层原理:Reality: Q 投影把 4096 维升到 96 × 128 = 12288 列;本段 trace(TP=8 变体)每卡拿到 12 个 Q 头(slice.7534[0:1536]);上线的 PCP=8 形态下注意力权重是复制的,每卡仍持 96 头、只切序列;Decode TP=2 时每卡 48 个头。 The Q projection lifts 4096 up to 96 × 128 = 12288 columns. In this trace (the TP=8 variant) each chip holds 12 Q heads (slice.7534 takes [0:1536]); in the deployed PCP=8 form attention weights are replicated, so every chip keeps all 96 heads and only the sequence is split. At decode TP=2 each chip holds 48.
num_key_value_heads
GQA 分组键值头数(3:1)GQA key/value heads (3:1)
32
🗂️ 人生隐喻:抓住主干的记忆提炼术🗂️ Metaphor: keeping only the index, not the archive
审视的视角有 96 个,真正刻进记忆的钥匙只有 32 把——每 3 个 Query 头共用一组 Key/Value。人不需要给每一个念头都单独立档备份;懂得提纲挈领,记忆的负担立刻轻下来一大半。 Ninety-six angles of looking, but only thirty-two keys actually filed away — every three query heads share one key/value group. Not every passing thought needs its own archive; keeping just the index is what makes a long memory affordable.
⚙️ 底层原理:Reality: Grouped-Query Attention 3:1 分组。相比 96 头 MHA,KV Cache 直接降到 1/3;128K 请求下 15 层 FA 的 FP8 KV 仍需 约 15 GiB(单卡 1.875 GiB × 8),这也是必须做 PD 分离与 KV 卸载的根本原因。 Grouped-query attention at 3:1. Against full 96-head MHA the KV cache drops to one third — yet a 128K request still needs about 15 GiB in FP8 across the 15 FA layers (1.875 GiB per chip × 8), which is precisely why PD disaggregation and KV offload exist at all.
head_dim
单头特征向量深度Per-head feature depth
128
🎯 人生隐喻:每个视角能看多深🎯 Metaphor: how deep each angle goes
头数决定看问题的角度多少,head_dim 决定每个角度能看多。128 维是个务实的折中:够承载一个语义子空间,又不至于让注意力矩阵的开销失控。广度与深度之间,总得有人先让一步。 Head count decides how many angles you have; head_dim decides how far each one sees. 128 is the pragmatic middle — enough to carry a semantic subspace, not so much that the attention matrices become unaffordable. Breadth and depth always negotiate.
⚙️ 底层原理:Reality: 注意力核心算 Softmax(Q·Kᵀ / √128)·V注意这里有真实损耗:head_dim = 128 只填满 TPU v7 那 256 宽 MXU 的一半,Q·Kᵀ 这一步的形状对齐并不完美——它是本文档里少数几处硬件利用率没跑满的地方。 The attention core computes Softmax(Q·Kᵀ / √128)·V. There is a genuine cost here: head_dim = 128 fills only half of the v7's 256-wide MXU, so the Q·Kᵀ step is not perfectly shape-aligned — one of the few places in this document where the hardware is not fully fed.
GDN 线性循环层占比GDN linear-recurrent layer share
门控 Delta 网络层数分布 · 即为实际部署架构 Gated delta net distribution · this is the deployed architecture
45 / 60 (75%)
🍃 人生隐喻:断舍离的智慧🍃 Metaphor: the wisdom of letting go
混合架构里最有想法的一条哲学:75% 的层都是线性循环层。琐事如过眼云烟,状态随时间恒定更新、零写回、不堆积。学会及时放下不重要的枝节,哪怕读到第 128K 个字,脚步依然轻快。 The most opinionated idea in the hybrid build: three quarters of the layers are linear-recurrent. Small things pass through; the state updates in constant space, never written back, never piling up. Let the unimportant go in time and you are still walking lightly at token 128,000.
⚙️ 底层原理:Reality: 45 层 Gated Delta Net 维护 O(1) 恒定状态,长文本不产生膨胀的 KV Cache。FP8 把 128×128 状态压到 16 KB 后完全锁在 VMEM 内,实测该算子 4,120 µs → 840 µs(4.9×)GDN 是模型本身的组成部分——实际部署的 60 层中有 45 层是 GDN,只有 15 层 full-attention 产生 KV Cache。 Forty-five gated-delta-net layers hold an O(1) state, so long inputs never inflate a KV cache. FP8 shrinks the 128×128 state to 16 KB, small enough to pin in VMEM; measured, the operator goes 4,120 µs → 840 µs (4.9×). GDN is part of the model itself — 45 of the 60 deployed layers are GDN, and only the 15 full-attention layers produce KV cache.
rope_theta
旋转位置编码基频Rotary position encoding base frequency
1,000,000
🌌 人生隐喻:看透沧海桑田的岁月感🌌 Metaphor: a sense of time long enough to hold the whole story
基频高达一百万,如同拥有看穿漫长周期的眼力。哪怕是几万字之前一句极轻的伏笔,经过百万周期的相位沉淀,此刻依然能被精准地共鸣到。 A base of a million is the kind of long sight that takes in an entire arc. A faint line dropped tens of thousands of tokens ago still resonates precisely now, because a million cycles is slow enough that its phase has not blurred.
⚙️ 底层原理:Reality: θ = 10⁶ 使高频与低频分量在 128K~256K 序列下都不发生相位混叠,长文外推能力显著优于 θ = 10⁴。RoPE 在 Q-Norm / K-Norm 之后、注意力之前逐头施加。 θ = 10⁶ keeps high- and low-frequency components from aliasing across 128K–256K sequences, extrapolating far better than θ = 10⁴. RoPE is applied per head after Q-Norm / K-Norm and before attention.
🔀 第三领域:细粒度 MoE 与社会分工 🔀 Domain 3 — Fine-grained MoE as a division of labour —— 没人能成为全才,但群体智慧可以被动态协同放大 — nobody knows everything, but a crowd routed well can
num_experts (n_routed)
细粒度路由专家总数Total fine-grained routed experts
512
🏛️ 人生隐喻:百花齐放的专业社会🏛️ Metaphor: a society of specialists
模型内部住着 512 位各有所长的专家:有专修 bug 的工匠,有吟诗作对的文人,有钻研数学的精算师,有洞察人性的旁观者。分工越细,每个人越能在自己的那一小块地里做到极致。 Inside the model live 512 specialists: one fixes bugs, one writes verse, one does the arithmetic, one reads people. The finer the division, the further each can go in their own small patch of ground.
⚙️ 底层原理:Reality: 512 个前馈网络并发待命,总参数 397B。EP=8 下每卡常驻 64 个专家,路由通过 all-to-all.18/19 派发与回收。 512 feed-forward networks stand by, 397B parameters in total. At EP=8 each chip hosts 64 experts, and routing dispatches and collects through all-to-all.18/19.
top_k_experts
单 Token 激活的专家数Experts activated per token
8
🤝 人生隐喻:知人善任与精简决策🤝 Metaphor: calling the right few, not everyone
遇到具体问题时,明白人不会把 512 个人都叫来开会,只精准请来最在行的 8 位。会开得小,事办得快,力气也没白费。 Faced with an actual problem, the sensible move is not to summon all 512 — just the eight who know the subject. Small meeting, quick decision, no effort wasted.
⚙️ 底层原理:Reality: 路由网络 fusion.815 对 512 个专家打分并取 Top-8,再经 All-to-All 派发。专家输出回到宿主卡后由 owner_output 分支原地加权聚合,不再申请临时显存。 The router fusion.815 scores all 512 experts, takes the top 8, and dispatches via All-to-All. Results return to the owner chip, where the owner_output branch combines them in place with no staging allocation.
n_shared_experts
所有 Token 必经的共享专家Shared expert every token passes through
1
🧱 人生隐喻:共同的底色与常识🧱 Metaphor: the common ground underneath
无论一个 token 被派到多偏门的专家那里,它都得先走一遍这位共享专家。这就像一个群体共同持有的常识与默契:没有这层托底,社会会因为过度碎片化而失去彼此理解的能力。 However specialized the expert a token gets routed to, it passes through the shared one first. That is the common sense a group holds jointly — without it, specialization fragments into people who can no longer understand each other.
⚙️ 底层原理:Reality: 所有 token 必经的基础 FFN,d_ff = 5632(是单个路由专家 1408 的 4 倍),负责吸收最高频的通用语言与语法逻辑,避免动态门控出现常识盲区。 A base FFN on every token's path with d_ff = 5632 — four times a routed expert's 1408 — absorbing the highest-frequency grammar and general language so the dynamic gate never has a blind spot on the obvious.
moe_intermediate_size
单个路由专家的中间维度Hidden width of one routed expert
1408
🛠️ 人生隐喻:一技之长的工匠精神🛠️ Metaphor: one metre wide, a thousand metres deep
专家不需要臃肿,1408 维刚好。与其样样通样样松,不如在属于自己那一米宽的地方,挖到一千米深。 A specialist does not need to be large; 1408 is enough. Better to dig a thousand metres down in your own metre of ground than to skim everywhere.
⚙️ 底层原理:Reality: SwiGLU 结构下每个专家有 gate / up / down 三个矩阵:[4096, 1408] ×2[1408, 4096]。维度小意味着 All-to-All 搬运的张量体积小,EP8 通信可压在毫秒级以内。 Under SwiGLU each expert carries gate / up / down matrices: [4096, 1408] ×2 and [1408, 4096]. Keeping the width small keeps the All-to-All payload small, which is what holds EP8 communication under a millisecond.
激活稀疏度Activation sparsity
单次前向真正动用的比例Fraction of the model a single token wakes
8/512 = 1.56%
🧘‍♂️ 人生隐喻:大智若愚与省力之道🧘‍♂️ Metaphor: quiet on the surface, exact when it moves
每个 token 只唤醒 1.56% 的专家。 从外面看,大半个脑子仿佛都在打盹;但这恰恰是高手的状态——平时深藏不露,出手时一击中的,一分力气都不浪费。 Each token wakes just 1.56% of the experts. From outside, most of the mind looks asleep — which is exactly the state of someone good at this: still by default, and when it moves, it moves once and precisely.
⚙️ 底层原理:Reality: 路由层面 8 / 512 = 1.56%。但注意力、共享专家与 LM Head 是稠密的,所以按参数算是 17B 激活 / 397B 总量 ≈ 4.3%。两个数字分别回答「专家稀疏度」与「每 token 实际算力」,不要混用。 At the routing layer, 8 / 512 = 1.56%. Attention, the shared expert and the LM head are dense, though, so by parameter count it is 17B active out of 397B ≈ 4.3%. The two numbers answer different questions — expert sparsity versus actual work per token — so don't substitute one for the other.
🎲 第四领域:动态生成与处世态度 🎲 Domain 4 — Sampling, or how you decide —— 面对不确定的世界,一个人如何决断、取舍与表达(可拖动) — facing an uncertain world: how you choose, what you drop, how you say it (draggable)
temperature
采样随机性与发散倾向Sampling randomness
创造力开关Creativity dial
当前设定值:Current value: 0.70
🔥 人生隐喻:热忱的体温🔥 Metaphor: your running temperature
温度是你对待世界的发散性与童心。温度适中时你风趣而有主见;过低如同一块冰冷的钟表,分毫不差却也毫无生气;过高则像发着高烧,妙语连珠的背后其实是神志不清。 Temperature is how loosely you hold the world. In the middle you are witty and still your own person; too low and you are an accurate clock with nothing alive in it; too high and the brilliant phrases are really just fever.
0.0 — 谨小慎微的老会计,每句话都绝对确定,毫无意外。 a careful old accountant: every sentence certain, nothing unexpected.
2.0 — 喝了三瓶威士忌的诗人,满纸荒唐言。 a poet three bottles in: every page inspired, none of it usable.
⚙️ 底层原理:Reality: 作用在 logits 的除数上:P(wᵢ) = exp(zᵢ/T) / Σ exp(zⱼ/T)。T → 0 坍缩为贪婪解码(argmax),T → ∞ 退化为均匀随机。 Divides the logits: P(wᵢ) = exp(zᵢ/T) / Σ exp(zⱼ/T). As T → 0 it collapses to greedy decoding (argmax); as T → ∞ it degenerates to a uniform draw.
top_p (nucleus)
累积置信度截断Cumulative-probability cutoff
格局与视野Breadth of ear
当前设定值:Current value: 0.90
🔭 人生隐喻:愿意听多少种声音🔭 Metaphor: how many voices you let in
Top-P 是你做决定时愿意听进多少比例的声音。听排名前 90% 的主流意见,既博采众长,又自动滤掉了街角疯子的胡话;太窄(0.2)是一意孤行;完全不设防(1.0)则会被噪音淹没。 Top-p is what share of the room you are willing to hear before deciding. The top 90% takes in the sensible range and quietly filters out the person shouting on the corner; too narrow (0.2) is just your own mind talking back; wide open (1.0) is drowning in noise.
0.1 — 只听最主流的一两句,拒绝一切非主流见解。 only the one or two loudest opinions get through.
1.0 — 词表里概率亿分之一的偏门词也获得入选资格。 even a token with one-in-a-hundred-million odds is eligible.
⚙️ 底层原理:Reality: 按概率降序排列,取累积和刚好达到 p 的最小候选集(核采样),尾部长尾分布物理归零后再重新归一化。 Sorts tokens by probability, keeps the smallest set whose cumulative mass reaches p (nucleus sampling), zeroes the tail outright and renormalizes.
top_k
固定候选数上限Hard cap on candidates
智囊团席位Seats at the table
当前设定值:Current value: 40
🤝 人生隐喻:核心智囊团的人数🤝 Metaphor: how many advisers you keep
Top-K 是你做重大决定前最多咨询几位顾问。K=1 是孤家寡人,只听第一心腹;K=40 是一个精干的董事会;K=248320 则是把整个菜市场都请来做民意调查,场面通常收不住。 Top-k is how many advisers you consult before a real decision. K=1 is one confidant and no one else; K=40 is a working board; K=248,320 is polling the entire marketplace, which rarely ends in a decision at all.
1 — 永远走最保险的第一条路,单调刻板。 always the safest first path; predictable to a fault.
100+ — 候选极多,语言多姿多彩,跑题风险也随之上升。 many candidates, colourful language, and a rising risk of wandering off.
⚙️ 底层原理:Reality: 只保留概率最大的 K 个 logits,其余截断。通常与 Top-P 配合:K 设上限防止长尾幻觉,P 负责按分布动态收紧。 Keeps only the K highest logits and truncates the rest. Usually paired with top-p: K sets a hard ceiling against long-tail hallucination, p tightens dynamically with the distribution.
presence_penalty
重复用词的惩罚强度Penalty on words already used
喜新厌旧度Appetite for the new
当前设定值:Current value: 0.00
🧭 人生隐喻:走出舒适区的魄力🧭 Metaphor: the nerve to change the subject
Presence penalty 是你开辟新话题的魄力。正值高时,你像个拒绝把同一句话说第二遍的人,逼着自己往新领域走;负值则是沉在旧事里的固执,翻来覆去讲同一段往事。 Presence penalty is your nerve for opening a new subject. High and positive, you are someone who refuses to say the same sentence twice and keeps pushing into unfamiliar ground; negative, you are settled in old stories, telling the same one again.
-1.5 — 疯狂复读同一句话,陷入死循环。 repeats the same line until it becomes a loop.
+1.5 — 极度抗拒任何重复,为换话题不惜生造生僻概念。 so allergic to repetition it invents concepts to avoid it.
⚙️ 底层原理:Reality: 只要某 token 在已生成文本中出现过至少一次,就给它的 logit 减去固定惩罚:logit − c × p(与出现次数无关,这点区别于 frequency_penalty)。 If a token has appeared even once in the generated text, a fixed penalty is subtracted from its logit: logit − c × p. Unlike frequency_penalty, the count does not matter — only presence.
context_window
上下文跨度与 KV 驻留Context span and resident KV
记忆与胸襟Memory
当前设定值:Current value: 131072 (128K)
📜 人生隐喻:长情记忆与底蕴📜 Metaphor: how far back you still remember
上下文窗口是你的记忆深度。只记得住 4K 的人聊两句就忘了初衷;能装下 128K 的人,读完整本《战争与和平》还记得第一章那个路人留下的伏笔,并能从漫长的篇幅里把线索一根根抽出来。 The context window is how deep your memory runs. With 4K you lose the thread a few exchanges in; with 128K you finish War and Peace still holding the detail a minor character left in chapter one, and can pull the thread back out of all that length.
4K — 只能就事论事,前文稍复杂便顾此失彼。 lives entirely in the present turn; any complexity earlier is already gone.
128K — 吞下整座图书馆的底蕴,代价是约 15 GiB (FP8) 的 KV 驻留。 holds a library's worth of context, at a cost of about 15 GiB of resident KV in FP8.
⚙️ 底层原理:Reality: 决定注意力矩阵 O(N²) 的上限。128K 经 PCP=8 切成 8 个 16K chunk 分布在 8 张卡上;单卡 KV 实测 1.92 GB,整请求 8 卡合计 约 15 GiB (FP8)——两者是同一笔账的单卡视角与全局视角。 Sets the ceiling on the O(N²) attention matrix. At PCP=8 a 128K sequence is cut into eight 16K chunks across eight chips; measured per-chip KV is 1.92 GB and the whole request comes to about 15 GiB in FP8 across the 8 chips — the same figure viewed per-chip and globally.
speculative_tokens (MTP)
多 Token 投机步长Multi-token speculation depth
前瞻远见Foresight
当前设定值:Current value: 2 Tokens
♟️ 人生隐喻:下棋能看几步♟️ Metaphor: how many moves ahead you see
MTP 步长就是你行事时往前预判几步。走一步看一步的人慢(传统自回归 22.45 ms/词);能稳稳看透后两步的人,一手落子两处,效率直接翻倍(11.20 ms/词)。但若非要盲目看透十步,反复纠偏验证的代价反而会把收益吃掉。 The MTP depth is how far ahead you commit. Move-by-move is slow (22.45 ms per token in plain autoregression); seeing the next two reliably places two stones at once and halves the cost (11.20 ms per token). Insisting on ten, though, spends more on checking and correcting than the foresight is worth.
1 — 绝不抢跑,极其稳健,但每一步都要付全额延迟。 never gets ahead of itself — and pays the full latency on every step.
2~3 — 实测甜点位:单步命中 2 词,接受率与加速比同时最优。 the measured sweet spot: 2 tokens accepted per step, best acceptance rate and speedup together.
⚙️ 底层原理:Reality: 轻量投机头一次前瞻 k 个候选,主模型单次并行验证(fusion.990 / RPA verify 特化)。命中即一次权重读出产出多词,实测吞吐 5,650 tok/s A lightweight draft head proposes k candidates at once and the main model verifies them in a single parallel pass (fusion.990, the specialized RPA verify). On a hit, one weight read yields several tokens — measured at 5,650 tok/s.
🌟 调参的终极哲学:中庸之道 🌟 The point of all this tuning: there is no universally right setting
从来不存在一组永远正确的「死参数」。《中庸》讲:「喜怒哀乐之未发,谓之中;发而皆中节,谓之和。」
需要严谨推导代码与定理时,就收敛心性——低 temperature、精准的 Top-K 门控、纯粹的 GQA 检索;需要写诗探索未知时,就放开一点——高 temperature、适度惩罚、更广的采样空间。把所有超参数读懂之后,读到的其实是同一件事:在确定与开放之间,永远要重新找一次平衡。
No fixed set of values is right for everything. The Doctrine of the Mean puts it this way: before feeling stirs, that is centre; when it stirs and stays in measure, that is harmony.
Deriving a proof or debugging code, pull inward — low temperature, tight top-k gating, straightforward GQA retrieval. Writing a poem or exploring something unfamiliar, let it out — higher temperature, a little penalty, a wider sampling space. Read all the hyperparameters and they turn out to say one thing: the balance between certainty and openness has to be found again for every task.
⚖️ 权衡与妥协对账(按「三个旋钮 / 三个房间」框架) Trade-off and compromise ledger (framed by "three knobs / three rooms")
本页用一套外部课程讲义的分析框架,回头审这份部署记录:一个 query 只做三步,所以只有三个旋钮—— ① 每个 token 存多少(MQA→GQA→MLA)、② 每个 query 看多少(SWA/NSA/DSA 稀疏)、③ 换一套数学(DeltaNet→GDN 线性)。 而注意力的变体史是在三种资源之间反复搬家显存 → 算力 → 访存规整度,顺序不是随机的——先搬能拿尺子量的,最后才搬量不出来的。
结论先放这里:这个部署在旋钮① 上保守、在③ 上激进、在② 上主动弃权; 它几乎全部工程预算都投在第三个房间(访存规整度),拿到了 8.3× 这种「一个字节 KV 都没少」的收益; 而它交的学费是 PD 带宽只兑现一半、可用性欠账,以及一张已经不在注意力上的账单
This page re-reads the deployment record through an external lecture's framework: a query only does three things, so there are only three knobs — ① how much is stored per token (MQA→GQA→MLA), ② how much each query looks at (SWA/NSA/DSA sparsity), and ③ swapping the mathematics (DeltaNet→GDN linear attention). The history of attention variants is a series of moves between three resources: memory → compute → memory-access regularity, and the order is not accidental — what can be measured with a ruler moves first, what cannot moves last.
The conclusion up front: this deployment is conservative on knob ①, aggressive on ③, and abstains on ②. Nearly all of its engineering budget went into the third room (access regularity), which is where a 8.3× win came from without saving a single byte of KV. The price paid: half the PD bandwidth actually delivered, an availability debt, and a bill that no longer sits on attention at all.
框架来源:Framework source: 专题三 · 注意力演进 (L300) §十「落到硬件」 (卡 A–D、G) (cards A–D, G) ;卡 E–F 另用 ; cards E–F additionally use 专题二 · TPU 与 GPU (L300) 的口径规矩,并对照一份 GB200 上同族 MoE 的扩展性基准。 for its caliber discipline, and cross-check against a GB200 scaling benchmark on a same-family MoE.
卡 A–D、G 里被对账的实测数字全部出自本文档既有的联合优化记录;卡 E 是纯推导(只用已发布常数),卡 F 引用的是外部实测并已逐条标注口径。 Every measured number audited in cards A–D and G comes from this document's existing joint-optimization record. Card E is pure derivation from published constants only; card F cites external measurements, each annotated with its caliber.
🎛️ A · 三个旋钮上的位置 —— 以及那个没有拧的旋钮 A · Where this deployment sits on the three knobs — and the one it did not turn
旋钮Knob 改什么What it changes Qwen 3.5 的选择What Qwen 3.5 chose 代价 / 理由Cost / rationale
每个 token 存多少bytes per token 减少 KV 份数或维度Fewer or smaller KV copies 保守Conservative
GQA 96Q / 32KV(3:1),未上 MLAGQA 96Q / 32KV (3:1), no MLA
MLA 的前提是「算力充裕、显存紧张」,且压缩在训练前向里不生效;3:1 的 GQA 换来的是完全规整的读法。MLA assumes "compute abundant, memory tight" and its compression does not apply in the training forward pass; a 3:1 GQA buys fully regular reads instead.
每个 query 看多少how much each query reads 限制范围或运行时动态挑选Restrict the span, or pick at runtime 主动弃权Abstained
整份记录里没有 DSA / NSA / 任何 runtime top-kNo DSA, no NSA, no runtime top-k anywhere in the record
这是本案例最大的一次权衡。稀疏注意力的隐含硬件假设是「gather 不太贵」——而这正是 TPU 为换取规整访存主动放弃的能力。放弃旋钮② = 放弃一条公认有效的省算力路线,换「不必在 TPU 上打那场还没打赢的仗」。The single biggest trade here. Sparse attention silently assumes gathers are cheap — exactly the capability TPU gives up in exchange for regular access. Abstaining from knob ② means giving up a proven compute-saving route to avoid a battle that has not yet been won on this hardware.
换一套数学swap the mathematics 用固定大小状态替代变长 KVA fixed-size state instead of a growing KV cache 激进Aggressive
45 / 60 层是 GDN 线性注意力45 of 60 layers are GDN linear attention
线性注意力的前提是「片上内存放得下 chunk 的中间量」。128×128 状态 FP8 压到 16 KB,v7 有 64 MiB VMEM —— 假设成立,兑现 4.9×。这是本案例里少数赌对了的地方。Linear attention assumes the chunk's intermediate state fits on chip. The 128×128 state compresses to 16 KB in FP8 against v7's 64 MiB VMEMthe assumption holds and the 4.9× is realised. One of the few bets here that paid.
①+③ 混合Hybrid 不同层用不同方案Different layers, different schemes 15 层 FA + 45 层 GDN = 60 层15 FA + 45 GDN = 60 layers 只有 15 层产生 KV → 128K 全请求 15 GiB 而非 60 / 80 GiB。Only 15 layers produce KV → 15 GiB for a full 128K request rather than 60 or 80 GiB.
讲义列了现代注意力的三个「动态性来源」:ragged 批(各请求长度不同)、分页 KV(一条序列散在不连续的页上)、运行时 top-k(开工了才知道读哪 2048 条)。 这个部署硬扛下了前两个(interleaved paging + RPAd + HND 布局),而第三个、也是最难的那个,是靠选模型绕开的,不是靠写 kernel 解决的 The lecture names three sources of dynamism in modern attention: ragged batches (requests of differing length), paged KV (one sequence scattered across non-contiguous pages), and runtime top-k (which 2,048 entries to read is only known once work begins). This deployment absorbs the first two head-on (interleaved paging, RPAd, HND layout), while the third and hardest one is side-stepped by the choice of model, not solved by writing kernels.
🚚 B · 搬家史的落点 —— 收益最大的几项,一个字节 KV 都没少 B · Where the moving went — the biggest wins saved no KV bytes at all
讲义的断言是:显存和算力能拿尺子量,所以先被搬完;访存规整度量不出来,它只出现在 kernel 里,所以留到最后,也最难。这份部署的战果清单是这句话的实证。 The lecture's claim: memory and compute can be measured with a ruler, so they were moved first; access regularity cannot be measured — it only shows up inside kernels — so it was left for last, and it is the hardest. This deployment's scoreboard bears that out.
优化项Optimization 搬的是哪个房间Which room it moves 省了显存?Saves memory? 省了 FLOPs?Saves FLOPs? 实测结果Measured result
SEQ_ON_LANE / HND KV 布局KV layout 纯访存规整度Pure access regularity No No decode 700 → 5,790 tok/s (8.3×)
PCP ring 取代 all-gatherreplacing all-gather 通信规整度(连号 P2P vs 广播散取)Comm regularity (contiguous P2P vs scattered broadcast) No No 950 µs 传输 100% 藏进计算阴影(bubble = 0)950 µs of transfer fully hidden under compute (bubble = 0)
owner_output blockwise combine 写回规整度Write-back regularity No No decode 5,500 → 5,650 tok/s
GDN 融合 FP8 状态锁 VMEMFused FP8 GDN state pinned in VMEM 消灭 HBM 写回(访存量)Eliminates HBM write-back (traffic) Yes No 4,120 µs → 840 µs (4.9×)
PCP=8 序列并行sequence parallelism 显存 + 算力(把 128K 拆成 8 × 16K)Memory + compute (128K cut into 8 × 16K) Yes 重分布Redistributed 128K TTFT 32 s → 4.62 s (6.9×,同 8 芯片)128K TTFT 32 s → 4.62 s (6.9×, same 8 chips)
8.3× 只靠改同一批字节的摆放方式——这是「访存规整度是最难搬也最值钱的那一样」最干净的一个证据。也解释了为什么这一支的前沿工作看起来越来越像写 kernel 而不是改模型。 8.3× purely from re-arranging the same bytes — the cleanest evidence available that access regularity is both the hardest resource to move and the most valuable. It is also why frontier work in this area increasingly looks like writing kernels rather than changing models.
🧾 C · 四个取舍,逐条对账 C · The four trade-offs, itemised against this deployment
省显存 ≠ 省计算Saving memory is not saving compute
本案例对得最疼的一条 The one that bites hardest here
已兑现Realised
实测分层:full 492 µs × 15 vs linear 774 µs × 45
• FA 15 层合计 7.4 ms
• GDN 45 层合计 34.8 ms
那个负责省 KV 的机制,是全模型里更贵的那一个——单层比 full-attention 还慢 57%,总耗时是它的 4.7 倍。旋钮③ 把显存账做没了(O(1) 状态、长文本零膨胀),代价原封不动记到了算力账上。
Measured per layer: full 492 µs × 15 against linear 774 µs × 45.
• 15 FA layers total 7.4 ms
• 45 GDN layers total 34.8 ms
The mechanism that saves the KV cache is the more expensive one in the model — 57% slower per layer than full attention, and 4.7× its total cost. Knob ③ erases the memory bill and posts the whole amount to the compute bill.
训练时省 ≠ 推理时省Saving at training is not saving at inference
本案例基本免疫 Largely immune here
低风险Low risk
GDN 是模型本身的结构,不是服务期技巧,所以训练与推理两边都省 —— 这是混合架构相对「推理期压缩」方案的结构性优势。
但要分清:FP8 KV、NVFP4、W4A8 属于纯推理期,训练不享受;拿它们的收益去论证模型效率是偷换口径。
GDN is part of the model's structure, not a serving-time trick, so it saves on both sides — a structural advantage over inference-only compression schemes.
But keep them separate: FP8 KV, NVFP4 and W4A8 are inference-only; training sees none of it. Citing their gains as model efficiency is a change of accounting under cover.
不规则访存 / 通信的代价常被低估Irregular access and transfer cost more than the slide says
纸面 2×,落地 1× 2× on paper, 1× delivered
已踩Hit
PD 交接:KV 要从 prefill 布局重排为 decode 的 (16 头, 全序列) 并跨节点搬运——头与序列两个维度同时重分布,是 PD 分离固有的主要开销。
• 单网卡 P→D 峰值 > 12.5 GB/s,线速 25 GB/s,达标线就是线速的 50%;双网卡 400 Gbps 至今未交付(b/558565285,PR #839 open)。
• 3.8-Max 侧:fused MoE token all-gather 在 4 host 下直接吃掉 −30% E2E,记录标注「暂时无解」。
PD handoff: KV must be resharded from the prefill layout into decode's (16 heads, full sequence) and moved across nodes — redistributed along the head and sequence axes at once, the dominant intrinsic cost of PD disaggregation.
• Single-NIC P→D peaks at > 12.5 GB/s against a 25 GB/s line rate, and the bar was set at 50% of line rate. Dual-NIC 400 Gbps has still not been delivered (b/558565285, PR #839 open).
• On the 3.8-Max side, the fused-MoE token all-gather costs −30% end-to-end at 4 hosts, marked "no solution for now" in the record.
收益有天花板 —— 注意力只是账单的一部分Gains have a ceiling — attention is only part of the bill
最该带走的一条 The one to take away
决定性Decisive
在这个案例里,这条可以精确到小数点: Here this can be settled to the decimal point:
full   492 µs × 15 =   7.4 ms  →  5.8%
linear 774 µs × 45 =  34.8 ms  → 27.5%
MoE   1.41 ms × 60 =  84.6 ms  → 66.7%
─────────────────────────────
合计total               126.8 ms  (文档记录的总时延 158 msrecorded total 158 ms)
FA
GDN 27.5%
MoE 66.7%
MoE 占三分之二,所有注意力加起来只占三分之一,full-attention 自己只占 5.8%。 这是 prefill 的口径 —— 三个数都来自 prefill 实测。decode 另有一本账,见下面 E 卡:那里 MoE 依然是大头,但机制换成了权重流式读取,块浪费退到第二顺位。) 把 15 层 full-attention 全部删光,prefill 也只快 5.8%
这正解释了为什么这份记录里真正的大头优化是 fused EP MoE v2、DP↔EP all-to-all 重排、owner_output——而不是注意力
MoE takes two thirds; all attention combined takes one third; full attention alone takes 5.8%. Deleting all 15 full-attention layers outright would speed prefill up by 5.8%. (This is the prefill caliber — all three numbers are prefill measurements. Decode keeps a separate ledger; see card E below: MoE still dominates there, but the mechanism becomes weight streaming and tile waste drops to second place.)
Which is exactly why the real headline optimizations in this record are fused EP MoE v2, the DP↔EP all-to-all reshuffle and owner_outputnot attention.
⭐ 账本交棒:旋钮③ 的真实回报形式⭐ The ledger changes hands: what knob ③ actually buys
讲义给的参照是 DeepSeek V3:128K 下平方项占 81.8%。这个模型在 128K 下平方项只剩 5.8% —— 恰恰因为拧了旋钮③,60 层里 45 层的平方项被抹掉了。所以 GDN 的回报形式不是「注意力变快」,而是「注意力不再是问题,于是问题变成了 MoE」 The lecture's reference point is DeepSeek V3: at 128K the quadratic term is 81.8% of the forward pass. In this model at 128K it is 5.8% — precisely because knob ③ removed the quadratic term from 45 of 60 layers. So GDN's payoff is not "attention got faster"; it is "attention stopped being the problem, and the problem became MoE".
🔍 D · 防骗判据 —— 拿来审这份材料自己 D · The anti-bluff criterion, turned on this document itself
讲义两句最狠的话:「任何一个倍数,必须带上『在多长的上下文下』」,以及 「还得说清它是哪一样的倍数」 (同一个 MLA:显存 56.9× vs 单用户 decode 时间 7.08×,差整整八倍 —— 报哪一个,取决于你想让听的人以为你省了多少)。
这份材料犯过、并已逐条修掉的,基本就是这两条:
The lecture's two sharpest rules: "every multiple must carry the context length it was measured at", and "it must also say which resource the multiple is in" (the same MLA: 56.9× on memory against 7.08× on single-user decode time — a factor of eight apart; which one you quote depends on how much you want your audience to think you saved).
These are, itemised, the errors this document made and has since corrected:
曾经的说法What it used to say 缺了哪个限定Missing qualifier 现在的处理How it reads now
TTFT 32 s → 4.62 s(6.9×) (6.9×) 「128K 单请求」+「同样 8 颗芯片」。不写就会被读成扩容收益。"128K, single request" and "the same 8 chips". Without them it reads as a scaling win. 全文均标注「同 8 芯片」Annotated "same 8 chips" throughout
700 → 5,790 and 5,500 → 5,650 tok/s 两个不同基线,不能相乘、不能相加 —— 与「512 倍与 846 倍是两把尺子」同型。Two different baselines; they cannot be multiplied or added — the same error as chaining a 512× and an 846× figure. 各自注明分支与口径Each scoped to its own branch
492 µs = 每 × 8 跳 → 15 层 61.8 ms492 µs per hop × 8 → 61.8 ms for 15 layers 与文档自身预算矛盾:按每跳算三项合计 178.5 ms > 记录的 158 ms 总时延;按每层算合计 126.8 ms,落在预算内。Contradicts the document's own budget: per-hop makes the three terms sum to 178.5 ms against a recorded 158 ms total; per-layer sums to 126.8 ms, inside it. 改判为每层,15 层 ≈ 7.4 msRe-read as per layer; 15 layers ≈ 7.4 ms
4,120 µs / 层4,120 µs per layer 另一把尺子,来源不明(可能是另一配置或含 MoE 的整层)。A different ruler of unknown origin (possibly another configuration, or a whole layer including MoE). 保留但标注「不要与 492 µs 混用」Kept, flagged "do not mix with the 492 µs figure"
阶段带 1.85 s vs 算子表 126.8 ms1.85 s on the stage ribbon vs 126.8 ms in the operator table 差约 15× —— 典型的「报哪一个」问题。Roughly 15× apart — a textbook "which one do you quote" problem. 标注为未闭合,禁止同表相加Marked unreconciled; must not be summed in one table
QKV 输出 2560 列 → 推断芯片数QKV output of 2,560 columns → inferring the chip count 与上线的 PCP8+EP8(注意力权重复制)对不上。Inconsistent with the deployed PCP8+EP8 form, where attention weights are replicated. 挂起:不得据 trace 形状推断芯片数Open: do not infer chip count from trace shapes
🧱 E · decode 的第二本账 —— TPOT 有一个 6.7 ms 的权重地板 E · Decode keeps a second ledger — TPOT has a 6.7 ms weight floor
上面 C④ 那张 5.8 / 27.5 / 66.7 的饼是 prefill 的账 —— 它是从 492 µs × 15 + 774 µs × 45 + 1.41 ms × 60 拆出来的,那组数就是 prefill 实测。 decode 是另一本账:那里既不是注意力、也不是 MXU 说了算,而是专家权重每步都要被完整读一遍。 这一条不需要任何实测就能定下来,因为它只用到权重体积和 HBM 带宽两个数。 The 5.8 / 27.5 / 66.7 split in C④ above is the prefill ledger — it comes out of 492 µs × 15 + 774 µs × 45 + 1.41 ms × 60, and those are prefill measurements. Decode keeps a different book: there neither attention nor the MXU sets the pace — the expert weights have to be read end to end on every single step. This one needs no measurement at all; it uses only two numbers, weight volume and HBM bandwidth.
步骤Step 算式Arithmetic 结果Result
每芯片权重Weights per chip 397 GB (fp8) ÷ 8 chips 49.63 GB = 46.22 GiB
每层Per layer 49.63 GB ÷ 60 0.827 GB
读一遍的时间Time to read it once 0.827 GB ÷ 7.37 TB/s 112 µs / layer
decode 单步地板Floor for one decode step 112 µs × 60 6.73 ms
量化到 4 bit 权重后With 4-bit weights W4A8 / NVFP4 3.37 ms
地板要读到 batch 这一层才准。权重字节正比于本步被点亮的专家数,而不是行数。top-8 打 512 个专家,按泊松近似命中率是 1 − e^(−B/64),于是:
TPOT 地板(B) = 6.73 ms × (1 − e^(−B/64))
B ≳ 256 时命中率 98%,地板才真正「与 batch 无关」;小 batch 下地板会一起缩。不受块浪费影响 —— 补白浪费的是 MXU 周期,不是从 HBM 搬过来的字节。
三条可以直接拿去用的推论:
大 batch 下,任何低于 ~6.7 ms 的 TPOT 目标在 8 卡 fp8 上不可达。不是调优问题,是带宽除法。要么摊到更多卡上做 EP,要么把权重变成 4 bit。
② 这给 NVFP4 / W4A8 那条线一个明确的量化理由:它把地板直接砍一半,而且是唯一一个能砍地板的手段。
反过来用,记录里的 5,650 tok/s 能把 decode 的 MBU 反解出来 —— 这正是和外部平台唯一同口径可比的那个量(见下面 F 卡,GB200 在 EP8 上是 55.6%):
The floor only reads correctly once batch is in it. Weight bytes are proportional to the number of experts lit up on this step, not to the number of rows. With top-8 over 512 experts the Poisson approximation gives a hit rate of 1 − e^(−B/64), so:
TPOT floor(B) = 6.73 ms × (1 − e^(−B/64))
At B ≳ 256 the hit rate is 98% and only then is the floor genuinely batch-independent; at small batch the floor shrinks with it. It is immune to tile waste either way — padding burns MXU cycles, not bytes moved from HBM.
Three consequences you can act on:
At large batch, any TPOT target below ~6.7 ms is unreachable on 8 chips at fp8. Not a tuning problem, a division. Either spread EP over more chips or make the weights 4-bit.
② This gives the NVFP4 / W4A8 workstream a concrete quantitative justification: it halves the floor, and it is the only lever that moves the floor at all.
Used backwards, the recorded 5,650 tok/s pins down the decode MBU — the one quantity that is like-for-like comparable against an external platform (see card F: GB200 reaches 55.6% at EP8):
假设 batchAssumed batch 命中专家比例Experts lit TPOT 地板TPOT floor 实际 TPOT(由 5,650 tok/s 反推)Actual TPOT (from 5,650 tok/s) 权重 MBUWeight-only MBU
3239.3%2.65 ms5.66 ms46.8%
6463.2%4.26 ms11.3 ms37.6%
12886.5%5.82 ms22.7 ms25.7%
25698.2%6.61 ms45.3 ms14.6%
⭐ 于是「decode 实际跑在哪个 batch」不再是一个背景参数,而是决定下一步做什么的分叉点:
• 若在 batch 32 一带 → 46.8%,已经是 GB200 EP8 档(55.6%)的水平,实现层面没剩多少,能动地板的只有 4 bit 权重
• 若在 batch 256 一带 → 14.6%,还有约 3 倍的实现红利没拿,这时先做 NVFP4 就是投错方向
口径:只算专家权重字节,未计 KV 读取与激活,所以这是 MBU 的下界;长上下文下 KV 流量会把真实 MBU 抬上去。decode batch 目前没有记录 —— 这是补一个数就能立刻收敛的分叉。
⭐ So "what batch does decode actually run at" stops being background and becomes the fork in the road:
• Around batch 3246.8%, already in GB200-EP8 territory (55.6%): little left in the implementation, and only 4-bit weights move the floor;
• Around batch 25614.6%, roughly of implementation headroom still unclaimed, and doing NVFP4 first would be aiming at the wrong thing.
Caliber: expert-weight bytes only — KV reads and activations excluded, so this is a lower bound on MBU; at long context KV traffic pushes the real figure up. The decode batch is not recorded anywhere — one measurement collapses this fork.
块浪费在这本账里排第几?用 megablox 的公开上界算,而不是拍脑袋 —— TPU 不补零,它重复执行跨界块,所以代价是「多跑 < 段数 − 1 个块」:
tiles_m ≤ 实际执行块数 ≤ tiles_m + 段数 − 1(每芯片 64 个本地专家 = 64 段)
decode · 256 并发:每芯片 256 行 → tiles_m = 2,上界 2 + 63 = 65 块 → 32×。对应约 123 µs(bf16 口径),和 112 µs 的权重地板基本持平 —— 第二顺位,但已经贴着。
prefill · 一个 16K chunk:每芯片 16,384 行 → tiles_m = 128,上界 128 + 63 = 191 块 → 仅 +49%
所以 MoE 在 prefill 占 66.7%,主因不是块塌陷 —— 块税封顶只有 +49%,解释不了这个比例。真正的原因朴素得多:60 层 × top-8 × 三矩阵,MoE 本来就拿着绝大部分 FLOPs,+49% 是加在上面的一笔附加税。块塌陷真正致命的地方在 decode,而那里它又恰好被带宽挡在第二位。
Where does tile waste rank in this ledger? Use megablox's published bound rather than a guess — TPU does not zero-pad, it re-executes boundary tiles, so the cost is "fewer than segments − 1 extra tiles":
tiles_m ≤ tiles actually executed ≤ tiles_m + segments − 1 (64 local experts per chip = 64 segments)
decode, 256 concurrent: 256 rows per chip → tiles_m = 2, bound 2 + 63 = 65 tiles → 32×. That is ~123 µs in bf16 terms, level with the 112 µs weight floor — second in line, but right up against it.
prefill, one 16K chunk: 16,384 rows per chip → tiles_m = 128, bound 128 + 63 = 191 tiles → only +49%.
So tile collapse is not the reason MoE holds 66.7% of prefill — a tax capped at +49% cannot produce that share. The plain reason is that 60 layers × top-8 × three matrices means MoE genuinely owns most of the FLOPs, with the +49% levied on top. Where tile collapse really bites is decode — and there bandwidth happens to keep it in second place.
📐 口径:这张表是推导,不是实测📐 Caliber: this table is derived, not measured
输入只有两个已发布常数(397B 参数 fp8、7.37 TB/s)和一个部署事实(EP=8 摊在 8 芯片上)。它是下界:KV 读取、激活、all-to-all、以及达不到 100% 的 MBU 全都叠在它上面。按 60–70% 的 MBU 反推,现实中的单步在 9.6–11.2 ms 一带。还没有实测过 —— 这正是值得补的一个数。 The inputs are two published constants (397B params at fp8, 7.37 TB/s) and one deployment fact (EP=8 over 8 chips). It is a lower bound: KV reads, activations, all-to-all and any MBU short of 100% all stack on top. At a realistic 60–70% MBU the real step lands around 9.6–11.2 ms. It has not been measured — which is exactly why it is worth measuring.
🔬 F · 横向对照 —— GB200 上同族 MoE 的实测,以及不能从它得出的那个数 F · Cross-check — a same-family MoE measured on GB200, and the number that cannot be drawn from it
有一份 GB200 上的 MoE 扩展性基准(GDN + 512 专家、60 层,EP 8 / 16 / 32 卡),结构和我们这个模型同族。 按专题二 §6 的四档阶梯, 它和我们这份记录只能挂在第 ① 档:模型不同、精度不同(fp8 vs fp8×fp4)、他们没写上下文长度、我们没写 decode batch、而且只有一侧调过。 所以这张卡里没有、也不会有「TPU v7 比 GB200 快 N 倍」这句话。 能带走的不是倍数,是机制 —— 而机制是可以跨平台搬的。 There is a MoE scaling benchmark on GB200 (GDN + 512 experts, 60 layers, EP over 8 / 16 / 32 GPUs) whose architecture is the same family as this model. On the four-rung ladder in topic-02 §6, pairing it with this record lands on rung ① and nowhere higher: different model, different precision (fp8 vs fp8×fp4), no context length stated on their side, no decode batch stated on ours, and only one side tuned. So this card does not contain — and will not contain — a sentence of the form "TPU v7 is N× a GB200". What travels across platforms is not the multiple, it is the mechanism.
F-1 · 报告的两条结论都不是模型属性,是 tile 属性 F-1 · Neither headline finding is a property of the model — both are properties of the tile
先说一件报告自己没说、但从它的 config 直接推得出来的事:三档卡数下每个 rank 的 FLOPs 完全一样(每 rank 路由行数 = tokens/rank × top-k = 2,560,与 EP 无关)。所以「8→32 卡延迟下降」根本不是强扩展,每卡的活没变少;变的只有每专家行数(涨)和 all-to-all 对端数(涨)。拿 tile_m = 128 的块占用模型算一遍: Start with something the report does not say but its own config implies: per-rank FLOPs are identical across all three GPU counts (routed rows per rank = tokens/rank × top-k = 2,560, independent of EP). So "latency drops from 8 to 32 GPUs" is not strong scaling at all — no rank does less work. Only two things change: rows per expert (up) and all-to-all peers (up). Run the tile_m = 128 occupancy model over it:
配置Config 每专家行数 8 / 16 / 32Rows per expert, 8 / 16 / 32 块浪费Tile waste 实测加速 8→16 / 8→32Observed 8→16 / 8→32 模型预测Model predicts
Qwen 256 tok, k=10 40 / 80 / 160 3.2× → 1.6× → 1.6× 1.44× / 1.31× 2.0 / 2.0
Qwen 512 tok, k=10 80 / 160 / 320 1.6× → 1.6× → 1.2× 1.15× / 0.88× 1.0 / 1.33
DeepSeek 256 tok 32 / 64 / 128 4.0× → 2.0× → 1.00× 1.46× / 1.73× 2.0 / 4.0
DeepSeek 512 tok 64 / 128 / 256 2.0× → 1.00× → 1.00× 1.32× / 1.36× 2.0 / 2.0
模型预测的是「收益在哪里停」,四组全中:
• DeepSeek 256 在 32 卡正好撞上 128 行 = 一整块,所以它是唯一一个一路降到 32 卡的;
• Qwen 256 的占用率从 16 卡起就卡在 62.5% 不动,所以它「16 卡最好」;
报告自己的数据里就有反例:同一个模型换成 512 token/rank,8→16 只剩 1.15×、32 卡直接倒退到 0.88×。
⭐ 于是那条能搬走的结论:最佳 EP 数不是模型的属性,是 tokens/rank × top-k ÷ 专家数 与 GEMM 块的关系。换个 batch,最佳点就搬家。
诚实标注:模型预测的幅度普遍偏大(实测只有预测的 0.6–0.75),因为每卡权重字节也在减半,两个机制叠着。Qwen 512 的 8→32 那格(预测 1.33×、实测 0.88×)是模型明确失效的一格 —— 那里通信已经压过一切。
The model predicts where the gains stop, and it is 4 for 4:
• DeepSeek 256 at 32 GPUs lands exactly on 128 rows = one whole tile, which is why it is the only config that keeps improving all the way to 32;
• Qwen 256 pins at 62.5% occupancy from 16 GPUs onward, which is why "16 is best" for it;
the counterexample is inside the report's own data: the same model at 512 tokens/rank gets only 1.15× from 8→16 and regresses to 0.88× at 32.
⭐ Hence the transferable conclusion: the optimal EP count is not a property of the model. It is the relationship between tokens/rank × top-k ÷ experts and the GEMM tile. Change the batch and the optimum moves.
Stated honestly: the model over-predicts magnitude (observed runs 0.6–0.75 of predicted) because per-GPU weight bytes are halving at the same time — two mechanisms stacked. The Qwen 512 8→32 cell (predicted 1.33×, observed 0.88×) is where the model plainly fails: communication has taken over there.
F-2 · 报告写「HBM utilization 没达到最好,以后再深挖」—— 深挖的结果是 MBU 三档砍掉三分之二 F-2 · The report says "HBM utilization doesn't achieve best, could deep dive later" — the deep dive says MBU loses two thirds over three steps
Qwen 256 k=10    8 → 55.6%   16 → 42.1%   32 → 20.6%
Qwen 512 k=10    8 → 51.2%   16 → 32.1%   32 → 14.1%
DeepSeek 256     8 → 60.8%   16 → 45.9%   32 → 28.7%
这不是 kernel 变差了,是每卡权重字节减半、而 all-to-all 的对端数翻倍。专题二 §4.4 那句「四个原语里三个能拆成环、只有 all-to-all 不能,5 个点从 5 条边跳到 10 条边」在这张表上第一次有了数字。讲义 §4.5 自己测的 DeepEP 在同一个 NVL72 域内从 8 卡到 32 卡就掉了 Dispatch −9% / Combine −19%;这份报告是跨 2→8 个节点,掉得更狠,量级对得上。 This is not the kernel degrading. Per-GPU weight bytes halve while the number of all-to-all peers doubles. Topic-02 §4.4 — "three of the four primitives decompose into rings, all-to-all does not; five nodes go from five edges to ten" — finally has numbers attached to it here. The lecture's own DeepEP measurement inside a single NVL72 domain loses 9% on Dispatch and 19% on Combine going from 8 to 32; this report spans 2→8 nodes and loses more, which is the right direction and the right order of magnitude.
F-3 · Top-K 10→6 的收益曲线,证明瓶颈不只是通信 F-3 · The Top-K 10→6 gain curve shows the bottleneck is not only communication
报告把 32 卡那 30% 的收益全部归给「通信量减少 40%」。但同一个改动在 8 卡只值 8% —— 通信量在 8 卡也少了 40%,为什么不灵?块模型给的答案很干脆: The report credits the 30% win at 32 GPUs entirely to "40% less communication". But the same change is worth only 8% at 8 GPUs — communication drops 40% there too, so why doesn't it pay? The tile model answers bluntly:
8 卡8 GPUs 32 卡32 GPUs
top-k=10 每专家行数 → 块数top-k=10 rows/expert → tiles 40 → 1 160 → 2
top-k=6 每专家行数 → 块数top-k=6 rows/expert → tiles 24 → 1 96 → 1
块数变化Change in tile count 没变none 减半halved
实测收益Observed gain 8% 30%
8 卡上砍掉 40% 的数学只买到 8%,因为块数一个没少 —— 那 40% 的行本来就落在补白里。这不否定报告的通信解释(两者共同作用),但它是一个更便宜的检验:真是通信主导的话,8 卡也该有两位数收益。 Removing 40% of the arithmetic buys 8% at 8 GPUs because not one tile disappeared — those 40% of rows were already sitting in the padding. This does not refute the report's communication explanation (both act at once), but it is a cheaper test: if communication really dominated, 8 GPUs should have shown a double-digit gain too.
F-4 · 对我们自己的一句:我们在这张表的最左端之外 F-4 · One line about ourselves: we sit off the left edge of that table
GB200 那份里最差的一档是每专家 40 行。我们 decode 一步 256 token、top-8、512 专家,每专家 4 行 —— 差 10 倍,而 megablox 的 bf16_bf16_tile_m = 1288,192 个 token 才填满一块。TPU 的 megablox 是重复执行边界块而不是补零,形状上不同、账是一样的。所以 EP 的第一价值不是省通信,是把段拼长;而这也解释了为什么 E 卡里那 123 µs 的浪费已经和权重地板同量级。GB200 在 EP8 上做到 55.6% MBU —— 我们 decode 侧的 MBU 是多少,目前没有能算出它的数(缺 batch 和上下文长度),但这是两边口径可比的量,值得测一个出来。 The worst rung in the GB200 set is 40 rows per expert. One decode step here is 256 tokens, top-8, 512 experts — 4 rows per expert, 10× worse, against a megablox bf16_bf16_tile_m = 128 that needs 8,192 tokens to fill a single tile. TPU megablox re-executes boundary tiles rather than zero-padding them; different shape, same bill. So the first value of EP is not saving communication, it is making the segments longer — and it is why the 123 µs of waste in card E is already the same order as the weight floor. GB200 reaches 55.6% MBU at EP8; what our decode MBU is, we currently cannot compute (batch and context length are both missing) — but it is a like-for-like quantity across the two platforms and worth measuring.
🧾 三条对这份报告的口径批注(按专题二 §8「自曝台账」的规矩摆出来)🧾 Three caliber notes on that report (posted the way topic-02 §8's self-audit ledger requires)
E2E 投影表的单位错了。表头写 GDN (ns) 320Per-layer (ns) 688,但 688 ns × 60 层 = 41.3 µs,而 Total 行写的是 41 ms。四组全部验过(41.27 / 67.52 / 42.94 / 74.54 对表里的 41 / 67 / 43 / 75)—— 那一列应该是 µs。差 1000 倍,而它长得完全正常。
投影把 15 层全注意力整个漏掉了。它假设 60 层全是 GDN + MoE;真实结构是 45 GDN + 15 FA,而 FA 层在 decode 还要读 KV。41 ms 是地板,不是估计。
全文没有一处写序列长度。hybrid 模型的 decode benchmark 不写上下文长度 —— GDN 的开销与上下文无关(这正是线性注意力的卖点),FA 层的开销与上下文成正比,而 FA 层不在表里。所以这个 TPOT 既不能外推,也不能和我们的数比。
再用 §6 三问打它一遍:① 分母是 legacy DeepEP,没说调没调过(被替换方 vs 主推方,典型不对等);② 没说两边各调了多久;③ 报的既不是吞吐也不是 MFU,是孤立 kernel 延迟。这三条同样适用于任何人来打我们这份文件。
The E2E projection table has the wrong unit. The headers read GDN (ns) 320 and Per-layer (ns) 688, but 688 ns × 60 layers = 41.3 µs, while the Total row prints 41 ms. All four configs check out (41.27 / 67.52 / 42.94 / 74.54 against the printed 41 / 67 / 43 / 75) — that column must be µs. A factor of 1000, and it looks entirely normal.
The projection drops all 15 full-attention layers. It models 60 layers of GDN + MoE; the real structure is 45 GDN + 15 FA, and the FA layers also read KV at decode. 41 ms is a floor, not an estimate.
No sequence length appears anywhere in the report. A decode benchmark of a hybrid model without a context length is uninterpretable — GDN cost is context-independent (that is the whole selling point of linear attention), FA cost is proportional to context, and the FA layers are not in the table. So this TPOT can neither be extrapolated nor compared against ours.
Run §6's three questions over it as well: ① the denominator is legacy DeepEP and the report never says whether it was tuned (the replaced side against the promoted side — the classic asymmetry); ② no statement of how long either side was tuned; ③ what is reported is neither throughput nor MFU but isolated kernel latency. The same three questions apply to anyone auditing this document.
📉 G · 明写在账上的妥协与欠账 G · Compromises and debts, written on the ledger
讲义说三招的共同形状是「把一个动态换成一批静态」。这个部署照做了(chunked prefill 固定 16K 块、SEQ_ON_LANE 选定序列住哪一维、多套预编译拓扑 PCP8→DP8 / DP16 / TP2DP4EP8 / TP2DP8EP16 / P4D4),但换来的静态性是有代价的: The lecture's three techniques share one shape: replace one dynamic thing with a handful of static ones. This deployment does exactly that (chunked prefill fixed at 16K blocks, SEQ_ON_LANE choosing which axis the sequence lives on, and a set of pre-compiled topologies: PCP8→DP8 / DP16 / TP2DP4EP8 / TP2DP8EP16 / P4D4). But that static-ness was bought:
换到了什么What was gained 付出了什么What it cost 状态Status
规整访存(不必打稀疏 gather 那场仗)Regular access — no sparse-gather battle to fight 放弃旋钮②,也放弃 MLA;两条公认有效的路线留在桌上Knob ② abandoned, and MLA with it — two proven routes left on the table 设计取舍By design
吞吐(5,650 tok/s decode · 44k tok/s prefill)Throughput (5,650 tok/s decode, 44k tok/s prefill) prefill abort 仍未实现;lease 机制仍是 open workstream;2 小时压测未验证且 tpu-sync 有泄漏Prefill abort still unimplemented; the lease mechanism is still an open workstream; the 2-hour stress run is unverified and tpu-sync leaks 可用性欠账Availability debt
PD 分离(prefill 与 decode 各自打满)PD disaggregation (each phase saturated independently) 跨节点 KV 重分布;带宽只兑现线速的 50%,双网卡未交付Cross-node KV redistribution; only 50% of line rate delivered, dual-NIC still missing 部分兑现Partly delivered
下一档扩容(PCP16TP2 → DCP32)The next scale-up (PCP16TP2 → DCP32) all-gather −30% E2E、44k vs 60k tok/s 目标、VMEM 估算 bug、PCP16TP2 正确性 —— 阻塞项清一色是第三个房间的东西,没有一个是显存或算力All-gather at −30% E2E, 44k against a 60k tok/s target, a VMEM estimation bug, PCP16TP2 correctness — every blocker lives in the third room; not one is memory or compute 阻塞中Blocked
⭐⭐ 一句话收全页:这个案例是那条主线的一个完整样本 —— 它在旋钮① 上保守、在③ 上激进、在② 上主动弃权,用「不要 gather」换「要规整」; 然后把几乎全部工程预算投进第三个房间,拿到了 8.3× 这种只靠摆放方式的收益; 而它交的学费是 PD 带宽只兑现一半、可用性欠账,以及一张已经不在注意力上的账单 —— prefill 里 MoE 占了 66.7%。 而 decode 那一本账更硬:6.7 ms 的权重地板连调优的余地都不给,只有把权重变成 4 bit 才动得了它。 ⭐⭐ The page in one sentence: this case is a complete specimen of that storyline — conservative on knob ①, aggressive on ③, abstaining on ②, trading away gathers to keep access regular; then pouring nearly the whole engineering budget into the third room, where a 8.3× came from arrangement alone. The tuition paid: half the PD bandwidth, an availability debt, and a bill that no longer sits on attention — at prefill, MoE holds 66.7% of it. The decode ledger is harder still: a 6.7 ms weight floor that leaves no room for tuning at all — only 4-bit weights move it.