mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5149] [CLOSED] [Engine] --pipeline-windows 2: no drafter prefill beside a stage-0 window #5326
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5326
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/5149
Author: @cloud4t0r
Created: 11/3/2026
Status: ❌ Closed
Base:
main← Head:fix/pipeline-prefill-deadlock📝 Commits (1)
e170084[Engine] --pipeline-windows 2: no drafter prefill beside a stage-0 window📊 Changes
1 file changed (+21 additions, -0 deletions)
View changed files
📝
src/program/generate.cpp(+21 -0)📄 Description
Problem and result
With
--pipeline-windows 2on a two-stage layer split (the default on gfx12 HIP builds), the first request of a fresh engine never returns: the prompt is read, 0 tokens come out, and 60 s later the watchdog ends the engine:After this patch the same request answers normally: 56-token and 71-token prompts answer, a 1109-token prompt is read at 420.3 tok/s and answered at 59.9 tok/s, several turns in a row. Fixes #5147.
Related discussion
#5147 — the issue, with the
eu-stackof the stalled thread, the stall report and the four configurations (default,--pipeline-windows 1,0, and2+STRATA_MTP_STAGE0=0).Approach
With
--pipeline-windows 2the drafter is placed on the first stage's card (mtp_first,generate.cpp:if (!mtp_first_ok || o.pipeline_windows < 2 || …) return false;).read_windows_plthen callsmtp.prefill(…, sync=false)right after a stage-1 window finishes, while stage 0 still has a window in flight on that same card.MtpDrafter::prefillblocks the host until its stream is idle: on HIPprefill_per_group_sync()is true, so it takes the per-group loop, which synchronises after every group and never reads the caller'ssyncat all (src/core/mtp.cpp: theif (!sync)early return only exists in the E-4 branch). A stage-0 window only advances when this same thread serves its doorbells, so the host sits inhipStreamSynchronizeand the window it is waiting for can never finish:Neither 20 s guard in
Verifier::service/donecan fire, because the loop never runs again — which is why the report shows 60 s with the expert pool idle rather than a window error.The fix serves stage 0 to its end before that prefill, when the drafter shares stage 0's card. The same windows are served, in the same order, only a little earlier, so the tokens are unchanged; the rest of the read keeps both stages overlapped.
I did not take the other obvious route — making the per-group loop honour
sync=falseand return at once. The comment aboveMtpDrafter::prefillrecords that the unsynchronised E-4 queue itself hangs on gfx1201 / ROCm 7.2.4, which is why HIP forces the per-group sync in the first place. Fixing the caller keeps that mitigation intact.--pipeline-windows 0and1take no new code path (mtp_firstis false there, and0does not enter this loop).Validation
Revision tested: this branch,
e170084e, onupstream/main(ffa80d73). Environment: Fedora 44, kernel 7.3.0-rc7, RX 9070 (gfx1201) as stage 0 + 16 GB RX 6800 (gfx1030) as stage 1, HIP/ROCm from/opt/rocm, engine 0.1.56, modelSwift-Qwen3.8-Flash-Next-GSQ-RCO-IQ3_Swith--spec 4 --spec-min-p 0.5 --mtp --kv int8 --kv-resident 32768 --max-context 131072 --vision.Passed:
cmake --build build-hip -j 24 --target strataon this branch, Release →[131/134] Linking HIP executable strata; only the pre-existinghipFree/nodiscardwarnings ingenerate.cpp.no progressline.--pipeline-windows 0(47.8 tok/s),--pipeline-windows 1(52.4 tok/s) and--pipeline-windows 2+STRATA_MTP_STAGE0=0(46.7 tok/s) all avoided it, which is consistent with the cause (each keeps the drafter away from stage 0's card or leaves this loop). Single runs, 32-57 output tokens, indicative only.Failed:
Not run:
generate.cppand nothing CUDA-specific changed, but I did not compile it.sycl/src/program/generate.cpp), but nomtp_firstplacement — the drafter stays on the last card there, so this deadlock does not apply. Nothing changed in that copy, and I did not build it.Limits
mtp_first(drafter on stage 0's card). WithSTRATA_MTP_STAGE0=0the drafter sits on the last card and its prefill cannot wait behind a stage-0 window; that path is unchanged and still works.MtpDrafter::prefill(it useschain_launch), so it had no equivalent hole.STRATA_HIP_PROMPT_F16=1is the workaround. Not this change, and not affected by it.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.