[PR #792] [CLOSED] batch slots: the zero-doorbell graph (100% VRAM resident) rings no layer #2829

Closed
opened 2026-11-04 02:03:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/792
Author: @0xPreDa
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: fix/batch-all-resident


📝 Commits (10+)

  • fa16567 setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459)
  • 749d957 setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446)
  • 5a30024 calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447)
  • 9f60d13 serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448)
  • eb8da1d /metrics: each request's speculative draft counts, and their sums in the totals (#457)
  • 6a09387 setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444)
  • d6a91e2 docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438)
  • d8d4ad3 Merge branch 'f-135-eng' into rel-0.1.35
  • 7b600d5 Merge branch 'f-135-small' into rel-0.1.35
  • d9ab843 Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it

📊 Changes

2 files changed (+21 additions, -3 deletions)

View changed files

📝 serve/server.py (+5 -2)
📝 src/core/verify.cpp (+16 -1)

📄 Description

Fixes #776.

Cause

When a stage holds every one of its experts in VRAM, its verify window is recorded as the zero-doorbell graph (#646): record_window publishes no per-layer doorbell (m_seq_ is never rung), and the only host wait left in the graph is layer 1's wait_flag_ge(m_flag_, 1), before it copies the PLE rows.

The solo window already handles this. In Verifier::run (src/core/verify.cpp, the if (all_resident_ && !test_stall) branch), the host gathers the PLE rows, raises *flag = 1 once and skips the per-layer loop.

The batch windows are recorded by the same record_window, but both batch host paths still wait for layer 0's ring:

  • run_slot_rows (without --batch-groups): while (*seq < want) never ends at k = 0. After 20 s it reports verify batch: timed out at layer 0, the engine exits and the server restarts it.
  • batch_launch / batch_poll (with --batch-groups): the same wait, in batch_poll.

As a result, on any rig where a stage holds 100% of its experts, the first batch window fails - even with a single busy slot (captured the batch window over slots 0), with or without --batch-groups. The measurements in BATCHING.md were taken on cards that never reached 100% residency, which is why it did not show up there. #776 (2x RTX PRO 6000) and my 4x RTX 4090 split both reach it.

Fix

  • run_slot_rows: when all_resident_, raise h_flag_ to 1 once (stage_batch has already gathered the PLE rows before the launch) and skip the per-layer loop. The stream synchronization that follows waits for the window as before.
  • batch_launch: when all_resident_, raise h_flag_ to 1 and set b_k_ = b_steps_, so that batch_poll only polls the stream.
  • serve/server.py, _take_control: restart() runs __init__ again while requests are waiting for the control lines, which replaces wait_lens and resets waiting. The waiting request's finally block then raised ValueError: list.remove(x): x not in list and could drive waiting below zero; it showed up as the engine reported an error: list.remove(x): x not in list after each stall. The cleanup now tolerates a restart (identity check, max(0, ...)).

Stages that are not fully resident (doorbell graph) are unchanged: the new branches only run when all_resident_ is true.

Testing

Linux, 4x RTX 4090 (24 GB, no P2P), CUDA 13.0, sm_89, engine 0.1.39 with this patch, GSQ-RCO IQ3_S, --layer-split 12,24,36 --trim-stage-weights --batch 4 --batch-groups 4, prefill 2048, 262144-token context. All four stages report 100% VRAM resident: zero-doorbell graph. Requests go through the HTTP server, with short prompts (0-12K tokens) and long ones (30K-100K tokens):

Before After
Batch windows the engine exits at the first one (verify batch: timed out at layer 0), 9-10 restarts per run no engine error, a single engine start for the whole run
4 concurrent requests, short prompts 0 of 12 complete (the engine keeps restarting) 12 of 12, 81 tok/s per request, first token in 1.1 s (median)
4 concurrent requests, 30K-100K prompts - 6 of 6, 50 tok/s per request, first token in 5.8 s (median)
1 request (solo path) 178 tok/s 177 tok/s

serve.test_parallel, serve.test_lifecycle and serve.test_server pass (158 tests).

Not tested: Windows, HIP, and a split where some stages are fully resident and others are not.


🔄 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/792 **Author:** [@0xPreDa](https://github.com/0xPreDa) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/batch-all-resident` --- ### 📝 Commits (10+) - [`fa16567`](https://github.com/Niko1221/Strata/commit/fa165679f9860552ac97ebd07118bb8db286be4a) setup: an earlier config that does not parse is skipped, not a crash; configs are written atomically (#459) - [`749d957`](https://github.com/Niko1221/Strata/commit/749d957a1790b1a171dd4a01ab3e31b3882c9892) setup (--backend hip): a system ROCm without the HIP development files falls back to the wheels (#446) - [`5a30024`](https://github.com/Niko1221/Strata/commit/5a3002446dbb9dfcabb7d0bd9f113da90cc2f3c0) calibrate: the engine's arguments come from the server's engine_args; a failed tuning says why (#447) - [`9f60d13`](https://github.com/Niko1221/Strata/commit/9f60d13246e46b02b1dd0841980b4d18b0faaea7) serve, setup: name the small split card that caps the prompt chunk; setup recommends the big card alone (#448) - [`eb8da1d`](https://github.com/Niko1221/Strata/commit/eb8da1d8c26ec41e6ffb084fdf579dba7cad10bd) /metrics: each request's speculative draft counts, and their sums in the totals (#457) - [`6a09387`](https://github.com/Niko1221/Strata/commit/6a093874fe037020f49bd5cf053879ff6a133c21) setup (--gguf-dir): GGUFs Strata cannot run are named as such, with the --family/--model to use (#444) - [`d6a91e2`](https://github.com/Niko1221/Strata/commit/d6a91e2d1770d0f469d6ec15890acc7ee93e764c) docs: the Coder is weaker outside code, Chinese/CJK text included; the unpruned sizes for that (#438) - [`d8d4ad3`](https://github.com/Niko1221/Strata/commit/d8d4ad337d3c98ba21d3bd0af1a16e9177e112b6) Merge branch 'f-135-eng' into rel-0.1.35 - [`7b600d5`](https://github.com/Niko1221/Strata/commit/7b600d55ff801caaaa11542af1523050992e049b) Merge branch 'f-135-small' into rel-0.1.35 - [`d9ab843`](https://github.com/Niko1221/Strata/commit/d9ab8435f654c368c586340d490915f6addf56a3) Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), the low-RAM resident mode on Windows 32 GB PCs (#467), fixes #460 #459 #446 #447 #457 #448 #444; setup requires it ### 📊 Changes **2 files changed** (+21 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+5 -2) 📝 `src/core/verify.cpp` (+16 -1) </details> ### 📄 Description Fixes #776. ## Cause When a stage holds every one of its experts in VRAM, its verify window is recorded as the **zero-doorbell graph** (#646): `record_window` publishes no per-layer doorbell (`m_seq_` is never rung), and the only host wait left in the graph is layer 1's `wait_flag_ge(m_flag_, 1)`, before it copies the PLE rows. The solo window already handles this. In `Verifier::run` (`src/core/verify.cpp`, the `if (all_resident_ && !test_stall)` branch), the host gathers the PLE rows, raises `*flag = 1` once and skips the per-layer loop. The batch windows are recorded by the same `record_window`, but both batch host paths still wait for layer 0's ring: - `run_slot_rows` (without `--batch-groups`): `while (*seq < want)` never ends at `k = 0`. After 20 s it reports `verify batch: timed out at layer 0`, the engine exits and the server restarts it. - `batch_launch` / `batch_poll` (with `--batch-groups`): the same wait, in `batch_poll`. As a result, on any rig where a stage holds 100% of its experts, the **first** batch window fails - even with a single busy slot (`captured the batch window over slots 0`), with or without `--batch-groups`. The measurements in BATCHING.md were taken on cards that never reached 100% residency, which is why it did not show up there. #776 (2x RTX PRO 6000) and my 4x RTX 4090 split both reach it. ## Fix - `run_slot_rows`: when `all_resident_`, raise `h_flag_` to 1 once (`stage_batch` has already gathered the PLE rows before the launch) and skip the per-layer loop. The stream synchronization that follows waits for the window as before. - `batch_launch`: when `all_resident_`, raise `h_flag_` to 1 and set `b_k_ = b_steps_`, so that `batch_poll` only polls the stream. - `serve/server.py`, `_take_control`: `restart()` runs `__init__` again while requests are waiting for the control lines, which replaces `wait_lens` and resets `waiting`. The waiting request's `finally` block then raised `ValueError: list.remove(x): x not in list` and could drive `waiting` below zero; it showed up as `the engine reported an error: list.remove(x): x not in list` after each stall. The cleanup now tolerates a restart (identity check, `max(0, ...)`). Stages that are not fully resident (doorbell graph) are unchanged: the new branches only run when `all_resident_` is true. ## Testing Linux, 4x RTX 4090 (24 GB, no P2P), CUDA 13.0, sm_89, engine 0.1.39 with this patch, GSQ-RCO IQ3_S, `--layer-split 12,24,36 --trim-stage-weights --batch 4 --batch-groups 4`, prefill 2048, 262144-token context. All four stages report `100% VRAM resident: zero-doorbell graph`. Requests go through the HTTP server, with short prompts (0-12K tokens) and long ones (30K-100K tokens): | | Before | After | |---|---|---| | Batch windows | the engine exits at the first one (`verify batch: timed out at layer 0`), 9-10 restarts per run | no engine error, a single engine start for the whole run | | 4 concurrent requests, short prompts | 0 of 12 complete (the engine keeps restarting) | 12 of 12, 81 tok/s per request, first token in 1.1 s (median) | | 4 concurrent requests, 30K-100K prompts | - | 6 of 6, 50 tok/s per request, first token in 5.8 s (median) | | 1 request (solo path) | 178 tok/s | 177 tok/s | `serve.test_parallel`, `serve.test_lifecycle` and `serve.test_server` pass (158 tests). Not tested: Windows, HIP, and a split where some stages are fully resident and others are not. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:26 +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#2829
No description provided.