mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #761] [CLOSED] stage no longer waits for the whole split below it #2813
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#2813
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/761
Author: @gopinath87607
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:prefill-stage-pipeline📝 Commits (1)
3d8041aprefill: a switch for the layer split's overlap, and the wait it shows📊 Changes
1 file changed (+20 additions, -0 deletions)
View changed files
📝
src/prefill/prefill.cpp(+20 -0)📄 Description
A 4-way layer split's stages took turns. 72% of one-second samples during a 120,000-token prompt had exactly one of the four cards busy and never three or four, for 1,090 tok/s.
The cause was not the hand-off buffer count.
Prefill::runended withif (next_run.valid() && !next_run.get()), so a stage'srundid not return until its successor's had, and its successor's not until its successor's - every stage inherited the whole downstream chain's latency per chunk. Measured on this rig (2x3060 + 2x5060, IQ3_S, --layer-split auto, chunk 10,240): dev0 spent 6,253 ms of every 8,137 ms chunk inside that oneget(), while its own GPU work was 2,234 ms.The chunks below are now owned by a per-stage deque of futures, reaped one-for-one before the next hand-off, so a stage returns while the chunks below it are still running. What remains is that the OUTERMOST stage must not return with chunks still in flight, or the caller tears the split down under them: a guard on
runcovers every return path, and it callsPrefill::finish(which a caller can also call to join the split early).1,089.7 / 1,090.1 tok/s -> 2,210.6 / 2,227.5 tok/s 2.04x
Same binary, one prompt, two runs per arm; the two arms of a pair differ by 0.2% and 0.8%. Cards busy at the same moment went from 72%/21%/0% (one/two/three-or-more) to 13%/19%/54%, and the wait at the hand-off from 6,253 to 131 ms on dev0 (dev1 3,289 -> 56, dev2 1,680 -> 55). Each stage's own work rose under the overlap (dev0 2,234 -> 3,246 ms), so the gain is smaller than the wait it removes. The residual dumps of all four arms are byte-identical (md5 af2c193e86892f6f31abe160cc304d07), which is the point: this reorders waits, never arithmetic.
A stage owns ONE set of chunk buffers (m.R, the staging ring, the GEMM scratch), so two of its chunks must never be in flight at once - the reap is one-for-one, and STRATA_PF_DEPTH above 1 is refused rather than silently racing them through the same buffers. STRATA_PF_DEPTH=0 restores the old join, so the A/B is one binary apart. The hand-off buffer goes from two to one (the copy now happens after the join instead of before), which halves its pinned host memory, 800 -> 400 MiB at chunk 10,240. STRATA_PREFILL_TIMING also reports each stage's wall time and how much of it went into that wait.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.