[Engine] --pipeline-windows 2 with the MTP drafter: the first non-streaming chat request fails "mtp prefill: invalid argument" and the next one exits the process

オープン
#7,269 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
32/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

Start with the reported paths in program/generate.cpp around lines 8191, 13698, 21705, and core/mtp.cpp around lines 1778–1801. Trace how pipelined MTP capture handles the non-streaming prefill row counts and how the penalty gate selects the serial loop; reproduce with the two-card setup and compare streaming and non-streaming requests. Done means the non-streaming request no longer errors or exits the process, and the pipeline runs when penalty coefficients are neutral.

索引モデルが issue の本文から書いたものです。

説明

Problem

On a two-card layer split, --pipeline-windows 2 beside the MTP drafter takes the first ordinary
non-streaming /v1/chat/completions request
down with mtp prefill: invalid argument, and the
request after it exits the engine process. Streaming requests succeed, so a streaming benchmark sees
a healthy server right up to the first client that asks for a complete response.

Separately: on the same build the pipeline is unreachable in serve mode for the traffic that a
normal client sends, for two documented reasons that compound (below). Both are worth fixing before
anyone reads the pipelined loop's numbers again.

Environment
  • Strata engine 0.1.66, tree HEAD-6c6c22d8 (6c6c22d84320eacf70a5bba3907e51dcfc96fa78, 2026-11-23), built for sm_86.
  • Linux 7.0.14-15-pve, NVIDIA driver 595.71.05, 2x RTX 3090 24 GB.
  • Qwen3.8-Flash-Next UD-Q4_K_XL GGUF, native pack, --layer-split auto (24/48), parallel: 2
    (so the start carries --batch 2), --spec 4 --mtp .../mtp/rt, --kv int8, --max-context 524288,
    --resident-budget-gib 64.
  • Started from the JSON config through the normal launcher; nothing hand-fed.
Reproduce

Boot with --serve on the above, with the drafter set to MTP, and add:

--pipeline-windows 2   (and STRATA_PW_WITH_BATCH=1, required beside --batch: see below)

Then:

POST /v1/chat/completions   {"messages":[{"role":"user","content":"List five ways a paged key-value cache saves VRAM during decode, one line each."}],"max_tokens":40,"temperature":0.6}
  -> 200 {"error":{"type":"invalid_request_error","message":"mtp prefill: invalid argument"}}

POST again, any shape
  -> {"error":{"type":"server_error","message":"the engine stopped unexpectedly (process exited; status unavailable): mtp prefill: invalid ar..."}
[strata] 2026-11-26 20:12:59 native ERR mtp prefill: invalid argument

Reproduced nine times across four boots in three separate jobs (20:12, 20:19 x3, 20:20, 20:21, 20:24, 20:26 x2). The prompt is irrelevant: 8-word, 40-word and 300-word user turns all failed identically. max_tokens 300 and 40 both failed.

What does not trigger it

Same box, same boot, five request shapes each (user turn only / streaming / system+user / explicit repeat_penalty 1.1 / max_tokens 1):

arm result
DFlash2 drafter (--draft dflash2 --draft-model ... --draft-conf 0.7) all five fine
--mtp, pipeline off (auto) all five fine
--mtp, --pipeline-windows 0 + STRATA_MTP_STAGE0=1 fine
--mtp + --pipeline-windows 2 (+ STRATA_PW_WITH_BATCH=1) error, then process exit
same arm, streaming request fine (the next non-streaming one kills it)

So it is the combination pipeline_windows >= 2 and the MTP drafter and a non-streaming
request, and it is not the STRATA_MTP_STAGE0 env on its own.

Where the error comes from

core/mtp.cpp:1791 (also 1801, 1824): the device-input prefill path, cudaGraphLaunch(prefill_dev_exec_[T], cs_)
or the sync after it returning cudaErrorInvalidValue - i.e. launching a graph that was never captured
for that row count. capture_prefill_dev() at core/mtp.cpp:~1778 returns early when
prefill_dev_exec_[T] is already set, so a shape that was never captured for the non-streaming path
reaches the launch.

program/generate.cpp:8191-8192 is where pipeline_windows >= 2 changes exactly those shapes:

const int mtp_t = o.pipeline_windows >= 2 ? strata::kernels::kVerifyNarrowT : std::min(o.spec, (int) strata::kernels::kVerifyNarrowT);
if (o.pipeline_windows >= 2) mtp.set_force_capture(true);

and program/generate.cpp:13698 only prepares the chain when pl_snap_ok:

if (o.pipeline_windows >= 2 && pl_snap_ok && !mtp.prepare_chain(e)) return false;

The non-streaming response path appears to take the device-input prefill (d_tk/d_stp, the branch
at 1780-1801) with a T the pipelined capture set never built a graph for.

Second finding: the loop never runs for real traffic, so its nulls are silent

Two gates, in order:

  1. --batch refuses it. program/generate.cpp:6567:

    strata generate: --pipeline-windows 1 is off: not with --batch slots (STRATA_PW_WITH_BATCH=1 keeps it for the solo path)
    

    observed verbatim with parallel: 2. Only STRATA_PW_WITH_BATCH=1 keeps it, and the boot then
    says batch windows run without it - so a served two-slot start never gets the two-window loop.

  2. The solo path's own gate keys on the window length, not on a real penalty.
    program/generate.cpp:21705 selects the serial loop when hist_n > 0, where
    hist_n = std::min(req_sp.penalty_last_n, kPenaltyWindowCap) (21340). Every other place that
    decides whether a penalty is actually applied requires a non-neutral coefficient:
    core/verify.cpp:5593-5599 (penalty_last_n > 0 && (penalty_repeat != 1.0f || penalty_freq != 0.0f || penalty_present != 0.0f), and it then zeroes penalty_last_n itself), and the two slot paths at
    generate.cpp:19353 and generate.cpp:23509 copy that stronger test. If a request arrives with a
    penalty_last_n window and neutral coefficients, the pipelined loop is skipped although nothing
    needs the serial loop.

    Proof it is being skipped here: all seven --pipeline-windows 2 boots printed

    strata serve: --pipeline-windows: a request with repetition penalties (penalty_last_n) decodes serially
    

    and a boot run with STRATA_DECODE_TIMING=1 printed 14 strata decode timing: lines and zero
    strata pipeline: lines
    . Those two reports are exclusive by construction - the serial one is
    behind if (!pl_ran) (23247) and the serial loop is while (!pl_ran && ...) (22557), the
    pipelined one is inside the loop (22476) - so the overlapped loop did not execute once, on any
    request, in seven boots.

Why that matters for the recorded numbers

The comment at generate.cpp:20144-20149 records the gate optimum measured on 2x RTX 3090 at
250 W
(0.2, 0.3 and 0.4 measured +7.0%, +7.8% and +7.5% over the serial loop). I could not
reproduce any of that here, and I now know why it looked flat rather than slower: the loop never ran.
What the flag did cost on this box is the reservation the boot announces -
--pipeline-windows 2: 272 MiB of CUDA0 kept out of the expert cache - which reads as 4453 CUDA0
expert slots instead of 4954, decode unchanged, and 10K-token prompt throughput 933/939/941 tok/s
against a 1789-1826 tok/s control (-47 %)
. A reviewer reading a "pipeline is a wash" report should
know the wash was measured on an inert arm.

Suggestions
  • Capture (or assert on) the row counts the non-streaming path can ask prefill_dev for when
    pipeline_windows >= 2, instead of returning mtp prefill: invalid argument - and do not let that
    error take the process on the following request.
  • Make the serial fallback at 21705 use the same "is any coefficient non-neutral" predicate as
    verify.cpp:5593, so a neutral penalty_last_n does not disable the pipeline.
  • It took three probes to find out the loop had never run, because the fact is only printable under
    STRATA_DECODE_TIMING=1. A single startup line naming the reason the loop will not be used for
    served requests (batch slots / penalty window / no snapshot) would have saved the whole investigation.
主要言語
C++
スター
11.6k
フォーク
1k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Niko1221/Strata のほかの issue

Niko1221/Strata の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。