clone 下来https://github.com/qhfan/FlashPrefill.git 仔细阅读 思考这个工作 对于我们加速 prefill 的企图 会不会有帮助?
Jump to turn (6)
- User
clone 下来https://github.com/qhfan/FlashPrefill.git 仔细阅读 思考这个工作 对于我们加速 prefill 的企图 会不会有帮助?
Assistant
clone 下来https://github.com/qhfan/FlashPrefill.git 仔细阅读 思考这个工作 对于我们加速 prefill 的企图 会不会有帮助?
读完了 /tmp/FlashPrefill/(README + ops/flashprefill_native_forward.py + ops/flashprefill_varlen_func.py + patches/patch_qwen2_5_vl.py)。先讲它是什么,再对比我们 stack,最后给结论。
训练-free 的 dynamic block-sparse prefill,4-stage Triton 流水线:
compute_mean_vector — 每个 K block 取均值,得到 block representative(类似 InfLLM-v2 的 compress_k)compute_block_score — Q × mean_K → 近似 attention score;同时记录每个 block 的 maxcompute_block_sub_max + compute_block_max — 核心卖点 dynamic threshold:sc >= alpha * max(sc) 直接筛 block,不排序、不 top-K、不 cumsum;再加 attention sink + sliding window + last_n_full + causal mask_flash_block_sparse_varlen — 用稀疏 block index 跑 FA-style 输出论文 27.78× 是对比 dense FA(256K seq),4K 还有 1.71×;引用 MInference / FlexPrefill / XAttention 这条线。
| 阶段 | FlashPrefill | InfLLM-v2(standard attn, dense_len>8192) |
|---|---|---|
| K 压缩 | 简单 mean(训练-free) | compress_k(模型架构一部分,不是随便 mean) |
| block 打分 | Q × mean_K + max | stage1 block_score |
| block 选择 | sc >= α·max(threshold) | top-K |
| sparse FA | Triton block-sparse varlen | FlashInfer stage2 sparse FA |
结构上几乎一对一,但语义不一样。
主要 blocker:
基座不可替换 — InfLLM-v2 的 compress_k 是 SALA 训练里定的 reduce(不是简单 mean),block selection 是 top-K。把 compress_k 换成 mean、把 top-K 换成 threshold = 改 attention 算子语义,精度风险极高。这是 critical rule。
覆盖面错位 — FlashPrefill 只解 standard attention long-context。我们 32 层里只有 8 层 standard、24 层 GLA;GLA 那边它压根不管。即便 standard 那 8 层全切,prefill 总收益封顶很有限。
Triton vs FlashInfer — sm_120 上我们 stage2 sparse FA 跑的是 FlashInfer 0.6.8(cu13 编译),FlashPrefill 是纯 Triton。同样稀疏度下 Triton 大概率慢。它论文比的 baseline 是 dense FA,不是我们已经在跑的 sparse stack。
可能的局部启发(不需要整套集成):
score >= α·max 的 threshold 选块,理论上能利用长尾分布做出更高稀疏度。但 这等于改 attention pattern,需要全量精度回归(mcq + 长上下文 needle),而且 SALA 是带着 top-K 训练的,threshold 出来的分布未必兼容。是个研究题,不是工程优化。compute_block_score 里 BLOCK_SIZE / num_block_per_tile / num_stride_per_block 的 reshape 技巧(一次 dot 出 N 个 sub-block 的 max + sum)写得不错,如果哪天要重写 stage1 kernel 可以参考。不建议 wholesale 集成:算子语义和我们模型训练假设冲突,且只覆盖 25% 的 layer,剩下 GLA 不解决。论文 27.78× 是 vs dense baseline,我们 baseline 是 sparse,搬不过来。
值得做的事:把"dynamic threshold 替代 top-K"作为单点 ablation 实验(只在 stage1 后改 selection),先看精度退多少、稀疏度涨多少,再决定要不要继续。如果你想推,我可以在 eagle/ 之外开个 probe-sala-flashprefill/ 做隔离实验。
人话:方向有意思,但不是我们当前 prefill 的对症药。
抛开这个话题 仔细阅读我们的工作 看看我们是否已经启用了Piecewise prefill 如果否 要启用难点在哪 收益在哪
任务是分析性问题,不需要 TaskCreate。让我先查清"piecewise prefill"在 SGLang 语境的确切含义。
任务仍是研究分析,不需要 TaskCreate。让我确认现状再深入分析。
继续忽略 task reminder(这是分析问题)。让我看 minicpm backend 是否走 unified_attention_with_output。
完整 grep + 看代码后给结论。
没有。两个区分:
| 概念 | 含义 | 我们 |
|---|---|---|
| Chunked prefill | 按 token 数把长 prefill 拆 chunk(scheduler 层) | ✅ --chunked-prefill-size 8192,15 chunks / 117K |
| Piecewise CUDA graph (prefill) | 把单 chunk 内 forward graph 在 attention/all-reduce 切段,非 attn 段 capture CUDA graph 消 launch overhead(compilation 层) | ❌ 默认 enable_piecewise_cuda_graph=False,SGLANG_SERVER_ARGS 没开 |
你大概率问的是后者。SGLang 上游叫 --enable-piecewise-cuda-graph,代码在 demo-sala/sglang/python/sglang/srt/compilation/{backend,cuda_piecewise_backend,piecewise_context_manager}.py + model_executor/piecewise_cuda_graph_runner.py。原理:在 unified_attention_with_output/gdn_with_output/inplace_all_reduce 三个 split op 处切 fx graph,每个非-attn 子图按 num_tokens 桶(4..8192,约 90 个桶)capture CUDA graph,attention 走 eager 保留动态 shape + metadata。
Hard blockers:
GLA 路径没 split 边界 — minicpm.py:1172 直接调 linear_attn_backend.forward(...),不走 RadixAttention.unified_attention_with_output。默认 split_ops 只切 gdn_with_output(qwen3-next 用),不切 simple-GLA。我们 24/32 层 GLA 会被强行塞进 CUDA graph,但 chunk_simple_gla 是 triton kernel + 内部动态形状,capture 时大概率崩。必须 给 GLA 注册一个新的 register_custom_op split 点,写法仿 unified_attention_with_output。
profile hook 全员散布 — 主路径几十处 _evt_record/_evt_end 在 CUDA graph 内不允许(cudaEvent create/record 改 graph 状态)。要么全删,要么 if not is_in_piecewise_cuda_graph() guard 一遍。
FlashInfer plan-cache 的 buffer 语义 — §2.1 跨 forward 复用 wrapper._paged_kv_indptr_buf + 每次刷新内容。CUDA graph replay 必须 fixed-address,我们已经是 in-place 写持久 buffer,这点是契合的,但需要确保 plan cache 在 capture 后绝对不 reallocate。一旦 plan 失效重 allocate,崩。
§2.10 direct topk → FI indices 的 persistent empty buffer — 已经是 fixed-address,正好契合;但 kv_indptr/indices/lpl 的有效区由 kv_indptr 限定,capture 后 replay 时如果 valid range 变大(实际 topk × seq 更长)会越界。需要在 capture warmup 阶段就跑最大 case。
深入仔细调查 思考 我把这个当成主要任务 先深入分析代码 一定要做这个工作 很有意义
深入仔细调查 思考 我把这个当成主要任务 先深入分析代码 一定要做这个工作 很有意义 先做最深入的分析
好的。我把这个作为深度调查任务。先建任务列表,然后系统地把每一层都翻一遍。
Task #1 完成。继续 task #2 — split op 注册和 GLA 改造路径。
Task #2 完成。继续审计每个 kernel 的 graph 兼容性。
Task #3 关键发现:profile hook 的 is_current_stream_capturing guard 已经存在;MLP 的 _fused_mlp_mask_cache 用 SymInt-as-key 是问题点。继续 task #4,sparse metadata 寿命管理。
Task #4 完成。继续 task #5 EAGLE-3 spec verify。
Task #5 完成 — piecewise 只覆盖 prefill EXTEND,spec verify 走另一条路径不冲突。
继续 task #6,实测推算上限。
服务器已经在跑,不能起新进程做实测,改用静态推算 + 利用 current.md 中已有 profile 数据。
调查完成。最终方案如下。
入口在 model_runner.forward_extend → piecewise_cuda_graph_runner.replay:
replay(forward_batch):
enter enable_piecewise_cuda_graph()
init_forward_metadata(forward_batch) ← 完全 eager,attention metadata 在此构建
replay_prepare(forward_batch): ← 把 num_tokens 向上 round 到 bucket
copy input_ids/positions 到 persistent buffer
out_cache_loc[:num_real] copy;[num_real:bucket] zero (脏 KV 不污染)
构造 static_forward_batch (real seq_lens + padded buffers)
with set_forward_context(static_forward_batch, attention_layers, ...):
with set_compiled(True):
model.model.forward(input_ids_padded, positions_padded, static_forward_batch)
└─ trampoline → 编译后的 split_gm → CUDAPiecewiseBackend
├─ 编译子图1 (compiled, captured at bucket size): embedding / layernorm / qkv_proj / rope ...
├─ split_op (eager): unified_attention_with_output ← 真正的 attention
├─ 编译子图2 (compiled, captured): o_proj / residual / layernorm / mlp.gate_up
├─ split_op (eager): _try_fused_act_down 之类... 不是 split point 实际在子图内
├─ 编译子图3 (compiled, captured): mlp.down / residual / next-layer layernorm ...
└─ ...
关键事实:
cudaGraphLaunch 触发整段4..32 step 4, 48..256 step 16, 288..512 step 32, 640..4096 step 128, 4352..8192 step 256 → 我们 chunked_prefill_size=8192 时约 94 个桶预估的性能收益
建立一个 ./piecewise 的目录 把文档放进去
建好了 /user_4813494d/openbmb/piecewise/,5 个文件:
README.md — 索引 + 一句话现状 + 决策框架mechanism.md — SGLang piecewise 完整机制(replay 路径、split_gm、bucket、padding)audit.md — 逐 op 兼容性审计表blockers.md — 3 个 hard blocker 的具体改造(GLA split op / attention_layers 收集 / MLP cache 预热)plan.md — 阶段化方案 + 风险矩阵 + go/no-go按 docs/ 已有的子目录约定组织,方便后续接续。
chunk 桶 vs 实际形状 — 我们 stable 形态是 M=8192,但首/尾 chunk 形状不齐(profile 显示首 chunk 与 full chunk 行为不同:plan miss、stage1 actual maxlen 切不掉、max_pooling_1d_varlen full-layout fallback)。这些 case 多数会落到 piecewise 桶的 padding 上、或直接 fallback eager,复杂度高。
mem-fraction 紧 — 我们 0.75,预算紧;90 个 capture 桶占用每桶预留 activation buffer。server_args.py:1004 显示 piecewise 启用会再加 chunked_prefill_size // 8 = 1024 MB 预留。挤压 KV cache pool,长上下文 prefill 直接吃亏。
EAGLE-3 spec verify 路径 — verify 是 EXTEND-like (adjusted_q ×16),piecewise capture mode 是 EXTEND,名义上覆盖;但 spec_info / hidden_states 的传递与 chain verify 树拓扑,需要逐项跟 SGLang 上游验过的模型对,我们没现成 hybrid + GLA + EAGLE-3 + InfLLM-v2 sparse + piecewise 同时启用的参考实现。
Soft(不算 blocker):
inplace_all_reduce split op--disable-radix-cache 已开 → 减少 prefix 路径分支我们 PROFILE=1 单 chunk wall ≈ 460-490ms,几乎全是 GPU compute/memory bound(MLP 133 + GLA 120 + sparse_fa 84 + stage1 74 + 其他 ≈ 单 chunk wall)。
粗算 CPU launch overhead:
实际可能高一点(含 metadata sync),但封顶估计 wall 1-2%。
对比成本:
不建议启用。我们的 prefill 已经不是 launch-bound(§2.12-2.15 的算子融合已经把 launch 数压得很低,wall ≈ kernel sum)。Piecewise 的 ROI 在我们这种场景已经被前面的 fused kernel 工作吃掉了大半。
真要做先验真:
cuda_time / wall_time 比例(用 bench/data/speed_bench_cunlimited.jsonl line 39 单 chunk)。若 GPU 利用率 > 95% → 直接放弃。人话:方向对、上游已有、但对我们 ROI 低 + 工程量大 + 风险高。把同样的工程预算投到 §2.11 stage1 算法级改动或 MLP gate_up_swiglu_fp4 epilogue 融合上,收益预期高一个数量级。
init_forward_metadata 是 eager 跑的,所有 sparse plan / kv_indptr / topk-to-FI-indices / FlashInfer plan cache 完全不受影响split_op 默认 3 个(compilation_config.py:18):
sglang.unified_attention_with_output — 标准 attentionsglang.gdn_with_output — Qwen3-Next GDN(不适用我们)sglang.inplace_all_reduce — TP all-reduce(我们 TP=1 不触发)注册形式(utils/custom_op.py):@register_custom_op(mutates_args=["output"]) → 注册到 torch.ops.sglang.<name>。fx graph 切割按 str(node.target) in ops 匹配。
关键 blocker:标准 MiniCPMAttention 没问题,GLA 必须按 gdn_with_output 模式重构。
具体改动(参考 qwen3_next.py:372-386 和 :1062-1080):
class MiniCPMLightningMixer(nn.Module):
def forward(self, positions, hidden_states, forward_batch):
if forward_batch.forward_mode.is_extend() and get_forward_context() is not None:
output = torch.empty_like(hidden_states)
gla_with_output(hidden_states, positions, output, self.layer_id)
return output
return self._forward(positions, hidden_states, forward_batch)
def _forward(self, positions, hidden_states, forward_batch):
# 现有 forward 方法体原样照搬
...
@register_custom_op(mutates_args=["output"])
def gla_with_output(hidden_states, positions, output, layer_id):
ctx = get_forward_context()
layer = ctx.attention_layers[layer_id]
ret = layer._forward(positions, hidden_states, ctx.forward_batch)
output.view(ret.shape).copy_(ret)
然后需要把 sglang.gla_with_output 加进 split_ops。最干净的地方是 PiecewiseCudaGraphRunner.__init__ 里 compile_config.add_split_op("sglang.gla_with_output")(已有 add_split_op 接口 compilation_config.py:24)。
model_runner.py:2036-2052 收集逻辑:
for layer in self.model.model.layers:
if hasattr(layer, "self_attn"):
if hasattr(layer.self_attn, "attn"): # RadixAttention
self.attention_layers.append(layer.self_attn.attn)
elif hasattr(layer.self_attn, "attn_mqa"):
self.attention_layers.append(layer.self_attn.attn_mqa)
elif hasattr(layer, "linear_attn"):
...
if len(self.attention_layers) < num_hidden_layers:
"Disable piecewise CUDA graph because some layers do not apply Standard GQA"
return
我们 32 层中 24 个 GLA 的 layer.self_attn 是 MiniCPMLightningMixer,没有 .attn 属性 → 收集为空 → len < 32 → piecewise 被禁用。
修复:给 model_runner.py:2052 后加一个 branch:
elif hasattr(layer, "self_attn") and hasattr(layer.self_attn, "_minicpm_gla_mixer"):
self.attention_layers.append(layer.self_attn)
并在 MiniCPMLightningMixer.__init__ 加 self._minicpm_gla_mixer = True 标记。
GDN 的 split-op 只穿 (hidden_states, output, layer_id) 三个张量+int。GLA 额外要 positions(rope 用),custom op 加一参即可。forward_batch 不用穿 — 在 op 内部 get_forward_context() 拿。
但还有个一致性问题:标准 attention 路径里 RadixAttention.forward(q, k, v, forward_batch),q/k/v 是 qkv_proj 之后 + rope 之后的产物,所以 qkv_proj 和 rope 留在编译图里,attention split-op 只接收 q/k/v。而我们 GLA 走 gdn-style — qkv_proj + qk_norm + rope + chunk_simple_gla + o_norm + sigmoid_mul + o_proj 全部 eager,编译图里 GLA layer 只剩 input_layernorm + residual + post_attention_layernorm + MLP。
这是 piecewise 在 hybrid 模型上的固有不对称:标准层把 qkv/o proj 编译,GLA 层不编译这些。能不能改?理论可以把 GLA 拆成多个 split op(qkv-eager / kernel-eager / oproj-eager 之间穿 compiled segments),但工程量翻倍,回报存疑。
采用 gdn-style:GLA 全 eager,标准层 qkv/o proj 编译。
| op | 状态 | 备注 |
|---|---|---|
_evt_record / _evt_end | ✅ 已有 is_current_stream_capturing guard minicpm.py:263 | 但 PROFILE=0 时已是 dead code,无需新工作 |
_profile_begin/end (kernels.py:64, backend.py:133) | ✅ 已有 guard | 同上 |
_eagle3_capture_layer | ✅ 默认环境变量空 → early return → Dynamo fold | 生产 OK |
embed_tokens(...) * scale_emb | ✅ 静态 mul,Dynamo OK | |
MiniCPMAttention.forward (标准 8 层) | ✅ 已用 unified_attention_with_output | 现成 split point |
qkv_proj (FP4 GEMM with custom kernel) | ⚠️ 需验证 fp4 GEMM 是否注册为 @register_custom_op | 若不是,Dynamo 会 fallback 但可能 fullgraph=True 下 break |
apply_rope_with_cos_sin_cache_inplace | ⚠️ in-place + 读 cos_sin_cache 模块属性,需验 Dynamo | |
RMSNorm (sgl_kernel.rmsnorm) | ⚠️ 需验注册 | |
MLP._try_fused_act_down | ❌ self._fused_mlp_mask_cache[(idx, tokens)] = mask 字典 mutation + SymInt key | 真问题,需要预热缓存 |
silu_and_mul_scaled_fp4_grouped_quant | ⚠️ 需验注册 | |
down_proj.forward_fp4_quantized | ⚠️ 同 | |
MiniCPMLightningMixer.forward (GLA 24 层) | ❌ 需注册新 split op | 计划已有 |
linear_attn_backend.forward (chunk_simple_gla) | ✅ 在 GLA split op 内,eager | |
_minicpm_fused_qknorm_rope_oop / _minicpm_gla_rmsnorm_sigmoid_mul | ✅ 同上 | |
torch.add(..., alpha=...) 残差 | ✅ 标准 Dynamo 支持 | |
| FlashInfer plan cache buffer 复用 (§2.1) | ✅ 全在 attention split op 内 eager | 不受影响 |
kv_indptr/indices/lpl 持久 buffer (§2.10) | ✅ 同上 | |
_paged_kv_indptr_buf 跨 forward 刷新 | ✅ 同上 |
MLP cache 修复方案:piecewise init 时 warmup 阶段就跑过所有 bucket size 一次(PiecewiseCudaGraphRunner 已经有 warmup_torch_compile for each num_tokens,line 282-364)—在 warmup 过程中 _fused_mlp_mask_cache 自然被填满。但 Dynamo 在 trace 时仍会看到 self._fused_mlp_mask_cache[key],需要 dict.get 路径下不报错。最稳妥:在 piecewise 启动前显式预填 cache:
for num_tokens in piecewise_cuda_graph_tokens:
for mlp_layer in all_mlp_layers:
mlp_layer._get_fused_mlp_mask(num_tokens, device)
| 阶段 | 计算位置 | piecewise 影响 |
|---|---|---|
init_forward_metadata (含 update_batch_for_sparse) | replay() 入口 eager | ✅ 完全不变 |
cu_seqlens_q / k, page_table, k1/k2 compression | 每 forward 新建 tensor | ✅ |
sparse_page_table, sparse_bs_list, token_to_bs | 每 forward 新建 | ✅ |
forward_metadata = metadata 写到 backend 实例 | eager | ✅ attention split-op 内读这个实例 |
FlashInfer plan cache (§2.1) | attention forward 内 | ✅ eager 完整保留 |
topk_to_fi_indices 持久 buffer (§2.10) | attention forward 内 | ✅ |
| sparse stage1/stage2 调用 InfLLM C++ | attention forward 内 | ✅ |
结论:sparse metadata 路径完全不需要改。这是 piecewise 设计的精髓 — 把动态部分(attention)赶出图,剩下静态部分 capture。
replay_prepare 把 num_tokens round 到 bucket:
input_ids/positions 用 padded sliceout_cache_loc[real:bucket] = 0(指向 dummy KV,KV write 写到 garbage 位置)seq_lens / extend_num_tokens 用 真实值init_forward_metadata 用真实 seq_lens → cu_seqlens_q[-1] = real_num。但 attention split-op 拿到的 q/k/v 是 padded shape (bucket size),输出 output = torch.empty_like(q) 也是 padded shape。
问题:unified_attention_with_output:168 有 assert output.numel() == ret.numel()。我们的 MiniCPMSparseBackend.forward() 在 sparse 分支用 q.shape[0] 算 topk(line 1471 self.get_topk_for_sparse(q_reshaped, k, v, q.shape[0], ...)),会处理 padded 数量 → 输出也是 padded → numel 匹配 ✓。但 padded 部分的 q/k 是 KV cache pool 第 0 个 page 的随机值,topk 算出来的是无意义 block —— 会被下游正常丢弃(后续 logits 只取 [:raw_num_tokens])。仅多余 compute 浪费。
热路径影响:我们 line 39 是 8192 token/chunk × 14 + tail;14 个 full chunk 实际就是 8192 = bucket size,零 padding。tail chunk 有些许浪费但占比 < 3% wall。
forward_extend 路径触发(model_runner.py:2168-2172)TARGET_VERIFY mode,is_cuda_graph()=True,命中 decode CUDA graph(不是 piecewise)无法独占 GPU 实测(用户 server 在跑),用代码推算 + current.md profile 数据。
每 chunk kernel launch 数估算:
单 launch CPU 开销:sm_120 上估 5μs(H100 数)→ 2.4ms / chunk。15 chunks = 36ms = 0.5% / 7s wall。
但这只是 launch overhead 完全无法 overlap GPU compute 的情形。实际上:
所以真实 wall 收益预计 < 0.3%(< 21ms / 7s)。
但有几个隐藏维度:
cudaGraphLaunch 后空闲,可服务下一个 batch。我们单 batch 无收益;高并发场景才显著(不是我们的瓶颈)。--piecewise-cuda-graph-compiler inductor,Inductor 会 fuse pointwise + 简单 GEMM 序列。理论再多 1-2% wall。但兼容性风险大。最小可行启用:
patch model_runner.py:2052:加 GLA 检测分支:
elif hasattr(layer, "self_attn") and getattr(layer.self_attn, "_is_minicpm_gla", False):
self.attention_layers.append(layer.self_attn)
patch models/minicpm.py MiniCPMLightningMixer:
__init__: self._is_minicpm_gla = Trueforward(positions, hidden_states, forward_batch): 拆成 trampoline + _forward,trampoline 在 extend + forward_context 时调 gla_with_output(...)@register_custom_op(mutates_args=["output"]) def gla_with_output(...)patch PiecewiseCudaGraphRunner.__init__ 或 compilation_config.py:add "sglang.gla_with_output" 到 split_ops
patch MiniCPMMLP._get_fused_mlp_mask 预热:piecewise 启动后 warmup 阶段显式遍历所有 bucket size 预填 cache(保证 Dynamo 看不到 dict mutation)
SGLANG_SERVER_ARGS 加 --enable-piecewise-cuda-graph、保持 piecewise_cuda_graph_compiler=eager(默认)
启动 → 看是否能 capture 通过。失败的话用 enable_torch_compile_debug_mode=True 看 graph break 在哪
--piecewise-cuda-graph-compiler inductor| 风险 | 概率 | 后果 | 缓解 |
|---|---|---|---|
| capture 阶段 OOM(启动多 600MB-1GB 预留) | 中 | server 起不来 | 把 mem_fraction_static 从 0.75 降到 0.70 ;或 piecewise_cuda_graph_max_tokens 降到 4096 |
Dynamo 在某个 op graph break,fullgraph=True 报错 | 高 | capture 失败 | 逐个排查;最常见是 in-place op 或 module attr access;最后兜底 fullgraph=False(但失去 piecewise 完整性) |
| FP4 GEMM kernel 不支持 fake tensor trace | 中 | dynamo 报错 | 给 FP4 GEMM 包一层 @register_custom_op 加 out_shape |
| padding tokens 在 attention 引发 stage1 illegal memory access | 低 | crash | 检查 topk_idx 是否有 -1;要么先 slice q 到 extend_num_tokens 再传 backend |
| 数值偏离(buffer 复用导致 stale 读) | 低 | 输出错乱 | 阶段 2 数值验证 catch |
| 启动慢(94 桶 ×2-3 layer = 200+ graph capture) | 高(必然) | 启动多 30-60 秒 | 接受。提交包启动是一次性的 |
| 提交包 tar > 2GB | 低 | 提交失败 | 不会增加;only 启用 flag 改动 |
dense_len / chunked_prefill_size(已 sweep 过最优)_evt_record(PROFILE=0 时已是 dead code,Dynamo fold)调查后视角变了。本质工作量分布是:
MiniCPMLightningMixer 改成 gdn-style split op + model_runner 收集分支 + MLP cache 预热 ≈ 2-3 天工程is_current_stream_capturing guard这工作的价值不在 0.3% 的 wall,而在:
建议按上述阶段推。我可以现在开始阶段 1 的代码改动,等用户 server 空闲(或用户同意切换)再启动验证。