STRATA_BATCH_DF2=1 with pipelined batch groups: the slot drafters bind, cost nothing at one request, and the engine dies on the first two that overlap

未关闭
#7,355 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp

调研方向

Start in program/generate.cpp around the batch_df2_wanted guard at lines 7765–7768 and the pipelined batch refusal near 7788. Trace how batch_groups_for(false) determines the group mode, then inspect the batch window capture and set_batch_taps paths around lines 13300 and 13413. Reproduce with the provided two concurrent request setup; done means pipelined groups no longer crash and the c=2 requests return 200.

由索引模型根据 Issue 内容生成。

描述

needs-format
STRATA_BATCH_DF2=1 with pipelined groups: the drafters bind, cost nothing alone, and the engine dies on the first two requests that overlap

Summary. On a layer split whose batch slots run as pipelined groups (the 0.2.7 NVIDIA default),
forcing the slots' DFlash2 drafters on with STRATA_BATCH_DF2=1 gets them allocated and bound - and
the first time two requests are in flight the engine process is gone. It is not a slow path or a
refusal: the serve layer answers 503 the engine stopped unexpectedly (process exited), and the next
request starts a fresh engine. Single-stream it is completely free, which is what makes it easy to
ship by accident.

Where the guard is. program/generate.cpp:

const bool batch_df2_wanted = [&] {
    const char* e = std::getenv("STRATA_BATCH_DF2");
    const bool off    = e != nullptr && e[0] == '0';
    const bool forced = e != nullptr && e[0] != '0' && e[0] != '\0';
    ...
    if (off || !(o.draft == "dflash2" && !o.draft_auto && o.batch >= 2 && o.serve && !split_same)) return false;
    if (forced) return true;                                  // <-- 7765: returns before any group check
    return stages.empty() || batch_groups_for(false).groups <= 1;   // <-- 7768: what the comment describes
}();

The comment above it says the pipelined groups keep their undrafted slots, and 7768 is the code
that implements that - but forced short-circuits ahead of it, so an explicit STRATA_BATCH_DF2=1
asks the pipelined window loop for slot drafts it was never written to carry. The --batch-mtp
refusal at 7788 (a layer split with --batch pipelines the slots in groups by default and the pipelined groups run no slot drafts) does not fire either, because its condition is
groups > 1 && !mtp_piped and STRATA_PIPED_MTP=1 sets mtp_piped. So nothing objects:

strata generate: STRATA_BATCH_DF2: 2 slot drafters on CUDA1 (... MiB of private K/V ring and buffers each, ...)
strata serve: STRATA_BATCH_DF2: 2 slot drafters ready (batch windows carry each slot's token and its spare-row drafts)

and the expert cache is unaffected (4954 CUDA0 / 5123 CUDA1 slots, the same as without them).

Environment. Engine 0.1.66, tree HEAD-6c6c22d8 built for sm_86, Linux, 2x RTX 3090 24 GB, layer
split 24/48, Swift-1.5 Qwen3.8-Flash-Next Unsloth UD-Q4_K_XL, --serve, --max-context 524288,
--kv int8, --mtp .../mtp/rt, --draft dflash2 (tuned pack), --spec 6, batch 2 slots with
--batch-groups at its default (the boot reports --batch-groups auto: 2 groups of 1 slot), env
STRATA_BATCH_MTP=1 STRATA_PIPED_MTP=1. The only difference from the shape we run day to day is the
added STRATA_BATCH_DF2=1.

Reproduction. Boot with the above, then hit /v1/chat/completions (max_tokens 48, not
streaming): one request alone, then two simultaneously, then four, then one again.

leg STRATA_BATCH_DF2=1 same boot minus that one env var
1 request 200 in 1.14 s 200 in 1.17 s
2 concurrent 503 in 2.33 s - {"error": {"type": "server_error", "message": "the engine stopped unexpectedly (process exited; status unavailable): ..."}} 200, 200 (1.26 s, 1.24 s)
4 concurrent 503 in 49.93 s 200 x4 (0.92-2.35 s)
1 request again 200 in 48.64 s (after the restart) 200 in 0.76 s

Observed on 3 of 3 boots with the force on (twice through a concurrency rig at c=2, once through the
probe above), and the control column is the same window, immediately after, so it is not a level
shift or the harness.

The line before the death. Every fatal leg has the same last two lines, and they look wrong on
their own:

strata serve: KV streaming: 98.47% of 10956 block reads hit VRAM, 0.7 MiB read from RAM
strata verify: captured the batch window over slots 0,0
strata verify: captured the batch window over slots 0,0

captured the batch window over slots 0,0 - one window whose slot list holds the same slot twice,
where the normal shape is a window per slot (over slots 0 and over slots 1 in the same boot). In
our retained engine log that string appears 180 times, all of them inside the forced boots; a control
boot on the shipped shape prints captured the batch window 4 times and slots 0,0 zero times. The
process then exits without printing anything else: no assertion text, no CUDA error, nothing in the
kernel journal, and no systemd exit record (the engine is a child of the serve wrapper, so the wrapper
can only say status unavailable).

What we would want from upstream. Either reading is defensible and both beat the present
behaviour:

  1. make 7765 honour the group mode the comment describes (forced still cannot beat
    batch_groups_for(false).groups > 1, with the existing 7800 WARNING: ... is off: line saying so), or
  2. make the pipelined window actually carry the taps (set_batch_taps, 13300 / 13413) over one slot
    per group, since the row budget is the same shape the MTP proposals already use with
    STRATA_PIPED_MTP=1.

2 is the one worth having: on this box the pipelined groups run DFlash2's slots without drafts,
which is worth 26 % of aggregate throughput at 2 concurrent requests - c=2 131 tok/s undrafted vs
165 tok/s with MTP drafting the same groups, with single-stream code decode 137 vs 121 in the other
direction. A drafted pipelined DFlash2 window would be the best of both, so this is not just a crash
report.

Not attempted. We did not bisect or patch it; the forced shape is not in use here and we have
ruled it out of our serving config until it is fixed. Happy to re-run either fix on this box - the
probe above is the whole test, and the gate is simply "does c=2 return 200".

主要语言
C++
星标
11.6k
派生
1k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Niko1221/Strata 的其他 Issue

查看 Niko1221/Strata 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。