Skip to content

engine-cerebras, kernels-cerebras: a ring of seats serves several sequences on one program - #1718

Open
ingim wants to merge 1 commit into
mainfrom
cerebras-seat-ring
Open

ingim wants to merge 1 commit into
mainfrom
cerebras-seat-ring

Conversation

@ingim

@ingim ingim commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

A program of M seats serves M sequences on one wafer program: every lap passes each seat once, so decode throughput scales with concurrent streams while a single stream keeps its speed.

  • Seats ring (kernels-cerebras): SEATS=M wraps a single-sequence build; SEATS=1 emits the sources byte-identical to main. Hazard checks cover the queues a ring rebinds and its handoffs.
  • Engine seats (engine-cerebras): Pie's lanes take seats; a seat whose lane leaves what it ran restarts from 0 with its rows forced. Greedy readouts by argmax.
  • Shared KV pool: seats take host-stated KV windows in one pool; plan positions are the per-sequence limit; windows grow in place, a free seat keeps an even share, Pie's pages come from the pool. wafer-bench --seats/--windows runs a ring bare.
  • Fixes: a lane waiting for an execution seat no longer holds the frame gate (runtime/scheduler/frame.rs, only when admission is capped); a one-sequence program serves one lane a fire (was replaying history per token); its launch writes the first token id (Gemma E2B/E4B); Kv::history keeps a reused slot's prefix.

CS-3, pie serve, 256 tokens, aggregate decode tok/s (bare ring in parentheses):

model M N=1 N=4 N=8 N=16
Llama 3.1 8B 7 (13,598) 1,847 6,448 6,312 8,318
Qwen3.5-9B 7 (12,775) 1,832 5,807 5,260 6,001
Qwen3.5-4B 7 (13,692) 1,965 6,198 5,620 6,464
Qwen3-8B 8 (13,296) 1,547 5,396 10,778 10,039
Qwen3.5-0.8B 5 (16,194) 3,231 10,036 9,141 9,091

Every stream equals its solo run; bare M-seat runs match M=1's hash, including uneven and moved windows. A 2000-token stream beside short ones decodes at ~1,880 tok/s. Gemma and gpt-oss stay M=1.

Tests: engine-cerebras 31, kernels-cerebras 77, runtime 163, worker 11; fmt and clippy clean.

…uences on one program

- Seats ring: a program of M seats passes every seat each lap; the seats
  wrap a single-sequence build, and SEATS=1 writes the sources as before.
  Hazard checks cover queues rebound in a ring and its handoffs.
- Engine seats: the ring serves Pie's lanes, one per seat. A seat whose lane
  leaves what it ran starts again from 0 with its rows forced. Greedy
  readouts are taken by argmax.
- Shared KV pool: the seats take KV windows the host states in one pool. A
  plan's positions are the per-sequence limit. Windows grow in place where
  they can, a free seat keeps an even share, and Pie's pages come from the
  pool. wafer-bench --seats/--windows runs a ring bare.
- Fixes: a lane waiting for an execution seat does not hold the scheduler's
  frame gate; a one-sequence program serves one lane a fire and its launch
  writes its first token id; Kv::history keeps a slot's next lane's prefix.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant