[PR #1249] [CLOSED] Pipelined batch: two requests run at half speed (pad rows in group windows, unbalanced slot choice) #3334

Closed
opened 2026-11-07 14:40:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1249
Author: @crazyaimachine
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: pipeline-groups


📝 Commits (2)

  • 1f26446 Pipelined batch: a group window holds only the slots up to its last active one
  • dee3586 serve: spread requests over the pipeline groups when no held prefix is worth keeping

📊 Changes

2 files changed (+18 additions, -5 deletions)

View changed files

📝 serve/server.py (+12 -2)
📝 src/program/generate.cpp (+6 -3)

📄 Description

Two small fixes for --batch N --batch-groups G on a layer split. Two concurrent requests ran at about half the speed of the 4-request case per request, sometimes worse.

1. A group window holds only the slots up to its last active one (generate.cpp)

Every pipelined group window ran all GS slots of its group. An idle slot ran a pad row through every layer of every stage. The server spreads requests over the groups first (slot_order). So with --batch 4 --batch-groups 2 and two requests, every window was half pad rows. Now PGroup::S is the group's last active slot + 1, and the window, its picks and batch_launch() cover only those slots.

This fix was in the #559 series (ca74f92 there, "pipelined group windows only up to the last active slot"). It did not come along into 0.1.39, where the non-pipelined path got the same idea.

2. pick_slot() spreads requests over the groups (serve/server.py)

When no slot held the prompt's start, pick_slot() took the least recently used free slot. Once every slot held an old conversation, two new requests could land in one group while the other group's stage sat idle. Now the rule is:

  1. A held prefix of at least 512 tokens still wins, because reading a long conversation again costs more.
  2. Otherwise the free slot in the group with the fewest busy slots is taken.
  3. Then an empty slot.
  4. Then the least recently used one.

Measured

Setup:

  • 2× TITAN RTX (Turing, PCIe 3.0), UD-Q4_K_XL with the BF16 PLE table.
  • --batch 4 --batch-groups 2 --trim-stage-weights, layer split 22, images on.
  • Through the HTTP server, T = 0.7, 400 tokens per answer, total tok/s.
Concurrent 0.1.40.1 with these two commits
1 48–58 47–59
2 36–38 (each request ~19 tok/s) 52–82
4 118–122 117–123

Without --batch-groups (one group), 0.1.40.1 gave 50 / 68 / 94 on the same machine.

Not solved

Even with both fixes, a round of two requests now and then still runs at ~19 tok/s each, with the requests in slots 0 and 2 (different groups). In six back-to-back rounds the worst was 52 tok/s total, but it does happen. I have not found the cause yet. If you have an idea where to look (doorbells? the stage hand-off?), I am happy to test.

The two commits are on 0.1.40.1 and apply to current main. Written by my agent, measured on my machine.


🔄 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/1249 **Author:** [@crazyaimachine](https://github.com/crazyaimachine) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pipeline-groups` --- ### 📝 Commits (2) - [`1f26446`](https://github.com/Niko1221/Strata/commit/1f26446dd1958758849c04254ad1def2ada32ae6) Pipelined batch: a group window holds only the slots up to its last active one - [`dee3586`](https://github.com/Niko1221/Strata/commit/dee358626624d72a243ec47faa52f214d7396095) serve: spread requests over the pipeline groups when no held prefix is worth keeping ### 📊 Changes **2 files changed** (+18 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+12 -2) 📝 `src/program/generate.cpp` (+6 -3) </details> ### 📄 Description Two small fixes for `--batch N --batch-groups G` on a layer split. Two concurrent requests ran at about half the speed of the 4-request case per request, sometimes worse. ### 1. A group window holds only the slots up to its last active one (`generate.cpp`) Every pipelined group window ran all `GS` slots of its group. An idle slot ran a pad row through every layer of every stage. The server spreads requests over the groups first (`slot_order`). So with `--batch 4 --batch-groups 2` and two requests, every window was half pad rows. Now `PGroup::S` is the group's last active slot + 1, and the window, its picks and `batch_launch()` cover only those slots. This fix was in the #559 series (ca74f92 there, "pipelined group windows only up to the last active slot"). It did not come along into 0.1.39, where the non-pipelined path got the same idea. ### 2. `pick_slot()` spreads requests over the groups (`serve/server.py`) When no slot held the prompt's start, `pick_slot()` took the least recently used free slot. Once every slot held an old conversation, two new requests could land in one group while the other group's stage sat idle. Now the rule is: 1. A held prefix of at least 512 tokens still wins, because reading a long conversation again costs more. 2. Otherwise the free slot in the group with the fewest busy slots is taken. 3. Then an empty slot. 4. Then the least recently used one. ### Measured Setup: - 2× TITAN RTX (Turing, PCIe 3.0), UD-Q4_K_XL with the BF16 PLE table. - `--batch 4 --batch-groups 2 --trim-stage-weights`, layer split 22, images on. - Through the HTTP server, T = 0.7, 400 tokens per answer, total tok/s. | Concurrent | 0.1.40.1 | with these two commits | | ---: | ---: | ---: | | 1 | 48–58 | 47–59 | | 2 | **36–38** (each request ~19 tok/s) | **52–82** | | 4 | 118–122 | 117–123 | Without `--batch-groups` (one group), 0.1.40.1 gave 50 / 68 / 94 on the same machine. ### Not solved Even with both fixes, a round of two requests now and then still runs at ~19 tok/s each, with the requests in slots 0 and 2 (different groups). In six back-to-back rounds the worst was 52 tok/s total, but it does happen. I have not found the cause yet. If you have an idea where to look (doorbells? the stage hand-off?), I am happy to test. The two commits are on 0.1.40.1 and apply to current `main`. Written by my agent, measured on my machine. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:45 +07:00
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#3334
No description provided.