[PR #3095] [Engine] STRATA_PW_WITH_BATCH=1 keeps --pipeline-windows for a lone request beside --batch slots; single-stream decode +12-16% on a layer split #4450

Open
opened 2026-11-07 15:36:02 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3095
Author: @Vop3p
Created: 10/18/2026
Status: 🔄 Open

Base: main ← Head: pw-with-batch


📝 Commits (1)

  • f375524 batch: STRATA_PW_WITH_BATCH=1 keeps --pipeline-windows for the solo path beside --batch slots

📊 Changes

1 file changed (+23 additions, -5 deletions)

View changed files

📝 src/program/generate.cpp (+23 -5)

📄 Description

Problem and result

With --batch slots ("parallel" >= 2) generate.cpp turns --pipeline-windows off for everything ("--pipeline-windows 2 is off: not with --batch slots"), so a request that is alone - it runs the solo path, and the server goes back to it whenever a slot is left alone (#857) - loses the window overlap a layer split gets without batch slots. A server configured for concurrency is slower for the common one-request case.

With STRATA_PW_WITH_BATCH=1 the solo path keeps --pipeline-windows beside the batch slots; batch windows run without it as before. Result on 2x RX 6900 XT (below): a lone request decodes +16.1% at 4K and +12.3% at 32K context (10 of 10 interleaved cold-start pairs each, draft acceptance unchanged). Without the variable the default path is byte-identical.

Closed in the 0.2.0-beta tracker reset; the same change rebased on main and re-measured on 0.2.0-beta as asked.

Approach

One file (src/program/generate.cpp, +23/-5). Both parities' verifiers share the stage's session (ver_b.init(.., gs.ss, ..)), so when the solo request is stopped for a newcomer, copy_to_slot reads a whole state from ss after the pipeline has drained; batch windows never use the second verifiers. With --batch-mtp the slot drafters go where the solo drafter is (the first stage's card when mtp_first), as it does. The --pipeline-windows auto rule and mtp_first take batch_blocks_pw (= o.batch != 0 && !STRATA_PW_WITH_BATCH) instead of o.batch != 0; a line says when it stays on. Opt-in.

Validation

Environment: 2x RX 6900 XT (gfx1030, 16 GB, PCIe 4.0 x8 each), Ryzen 5 5600X, 128 GB DDR4-3200, Ubuntu 26.04 (kernel 7.0.0), ROCm 10.0.0. Revision: main e88ee39d (v0.2.0-beta + 12 commits) and this branch on it (it merges cleanly with today's main 9ae93f7b, the 0.2.1 candidate, not re-measured), built with setup.py's HIP options (-DSTRATA_PREFILL_MMQ=ON -DSTRATA_Q6K_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON, gfx1030, the pinned ggml, Release). Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S, layer split over both cards, int8 KV.

Passed:

  1. ctest (STRATA_BUILD_TESTS=ON): 137 tests, 131 passed; the 6 failures are the same 6 on main built the same way (ple_parity - a missing Q2_0 GGUF, hip_prefill_mmq_parity - SEGFAULT on main too, native_hadamard_test / tq_cpu_parity / tq_cpu_parity_avx2 - "this ggml has no trellis types", isa_guard_check - tq_rows_avx512 not listed).

  2. Default path byte-identical: deterministic config (parallel 1, STRATA_LOGPOS top-256 log-probabilities, 8 real-text chats, 4,067 positions): main and this branch without the variable cmp identical.

  3. Speed: parallel 2, --spec 3 --spec-min-p 0.7 --pipeline-windows 2 --batch-mtp, --kv-resident 32768, STRATA_PREFILL_CPU_SHARE=auto, STRATA_HC_PERSIST=1, STRATA_HIP_PROMPT_F16=1, STRATA_SH_STREAM=1, STRATA_PREFILL_STREAM_MIN=2048, a rocBLAS table. The same binary without and with the variable, 20 cold starts alternating A B A B; each arm sends one request at a time: real text of about 4K and 32K tokens + "summarize in about 400 words", greedy, max_tokens 512; decode_tok_s and drafts from /metrics:

    context unset (median, range) =1 (median, range) per pair median faster drafts accepted (unset / =1)
    4,122 tokens 65.2 tok/s (63.2-66.6) 75.7 (72.2-77.2) +10.1% to +19.4% +16.1% 10/10 82% / 81%
    30,321 tokens 66.7 (64.6-67.3) 74.2 (71.8-76.1) +8.0% to +14.4% +12.3% 10/10 81% / 78%

    Generated 494-512 tokens (a few natural stops at 4K), 512 at 32K. The unset arms printed "--pipeline-windows 2 is off: not with --batch slots", the others "--pipeline-windows 2 stays on for the solo path beside 2 batch slots (STRATA_PW_WITH_BATCH=1)"; 0 stalls.

  4. CUDA compile only (no NVIDIA GPU here): CUDA 13.2.2, GCC 15.2, sm_86, tests on: builds.

Failed: none observed.

Not run: concurrent requests on this revision (batch windows are not changed by the patch, but a request arriving while the solo path is pipelined waits for the pipeline to drain; not measured here); a single-card setup (the gain is the layer split's window overlap); CUDA execution; SYCL and Metal (Metal compiles generate.cpp; the change is host logic only, not verified by a Mac build); other GPUs, Windows.

Community measurements (not mine)

  • 2x RTX 3090 (sm_86; CUDA1 on a PCIe 3.0 x4 link), CUDA 13.3, v0.2.2 + #3382 + this PR, IQ3_S, layer split, --batch 2 --batch-mtp, spec 4/0.5 - cjmckenna, 2026-10-21 (comment below): no gain on CUDA. Solo decode 131.3 vs 133.3 tok/s mean over six 16K-160K requests (per-row -7% to +7%, following draft acceptance), two concurrent decodes 102 vs 109 tok/s (-6%), uncached reads 1-3% slower (the second verifier's 309 MiB cost 161 expert slots on CUDA0). The draft chain stays on the last card there (mtp_first is off outside gfx12 - as on our gfx1030, where the gain is measured). Consistent with the maintainer's 2026-10-20 A/B on 2x RTX A4000 (bench/results/2026-10-20-0.2.1-idle-gpu): pipeline windows do not pay on those CUDA splits, and this PR then has nothing to keep on. Leave both off on such a machine.

Limits

  • Opt-in; only a lone request's path changes.
  • Output text: with pipeline windows the drafts depend on timing, so outputs are not reproducible between starts - but in this serving configuration they were not with the variable unset either (10 of 10 distinct texts in each arm: the CPU share and the adaptive expert cache already vary), so text identity is not a criterion here; the deterministic check is item 2.

Developed with an AI coding assistant; every number above was measured on the machine described here.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3095 **Author:** [@Vop3p](https://github.com/Vop3p) **Created:** 10/18/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pw-with-batch` --- ### 📝 Commits (1) - [`f375524`](https://github.com/Niko1221/Strata/commit/f3755247d5dc6d6d189f16d14ee46723e9c64afa) batch: STRATA_PW_WITH_BATCH=1 keeps --pipeline-windows for the solo path beside --batch slots ### 📊 Changes **1 file changed** (+23 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/program/generate.cpp` (+23 -5) </details> ### 📄 Description ## Problem and result With `--batch` slots ("parallel" >= 2) generate.cpp turns `--pipeline-windows` off for everything ("--pipeline-windows 2 is off: not with --batch slots"), so a request that is alone - it runs the solo path, and the server goes back to it whenever a slot is left alone (#857) - loses the window overlap a layer split gets without batch slots. A server configured for concurrency is slower for the common one-request case. With `STRATA_PW_WITH_BATCH=1` the solo path keeps `--pipeline-windows` beside the batch slots; batch windows run without it as before. Result on 2x RX 6900 XT (below): a lone request decodes +16.1% at 4K and +12.3% at 32K context (10 of 10 interleaved cold-start pairs each, draft acceptance unchanged). Without the variable the default path is byte-identical. ## Related discussion Closed in the 0.2.0-beta tracker reset; the same change rebased on main and re-measured on 0.2.0-beta as asked. ## Approach One file (`src/program/generate.cpp`, +23/-5). Both parities' verifiers share the stage's session (`ver_b.init(.., gs.ss, ..)`), so when the solo request is stopped for a newcomer, `copy_to_slot` reads a whole state from `ss` after the pipeline has drained; batch windows never use the second verifiers. With `--batch-mtp` the slot drafters go where the solo drafter is (the first stage's card when `mtp_first`), as it does. The `--pipeline-windows` auto rule and `mtp_first` take `batch_blocks_pw` (= `o.batch != 0 && !STRATA_PW_WITH_BATCH`) instead of `o.batch != 0`; a line says when it stays on. Opt-in. ## Validation Environment: 2x RX 6900 XT (gfx1030, 16 GB, PCIe 4.0 x8 each), Ryzen 5 5600X, 128 GB DDR4-3200, Ubuntu 26.04 (kernel 7.0.0), ROCm 10.0.0. Revision: main e88ee39d (v0.2.0-beta + 12 commits) and this branch on it (it merges cleanly with today's main 9ae93f7b, the 0.2.1 candidate, not re-measured), built with setup.py's HIP options (`-DSTRATA_PREFILL_MMQ=ON -DSTRATA_Q6K_EXPERTS=ON -DSTRATA_MMQ_KQUANTS=ON`, gfx1030, the pinned ggml, Release). Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S, layer split over both cards, int8 KV. **Passed:** 1. `ctest` (STRATA_BUILD_TESTS=ON): 137 tests, 131 passed; the 6 failures are the same 6 on main built the same way (`ple_parity` - a missing Q2_0 GGUF, `hip_prefill_mmq_parity` - SEGFAULT on main too, `native_hadamard_test` / `tq_cpu_parity` / `tq_cpu_parity_avx2` - "this ggml has no trellis types", `isa_guard_check` - `tq_rows_avx512` not listed). 2. Default path byte-identical: deterministic config (`parallel` 1, `STRATA_LOGPOS` top-256 log-probabilities, 8 real-text chats, 4,067 positions): main and this branch without the variable `cmp` identical. 3. Speed: `parallel` 2, `--spec 3 --spec-min-p 0.7 --pipeline-windows 2 --batch-mtp`, `--kv-resident 32768`, `STRATA_PREFILL_CPU_SHARE=auto`, `STRATA_HC_PERSIST=1`, `STRATA_HIP_PROMPT_F16=1`, `STRATA_SH_STREAM=1`, `STRATA_PREFILL_STREAM_MIN=2048`, a rocBLAS table. The same binary without and with the variable, 20 cold starts alternating A B A B; each arm sends one request at a time: real text of about 4K and 32K tokens + "summarize in about 400 words", greedy, max_tokens 512; `decode_tok_s` and drafts from /metrics: | context | unset (median, range) | `=1` (median, range) | per pair | median | faster | drafts accepted (unset / `=1`) | |---|---|---|---|---|---|---| | 4,122 tokens | 65.2 tok/s (63.2-66.6) | 75.7 (72.2-77.2) | +10.1% to +19.4% | +16.1% | 10/10 | 82% / 81% | | 30,321 tokens | 66.7 (64.6-67.3) | 74.2 (71.8-76.1) | +8.0% to +14.4% | +12.3% | 10/10 | 81% / 78% | Generated 494-512 tokens (a few natural stops at 4K), 512 at 32K. The unset arms printed "--pipeline-windows 2 is off: not with --batch slots", the others "--pipeline-windows 2 stays on for the solo path beside 2 batch slots (STRATA_PW_WITH_BATCH=1)"; 0 stalls. 4. CUDA compile only (no NVIDIA GPU here): CUDA 13.2.2, GCC 15.2, sm_86, tests on: builds. **Failed:** none observed. **Not run:** concurrent requests on this revision (batch windows are not changed by the patch, but a request arriving while the solo path is pipelined waits for the pipeline to drain; not measured here); a single-card setup (the gain is the layer split's window overlap); CUDA execution; SYCL and Metal (Metal compiles generate.cpp; the change is host logic only, not verified by a Mac build); other GPUs, Windows. ## Community measurements (not mine) - **2x RTX 3090 (sm_86; CUDA1 on a PCIe 3.0 x4 link), CUDA 13.3, v0.2.2 + #3382 + this PR, IQ3_S, layer split, `--batch 2 --batch-mtp`, spec 4/0.5** - cjmckenna, 2026-10-21 (comment below): **no gain on CUDA**. Solo decode 131.3 vs 133.3 tok/s mean over six 16K-160K requests (per-row -7% to +7%, following draft acceptance), two concurrent decodes 102 vs 109 tok/s (-6%), uncached reads 1-3% slower (the second verifier's 309 MiB cost 161 expert slots on CUDA0). The draft chain stays on the last card there (`mtp_first` is off outside gfx12 - as on our gfx1030, where the gain is measured). Consistent with the maintainer's 2026-10-20 A/B on 2x RTX A4000 (`bench/results/2026-10-20-0.2.1-idle-gpu`): pipeline windows do not pay on those CUDA splits, and this PR then has nothing to keep on. Leave both off on such a machine. ## Limits - Opt-in; only a lone request's path changes. - Output text: with pipeline windows the drafts depend on timing, so outputs are not reproducible between starts - but in this serving configuration they were not with the variable unset either (10 of 10 distinct texts in each arm: the CPU share and the adaptive expert cache already vary), so text identity is not a criterion here; the deterministic check is item 2. Developed with an AI coding assistant; every number above was measured on the machine described here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#4450
No description provided.