[Experiment] GLM-5.3-NVFP4 TP4PP2 round-2 optimization: all config-level quick wins refuted (2026-09-07)
- Clean 128k/90% baseline filled (TTFT p50 14.70s, TPOT 51.7ms, hit 0.8999) - prior D-scenario bench was profiler-polluted - chunk 16384 refuted: flashinfer cutlass MoE workspace scales with chunk -> CUDA OOM (3.08GB needed vs 2.11GB free at mem-frac 0.88); physics kills the upside (AR is bandwidth-bound so call-count halving saves ~nothing; indexer q*k work is chunk-invariant) - AR overlap/quant switch scan: no usable path on TP4+PP2+SM120+PCIe (quant-communications is NPU-only via hard ValueError; flashinfer AR fusion auto-enable gated SM90/SM100; symm-mem/NVLS NVLink-oriented) - indexer direction closed: 28% at 128k is DSA's inherent cost (per-request suffix queries are unique -> no cross-request reuse; SM120 has only the deepgemm backend; model already shares topk across layers via index_topk_freq=4; ~219 TFLOPS/rank is reasonable for paged-gather) - Conclusion: current config (chunk 8192 / mem-frac 0.88 / default NCCL) is config-optimal on this stack; remaining gains are dev work: PP+MTP upstreaming (decode) > AR-chunk-overlap/quantized-AR kernel dev (prefill) - Replaced archived deploy_par_605.sh with the actual /root/deploy_par.sh from 60.5 (md5 cf405176...) - includes sglang_patch mounts
This commit is contained in:
parent
1e8c36b7d1
commit
5ed30006a5
@ -43,7 +43,15 @@ hicache-ratio 3;mem-frac 0.88;chunked-prefill 8192。忠实性:干净复
|
||||
6. **128k/90%**:DSA indexer `sm120_fp8_mqa_logits` 占 28%(PP0)/23%(PP1),是其服务的稀疏注意力本体(17%)的 1.6×;后缀有效速率 5.2k tok/s
|
||||
7. **profiler 工程发现**:flush 阻塞全流水线 11s;带 profiler 的 bench 指标作废
|
||||
|
||||
## 优化方向(排序见报告 §4)
|
||||
## 第二轮优化实验(2026-09-07):配置级方向全部证伪
|
||||
|
||||
详见 `results/analysis/optimization_round2_findings.md`。干净 128k/90% 基线补测(TTFT p50 14.70s / TPOT 51.7ms);
|
||||
chunk 16384 因 MoE 工作区 OOM(3.08GB > 2.11GB 空闲)证伪且收益主体不存在(AR 带宽受限、indexer 功不变);
|
||||
AR 现成开关扫描全部不适用(quant-comm=NPU、AR 融合=SM90/100 门控、symm-mem/NVLS=NVLink 向);
|
||||
indexer 28% 属 DSA 算法固有成本(无复用机会、SM120 仅 deepgemm、模型已做 index_topk_freq=4 跨层共享)。
|
||||
**结论:现有配置即本栈配置最优;剩余提升均为开发投入(PP+MTP > AR 重叠/量化内核)。**
|
||||
|
||||
## 优化方向(排序见报告 §4,09-07 更新)
|
||||
|
||||
① prefill AR 通信-计算重叠 / 量化 AR(协议红利已排除);② PP+MTP(decode 最大杠杆);
|
||||
③ 128k 场景 DSA indexer 前缀复用/调优;④ chunk 8192→16384 重测;⑤ MoE 胶水融合 + PP1 AG 入图;⑥ decode 尾部。
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
# 第二轮优化实验记录(2026-09-07,基于 09-06 profile 报告方向)
|
||||
|
||||
平台:174.1.60.5,TP4PP2 原样配置(deploy_par.sh chunk 8192 / mem-frac 0.88)。
|
||||
结论:**配置级快赢全部证伪,现有配置即本栈配置最优**;剩余提升均为开发投入。
|
||||
|
||||
## 1. 干净 128k/90% 基线(补缺口,此前 D 场景 bench 带 profiler 作废)
|
||||
|
||||
cc8,8×131072(90% 共享前缀)/512,run-id 20260907,hit rate 0.8999:
|
||||
|
||||
- wall 39.38s;输出 104.02 tok/s;输入 26.63k tok/s(含缓存命中)
|
||||
- **TTFT p50 14.70s**(min 4.64 / max 20.02)
|
||||
- TPOT 均值 51.7ms(p50 53.8 / max 67.9)
|
||||
- e2e 均值 39.24s;per-req 13.05 tok/s;retract 0
|
||||
|
||||
证据:results/bench/128k_clean_baseline_tp4pp2.log
|
||||
|
||||
## 2. chunk 16384 证伪(方向④关闭)
|
||||
|
||||
变体 `deploy_par.sh "<同参数>" nomtp 16384`:启动成功(日志核对 chunked_prefill_size=16384)、
|
||||
GSM8K 冒烟通过,但首个 16k 请求导致全部 8 个调度器崩溃:
|
||||
|
||||
- **根因:CUDA OOM**。flashinfer cutlass MoE `getWorkspaceInfo` 工作区随 chunk 规模增长,
|
||||
16384-token 前向需 **3.08GB**,mem-frac 0.88 下每卡仅 **2.11GB** 空闲
|
||||
(MemoryError: Tried to allocate 3.08 GiB, GPU 7 ... 2.11 GiB is free)
|
||||
- 要跑通需 mem-frac ≤0.85(KV 池 -5%),但收益主体经物理核算不存在:
|
||||
- AR 纯带宽受限(96MB/3.7ms,每次调用固定开销≈0)→"AR 次数减半"不省带宽部分
|
||||
- indexer 的 q×k 总功与 chunk 切分无关(不变量)
|
||||
- 剩余收益(调度/launch 摊薄)≤3%,在单轮 bench 噪声(±3%)内
|
||||
- 代价:KV -5% + 混合相位 Max ITL 翻倍(单次 prefill 阻塞 1.03s→2.06s)
|
||||
- 附带发现:prefill 分块图(backend=breakable)仅捕获 ≤2048 token 档位,
|
||||
8192/16384 的 extend 都走 eager_runner 逐层重放图块——chunk 增大无图红利亦无额外退化
|
||||
|
||||
证据:results/ops/chunk16k_crash_oom.log(OOM 堆栈)、results/ops/deploy_chunk16k.log、
|
||||
results/bench/chunk16k_cc16.log(bench 侧流中断)
|
||||
|
||||
## 3. AR 重叠/量化现成开关扫描(方向①降级为纯上游开发)
|
||||
|
||||
容器内 `launch_server --help` + 源码核查(sglang nightly 20260828):
|
||||
|
||||
| 开关 | 判定 |
|
||||
|---|---|
|
||||
| `--enable-quant-communications` | **NPU 专用**:server_args 校验 `device != "npu"` 直接 ValueError("only supported for NPU device") |
|
||||
| flashinfer allreduce fusion(no_cli 自动管理) | 自动启用门控 `is_sm90_supported() or is_sm100_supported()` → **SM120 被排除**;后端 trtllm/mnnvl 为 NVLink/小 batch 设计 |
|
||||
| `--enable-symm-mem` / `--enable-torch-symm-mem` | 对称内存 one-shot AR,小消息/decode 导向;96MB prefill AR 在 PCIe 不适用 |
|
||||
| `--enable-nccl-nvls` | NVLink 专用 |
|
||||
| `--pp-async-batch-depth` | PP 气泡仅 ~4%(09-06 对齐数据),非瓶颈 |
|
||||
|
||||
**结论:本栈(TP4+PP2+SM120+PCIe)不存在 prefill AR 重叠/量化的现成路径。**
|
||||
开发落点:① 分块 AR 与后续 GEMM 重叠(async-TP 式 TP linear 改造);
|
||||
② 将 flashinfer AR 融合(fp8 量化 AR+residual+norm)扩展到 SM120 与大 token 数。
|
||||
|
||||
## 4. indexer 方向关闭(方向③:本栈无杠杆)
|
||||
|
||||
- **修正 09-06 报告的原始设想**:"前缀 logits 增量缓存"不成立——每请求后缀 q 独有,
|
||||
其对共享前缀键的 logits 是该请求固有功;前缀 index-K 已由 fused_store_index_k_cache 缓存
|
||||
- 既有 skip(`_should_skip_logits_computation`)仅适用 kv_len ≤ index_topk=2048(全选即正确),
|
||||
128k 不适用且语义上必须选索引;CUDA decode 侧 skip 还被 HIP-only 门控
|
||||
- 内核后端无选择:SM120 CUDA 仅 deepgemm 可用(aiter=ROCm、cutedsl=SM100 门控);
|
||||
nomtp 走 deepgemm split 变体(native 仅 MTP target-verify)
|
||||
- 模型已做跨层省功:`index_topk_freq=4`(部分层复用上层 topk)
|
||||
- roofline:mqa_logits 9.37ms/次(D 场景 PP0)≈ 8192 新 token × ~122k kv × 2048 FLOP/pair(每 rank,
|
||||
32 头×128 维×2 / TP4) ≈ 2.05 TFLOP/rank → ~219 TFLOPS/rank fp8,paged-gather 内核的合理量级,
|
||||
无 5-10× 调优空间
|
||||
- **结论:28% 是 DSA 在 128k 的算法固有成本(扫全 kv 选 top-2048)。**
|
||||
逃逸路径(分层/粗到细索引)是影响精度的上游研究项,非本栈优化
|
||||
|
||||
## 5. 剩余可行方向(按优先级)
|
||||
|
||||
1. **PP+MTP 上游化**(decode 最大杠杆,TPOT -60%+ 潜力;楔死根因与补丁已在 60.5:/root/)
|
||||
2. **AR 分块重叠 / 量化 AR 内核开发**(prefill -15~25% 潜力;本栈无现成开关)
|
||||
3. MoE 胶水融合 + PP1 AllGather 入图(decode -2~4%)
|
||||
@ -27,7 +27,9 @@ fi
|
||||
for i in $(seq 1 15); do ss -ltn 2>/dev/null | grep -q ":30000 " || break; sleep 2; done
|
||||
|
||||
docker run -d --name glm53-nvfp4 --gpus all --shm-size 64g --ipc=host \
|
||||
--restart no -p 30000:30000 \
|
||||
-v /root/sglang_patch/server_args.py:/sgl-workspace/sglang/python/sglang/srt/server_args.py:ro \
|
||||
-v /root/sglang_patch/layer_setup.py:/sgl-workspace/sglang/python/sglang/srt/model_executor/model_runner_components/layer_setup.py:ro \
|
||||
--restart no -p 30000:30000 \
|
||||
-v /data/hf_models:/data/hf_models \
|
||||
lmsysorg/sglang:nightly-dev-20260828-daf63171 \
|
||||
python3 -m sglang.launch_server \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user