110 lines
6.2 KiB
Markdown
110 lines
6.2 KiB
Markdown
# 实验 EXP-TP2-PREFILL-SERVING:TP2 base-prefill residual 是否来自 serving-path MoE
|
||
|
||
> **状态:** 完成;机制 PASS,global constant injection FAIL
|
||
>
|
||
> Parent campaign:[`../frontier-simulator-gap-campaign-v0/README.md`](../frontier-simulator-gap-campaign-v0/README.md)
|
||
|
||
## Claim 与决策
|
||
|
||
- **Parent claim:** structured predictor 后,单请求 q8k/ctx0 的 TP2 sim chunk
|
||
仍为 356 ms,而 real anchor 为 410 ms(−13.1%);TP4 为 231.3 vs
|
||
231 ms。剩余量是 TP2 独有的 base serving-path residual。
|
||
- **目的:** 判断约 54 ms/chunk 是否可由 TP2 prefill MoE 的
|
||
tactic/warmup/routing/serving composition 工程修复。
|
||
- **Competing hypotheses:**
|
||
- H1:standalone grouped-GEMM 在 TP2 的 q8k expert shape 上过于乐观;
|
||
warm real-routing 或 serving-path trace 会比当前 171.1 ms/chunk 高 ≥10%。
|
||
- H2:MoE 三臂接近,残差位于其它 whole-layer/host/event path。
|
||
- **事前预测:** 若 H1 成立,serving-path MoE 增量接近 54 ms,并且只注入
|
||
TP2 row 后 chunk0 residual 降至 ≤5%;若 H2 成立,三臂差异 <10%。
|
||
- **判定规则:**
|
||
- 先用一个 TP2 q8k smoke 验证 prefill execute annotation 与 kernel
|
||
component 可提取。
|
||
- B/C 相对 A 都无稳定 ≥10% shift → 停止 profile 注入,转 whole-layer。
|
||
- C 解释 ≥70% 的 54 ms residual → 注入 TP2,重放两个 TP2 trace cell。
|
||
|
||
## Setup
|
||
|
||
- **自变量:**
|
||
- A:当前 Frontier standalone profile/predictor,TP2 q8k/ctx0
|
||
`moe_grouped_gemm=171.118 ms/chunk`。
|
||
- B:相同 expert GEMM shapes,充分 warmup/autotune,使用 serving trace
|
||
抽取的 routing allocation。
|
||
- C:vLLM 0.20 graph-aligned serving path 的 q8k prefill execute,按最慢
|
||
TP rank 汇总 MoE kernels。
|
||
- **控制变量:** Qwen3-30B-A3B BF16;H20;TP2/EP1;q8k/ctx0;同模型、
|
||
runtime、FlashInfer workspace、CUDA/driver;TP4 仅作 control anchor。
|
||
- **Hardware:** 只用 `dash1`--`dash4`;运行前要求目标主机 8×H20 全部
|
||
idle/healthy。每个 arm fresh process,避免 profiler one-shot 与 tactic cache
|
||
交叉污染。
|
||
- **Smoke contract:** q8192→2,TP2,8192 max batched tokens;同一 fresh
|
||
process 先执行 2 次 profiler-off warmup,再 profile 1 次请求。每个 rank
|
||
选择 duration 最大的 `execute_*` annotation 作为 prefill window,critical
|
||
path 取 wall 最大的 rank。
|
||
- **Metrics:** chunk execute wall;MoE/attention/collective/other kernel ms;
|
||
最慢 rank;独立 process repeat;注入后的 chunk residual 与 TTFT/E2E。
|
||
|
||
## 预期产物与 review
|
||
|
||
- **预期数据:** `results/entry-audit.json`;三臂 trace/provenance;component
|
||
对照;TP2 counterfactual replay。
|
||
- **Figure prototype:** `figure-prototype.png`;左图为 TP2/TP4 q8k chunk
|
||
real vs sim,右图为三臂 MoE 事前预测。
|
||
- **人工 review:** campaign 已批准;entry gate 已通过。
|
||
- **Review 意见:** 先单 TP2 smoke;只有 annotation 与 component contract
|
||
通过才扩为 repeat/control,不先铺满 GPU 网格。
|
||
|
||
## 复现信息
|
||
|
||
- **Code:** 当前 aituner worktree;serving profiler 复用
|
||
`runs/frontier-component-residual-v0` 的 vLLM/Kineto harness。
|
||
- **Environment:** vLLM 0.20.0;H20;remote repo
|
||
`/home/admin/cpfs/wjh/aituner/aituner`。
|
||
- **产物路径:** 本目录。
|
||
- **已知 deviation:** real 410/231 ms 是已冻结的 pure-prefill chunk anchor;
|
||
本实验不重新声称它来自当前 1h trace 的在线 batch。
|
||
- **远端 checkout deviation:** dash1 的 canonical checkout 在 `main` 且
|
||
存在大量无关 dirty/staged changes,不能安全 pull。正式 job 使用同一 Git
|
||
repository 从 `origin/feature/sim` commit 建立的相邻 detached worktree
|
||
`/home/admin/cpfs/wjh/aituner/aituner-frontier-tp2-prefill-serving-v0`;
|
||
不修改 canonical checkout。
|
||
- **Fleet sync deviation:** dash1 未安装 `rsync`。fleet mandatory sync 使用
|
||
`scp` 一个已校验为空的 `/tmp/frontier-tp2-prefill-serving-v0-empty-sync`
|
||
目录;实验代码仍只来自上述 Git worktree。
|
||
- **FlashInfer cache deviation:** v0 使用空 workspace 冷构建
|
||
`fused_moe_90`,约 8 分钟仅完成 4/181 objects,且尚未发请求,因此主动
|
||
终止(exit 141)。v1 改用此前 component profile 在同一 dash1、同一
|
||
FlashInfer `0.6.8.post1/sm90a` 构建的
|
||
`/tmp/frontier-component-flashinfer-v4`;仍保留 2 次 profiler-off serving
|
||
warmup,所有计时发生在 warmup 后。
|
||
|
||
## 结果
|
||
|
||
- **Entry audit:** PASS。TP2 q8k/ctx0 structured sim=`356.25 ms`,
|
||
real=`410 ms`,bias=`−13.11%`;TP4=`231.33 vs 231 ms`。TP2
|
||
component ledger 中 MoE=`171.12 ms`,若单独解释 residual 需增至约
|
||
`224.9 ms`(+31.4%)。
|
||
- **观察事实:**
|
||
- TP2 q8192 profile execute=`408.19 ms`,冻结 real anchor=`410 ms`;
|
||
两个 TP rank 分别为 `408.19/407.34 ms`。
|
||
- critical-rank attention=`99.67 ms`,sim attention execution=`100.24 ms`;
|
||
serving MoE=`214.52 ms`,sim MoE=`171.12 ms`。
|
||
- MoE delta=`43.41 ms`,解释 total residual 的 `80.75%`;MoE-only
|
||
counterfactual total=`399.65 ms`(相对 real `−2.52%`)。三个事前 smoke
|
||
gate 全部 PASS。
|
||
- 但把 q8k ratio `1.25366×` 用作所有 TP2 prefill shape 的常数 scale
|
||
后,ρ=0.0025 的 TTFT mean `−4.54%→+5.23%`、p99
|
||
`−7.67%→+0.89%`,E2E mean `+12.70%→+15.55%`;ρ=0.005 的
|
||
TTFT mean `−7.08%→+3.13%`,E2E mean `+5.02%→+9.14%`。
|
||
- **Fleet preflight(2026-07-23):** dash1--dash4 均为 8×H20;32 张卡
|
||
`memory.used=0 MiB`、`utilization=0%`,无 compute process。dry-run 选择
|
||
`dash1:[0,1]`,正式 job 已 pin 到 dash1。
|
||
- **含义:** TP2 base residual 的主要机制确实是 serving-path MoE,而不是
|
||
attention 或 real-anchor 噪声;但单个 q8k 点不能外推成全 prefill-domain
|
||
constant calibration。
|
||
- **Claim update:** “TP2 prefill MoE 尚有明显工程可优化 gap”得到支持;
|
||
“用一个 TP2 常数 scale 即可修复 trace fidelity”被否定。
|
||
- **下一步:** 将后续工程项收窄为 TP2 token/routing-conditioned serving
|
||
MoE curve(至少 q2k/q4k/q8k 与真实 routing allocation),不合入当前
|
||
global scale;campaign 继续实验 3。
|