[GH-ISSUE #4850] Stage-helper (PR#21 / docs/SECOND_GPU.md) cannot activate under --serve: the serving path bypasses Prefill::run()/run_impl() entirely #2227

Closed
opened 2026-11-04 01:57:42 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @chengye75-star on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4850

Summary

STRATA_PREFILL_HELP=1 (documented in docs/SECOND_GPU.md) never activates under --serve. We believe this is architectural rather than a wiring oversight: the sole call site of Prefill::bind_stage_helper() is prefill.cpp:3035 inside run_impl(), gated on single_chunk — but unconditional probes placed at the very first statement of both Prefill::run() and Prefill::run_impl() (plain fprintf(stderr, ...), no env gate, no condition) never fire while serving requests, even though request timing proves prefill is executing. The serve slot/checkpoint architecture appears to drive prefill through lower-level primitives and bypass the Prefill facade's prompt entry points, so the helper lifecycle (bind → per-layer wire → drain) has no reachable entry in serving mode.

Environment

  • v0.2.8 (also checked 0.2.7), --serve, 2× RTX 5060 Ti 16GB (SM120)
  • Configs tested: --layer-split 24 --pipeline-windows 2, --peer-device 1, --pipeline-windows 1, --kv q4
  • Full prompt ladder 1.5K–34K tokens, all points within ±1% of the no-help baseline
  • Engine log confirms helper expert cache loads at startup — failure is silent: everything initializes, nothing helps

Method (reproducible)

  1. Diagnostics at all 10 return false sites + success path inside bind_stage_helper() printing __LINE__: zero output → never called, not rejecting.
  2. Env-gated patches to force the single-chunk branch (clearing force_chunk_, short-circuiting plan_chunk() for n <= T, OR-ing the call condition): still zero output.
  3. Unconditional (ungated) fprintf probes at line 1 of run() and run_impl(): zero output under serve load; the same binary responds normally with correct token timing — so the request path taken never passes through these functions.
  4. gdb -batch -ex "thread apply all bt" during an active 60K-prompt prefill does show Prefill::run_impl frames — on threads/paths where chain handoff makes single_chunk permanently false (hand_in_ != nullptr → single_chunk_). Long prompts under layer-split dispatch to run_layer_major() before the helper gate anyway.
  5. With STRATA_PREFILL_HELP=1 under layer-split, the engine also gets killed during warmup by the serve wrapper's stall/quit watchdog (helper-cache construction slows the ready handshake); STRATA_ENGINE_STALL_S=900 keeps it alive, but help still never binds — a confusing double failure mode for users.

What does work on dual GPU (for doc cross-reference)

--peer-device 1 without layer-split: +18–20% wall at ≤4K prompts (1.5K/2K/3K/4K measured), negative between 6–8K, −37% at 10K+ real-corpus (cross-card expert reads saturate PCIe x8). Byte-identical outputs (sha parity) and ct parity vs the layer-split baseline.

Ask (one of)

  • A startup warning when STRATA_PREFILL_HELP is set under --serve ("only active in one-shot generate mode"), plus one line in SECOND_GPU.md — this cost us two full nights of instrumented forensics; and/or
  • Wire the helper bind into the serve slot lifecycle. The downstream machinery (helper_ consulted at the layer-major gate, help_expert_batch peer branch, drain) all appears alive — only the binding is unreachable from serve. We captured the full gate sequence and have a small env-gated patch stack (v1–v3) we can share and would happily test any branch against.
Originally created by @chengye75-star on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4850 ## Summary `STRATA_PREFILL_HELP=1` (documented in `docs/SECOND_GPU.md`) never activates under `--serve`. We believe this is architectural rather than a wiring oversight: the sole call site of `Prefill::bind_stage_helper()` is `prefill.cpp:3035` inside `run_impl()`, gated on `single_chunk` — but unconditional probes placed at the very first statement of both `Prefill::run()` and `Prefill::run_impl()` (plain `fprintf(stderr, ...)`, no env gate, no condition) never fire while serving requests, even though request timing proves prefill is executing. The serve slot/checkpoint architecture appears to drive prefill through lower-level primitives and bypass the `Prefill` facade's prompt entry points, so the helper lifecycle (bind → per-layer wire → drain) has no reachable entry in serving mode. ## Environment - v0.2.8 (also checked 0.2.7), `--serve`, 2× RTX 5060 Ti 16GB (SM120) - Configs tested: `--layer-split 24 --pipeline-windows 2`, `--peer-device 1`, `--pipeline-windows 1`, `--kv q4` - Full prompt ladder 1.5K–34K tokens, all points within ±1% of the no-help baseline - Engine log confirms helper expert cache loads at startup — failure is silent: everything initializes, nothing helps ## Method (reproducible) 1. Diagnostics at all 10 `return false` sites + success path inside `bind_stage_helper()` printing `__LINE__`: zero output → never called, not rejecting. 2. Env-gated patches to force the single-chunk branch (clearing `force_chunk_`, short-circuiting `plan_chunk()` for `n <= T`, OR-ing the call condition): still zero output. 3. Unconditional (ungated) fprintf probes at line 1 of `run()` and `run_impl()`: zero output under serve load; the same binary responds normally with correct token timing — so the request path taken never passes through these functions. 4. gdb `-batch -ex "thread apply all bt"` during an active 60K-prompt prefill does show `Prefill::run_impl` frames — on threads/paths where chain handoff makes `single_chunk` permanently false (`hand_in_ != nullptr` → `single_chunk_`). Long prompts under layer-split dispatch to `run_layer_major()` before the helper gate anyway. 5. With `STRATA_PREFILL_HELP=1` under layer-split, the engine also gets killed during warmup by the serve wrapper's stall/quit watchdog (helper-cache construction slows the ready handshake); `STRATA_ENGINE_STALL_S=900` keeps it alive, but help still never binds — a confusing double failure mode for users. ## What does work on dual GPU (for doc cross-reference) `--peer-device 1` without layer-split: **+18–20% wall at ≤4K prompts** (1.5K/2K/3K/4K measured), negative between 6–8K, −37% at 10K+ real-corpus (cross-card expert reads saturate PCIe x8). Byte-identical outputs (sha parity) and ct parity vs the layer-split baseline. ## Ask (one of) - A startup warning when `STRATA_PREFILL_HELP` is set under `--serve` ("only active in one-shot generate mode"), plus one line in SECOND_GPU.md — this cost us two full nights of instrumented forensics; and/or - Wire the helper bind into the serve slot lifecycle. The downstream machinery (`helper_` consulted at the layer-major gate, `help_expert_batch` peer branch, drain) all appears alive — only the binding is unreachable from serve. We captured the full gate sequence and have a small env-gated patch stack (v1–v3) we can share and would happily test any branch against.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 31, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes".

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6548042429 --> @github-actions[bot] commented on GitHub (Oct 31, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other], then a short description. Example: "[Engine] decode stops after 2 minutes". Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Nov 6, 2026):

Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection.

To bring it back: fix the title (area prefix) and the missing parts, then comment /reopen. A check runs and reopens it, or tells you what is still missing. See CONTRIBUTING.md.

<!-- gh-comment-id:6676840985 --> @github-actions[bot] commented on GitHub (Nov 6, 2026): Closing this issue because it still did not follow the format after 5 days. That is housekeeping, not a rejection. To bring it back: fix the title (area prefix) and the missing parts, then comment `/reopen`. A check runs and reopens it, or tells you what is still missing. See [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2227
No description provided.