mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4010] [CLOSED] [Engine] Pipelined batch groups adapt the VRAM tier (opt-in STRATA_PIPE_ADAPT_EVERY): six-stream decode after a start 309 -> 410 tok/s #4874
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#4874
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/4010
Author: @SuperDistance
Created: 10/24/2026
Status: ❌ Closed
Base:
main← Head:pr/pipelined-adapt📝 Commits (1)
b0af5d6batch-groups: opt-in adaptive-tier rounds in the pipelined loop (STRATA_PIPE_ADAPT_EVERY)📊 Changes
4 files changed (+148 additions, -5 deletions)
View changed files
📝
docs/BATCHING.md(+27 -1)📝
include/strata/program/batch_groups.hpp(+30 -0)📝
src/program/batch_groups_test.cpp(+38 -1)📝
src/program/generate.cpp(+53 -3)📄 Description
Problem and result
With
--batch-groupsabove 1 on a layer split, the pipelined batch loop never starts a round of the adaptive VRAM tier. The serial batch windows start one every--adapt-everywindows (#1637);pumpcounts the routing but starts none, as docs/BATCHING.md says ("The pipelined--batch-groupspath does not adapt"). So while the slots are busy the tier only moves when they go back to the solo path, and a freshly started engine keeps its start-up profile for minutes.On 2x RTX 5090 a fresh engine's six-stream decode climbs from 246 to 355 tokens/s over eight bursts while the tier gains 96 experts every burst or two. With the new opt-in
STRATA_PIPE_ADAPT_EVERY=128it runs at about 415 tokens/s from the second burst: 309 -> 410 tokens/s (mean of eight bursts, two fresh engines each). Unset, nothing changes: under the exactness settings the answers are byte-identical to the release.Related discussion
#1637 (the tier in serial batch windows; this is the pipelined half). Found while comparing 0.2.1.3 and 0.2.4.1 on this machine: single engines differed by -6.5% and +3.3%, interleaved warm engines by 0.1% (311.9 against 311.6 tokens/s), and the single-engine differences followed each engine's swap count.
Approach
pumpstarts no new group on the first stage, lets the groups in flight finish, then runs one round exactly asbatch_stepdoes between serial windows:adapt(), thenapply_pending(true). Nothing in flight reads a cache slot while experts are swapped, and the new experts have landed before the next launch. Then it goes on.in_prompt_read: its loan of cache slots), not with--adapt-async 1(its own ticks), not while a round's copies are in flight, not with the tier off.include/strata/program/batch_groups.hpp(pipe_adapt_every(),pipe_adapt_due()), checked by 12 new cases inbatch_groups_test.strata batch (pipelined ...)line adds the rounds, the experts swapped in and the time spent.Validation
Passed:
7dd5cf18+ this commit (b0af5d61), Windows 11, MSVC 2022, CUDA 13.0, sm_120:cmake --build <dir> --target batch_groups_test strata, thenbatch_groups_test.exe->batch_groups_test: all passed, including the 12 newpipe adapt:cases.tools/hip/build_windows.bat): compiles. Not run (no AMD GPU).--layer-split 25 --trim-stage-weights --batch 6 --batch-groups 2 --resident-experts --kv-resident 32768 --adapt-every 16 --pool-workers 15, served throughserve/server.py. Each arm got a freshly loaded engine with no warm-up, thentools/serve_load.py --clients 6 --rounds 8 --max-tokens 1024. The measure is the engine's ownstrata batch (pipelined ...)rows/s for each burst (one row is one token of one slot). Order: stock, 128, 32, unset, 32, 128.STRATA_PIPE_ADAPT_EVERYWith 128: 14 to 16 rounds per burst, 576 to 1,440 experts swapped in, 130 to 322 ms of a 14 to 16 s burst in the rounds (the pipeline drains not counted). 32 runs 61 to 63 rounds per burst, and its four times as many drains end a little lower. No errors and no stall lines in any engine log.
STRATA_IQ_MT_MIN=1,--pcie-frac 0,--adapt-every 1000000,--no-prefill-borrow), six streams x two bursts x 512 greedy tokens with the same prompts: release, then this change unset, then the release again.serve_load.py --compareagainst the first run: ALL IDENTICAL both times.Failed: none observed. Without the exactness settings the unset build's answers differed from the release's in all 48 requests (from the 20th to the 1,191st character), as BATCHING.md says outputs do run to run.
Not run:
generate.cppand printed the start-up line later. This head moves the rule intobatch_groups.hpp, moves the line to the start-up lines, and is rebased onto7dd5cf18; it was rebuilt and unit-tested, not re-measured.STRATA_PIPED_CONCURRENT): the rounds pause then by design, but that was not exercised.Limits
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.