mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1656] [CLOSED] pipeline-windows: three or more layer-split stages, +14% decode at 4K / +27% at 32K on 4x RX 7900 XT (opt-in); HIP draft-layer scratch race #3585
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#3585
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/1656
Author: @Cass67
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:engine/pipeline-windows-4stage📝 Commits (1)
06abdfapipeline-windows: overlap three or more layer-split stages; HIP drafter scratch race📊 Changes
4 files changed (+260 additions, -167 deletions)
View changed files
📝
docs/MULTI_GPU.md(+19 -7)📝
include/strata/core/mtp.hpp(+3 -0)📝
src/core/mtp.cpp(+6 -1)📝
src/program/generate.cpp(+232 -159)📄 Description
Title
Issue: Related: #1154 (CC-David-CC, open): three P4s, three stages, two speculative windows. Searched 2026-10-09 for
pipeline-windows,gr_readandss.block.gr; no issue for the HIP race below.Summary
Why it matters:
--pipeline-windows 2is off on three or more stages ("it needs a layer split into exactly two stages"), so a model that needs four cards decodes with one card busy at a time. On 4x RX 7900 XT with IQ3_S a decode window is four stages of 9.9 to 13.1 ms of GPU work run one after another; the hand-off is 2.2-2.6 ms of host staging (STRATA_DECODE_TIMING,STRATA_VERIFY_PROFILE,STRATA_SPLIT_TIMING).--pipeline-windows 0--pipeline-windows 2Every stage but the last is a front stage. The guessed window follows the verified one through them one card behind; only the last stage waits for the verdict, as with two stages. Default off.
HIP fix, independent of the stage count: the draft layer's per-row
gr_read(the HIP branch; on CUDA the multi-row read uses the draft layer's own buffers) usedss.block.grof the last stage's session, which that stage's verifier uses inlm_head_mix. After a kept guess the chain launched at the verdict and the next window's last stage run on the card at once, and the window's head read a clobbered mix.What changed
src/program/generate.cpp: the gate takes two or more stages (--pipeline-windows 1and--adapt-async 1stay two-stage and are refused on more, with a log line). A stream, an odd verifier and an odd hand-off for every stage and boundary; a pair of GDN snapshots with side stream and events per front stage. The decode loop keeps per window its front progress, an in-flight flag and the front stages it was committed on: B's speculative commit-and-launch runs per front stage; at the verdict A is committed on the front stages B never reached (A.T when the guess is kept, a + 1 otherwise); the undo restores and replays per committed stage. Drain, fences and stats cover every stage. The pipelined prompt read stays two-stage.src/core/mtp.cpp,include/strata/core/mtp.hpp: the draft layer carves its ownGrWorkspacefor thatgr_read.docs/MULTI_GPU.md: two or more stages, cost, the off list, the measurements, the HIP note.STRATA_PIPELINE_DEBUG=1):STRATA_PIPELINE_SPEC_DEPTH=kkeeps B to the first k front stages; theSTRATA_PIPELINE_LOGverdict line also prints B's front progress, A's committed stages and the emitted tokens.Extra Notes
Measured on v0.1.41 (
fb58e0d) plus this change; the branch is cut from mainfb58e0d. 4x RX 7900 XT (gfx1100), i9-9900K, 60.4 GiB RAM, ROCm 10.0.0, Linux;STRATA_SPLIT_OWN=1 STRATA_STAGE_TRIM=1 STRATA_PF_FUSED=1 STRATA_PF_GEMM=1 STRATA_PF_SWITCH_MIN_T=4096. Same binary in every arm, only the flag differs; each arm a fresh process; prompts from repository text sized with the pack's tokenizer, unique first line, cache_n 0 on all. The engine's ownprompt_per_second/predicted_per_secondandstrata pipelinelines.Text equality (
STRATA_IQ_MT_MIN=1 --pcie-frac 0 --adapt-every 0, greedy, 4 prompts x 256 tokens, 100% of experts in VRAM in every arm): identical to the serial loop, 4 of 4. Also 4 of 4 withSTRATA_PIPELINE_FORCE_MISS=1(every guess rolled back),STRATA_PIPELINE_THETA=2(no guesses) andSTRATA_PIPELINE_SPEC_DEPTH1 and 2. This build's serial loop matched v0.1.41's text, 4 of 4.HIP race: before the draft-layer scratch, full depth was 0 of 4 while depth 1 and 2 were 4 of 4. Each first divergence was in the window after a kept guess whose B had finished every front stage before the verdict, so its last stage launched while the chain ran. Holding that launch until the chain ended (a debug gate, not in this change) gave 4 of 4, and so does the draft layer's own scratch. On two stages the same overlap follows a kept guess whenever B has finished stage 0; not reproduced here, this box needs four cards for the model.
Against #1154: there, three stages with two speculative windows on CUDA (Pascal) and new commit-limit and VMM code; here, any number of stages with one speculative window one card behind, the two-stage machinery extended, on HIP. Both edit the same
generate.cppsites.Not tested: a two-stage split after this change, three stages, CUDA, SYCL, sampled decoding,
--suffix-draft, images. The snapshot pairs on later front stages are allocated after the expert caches and not kept out of them.Checked: HIP Release build of
strata(gfx1100, ROCm 10.0.0). ctest and the Python tests were not run.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.