---
title: "Gangs and parallelism"
description: "Split one model across several pods and machines with shard groups — pipeline, tensor and expert parallelism, LeaderWorkerSets, RDMA fabrics and the fabric proof."
url: "https://opod.io/docs/control-plane-endpoints/gangs/"
markdown_url: "https://opod.io/docs/control-plane-endpoints/gangs.md"
section: "Endpoints"
last_updated: "2026-10-31"
---

# Gangs and parallelism

> Split one model across several pods and machines with shard groups — pipeline, tensor and expert parallelism, LeaderWorkerSets, RDMA fabrics and the fabric proof.

A **gang** is one engine instance split across several pods, for a model too big for one card or one machine. The plan states it in `shardGroups[]`. The gang's **head** is the part that coordinates it; it is a worker rank, never the leader.

| Engine    | How it joins parts               | Across vendors                |
| --------- | -------------------------------- | ----------------------------- |
| llama.cpp | RPC servers behind a coordinator | yes: the only engine that can |
| vLLM      | Ray ranks launched by core       | no (`E-GANG-VENDOR`)          |
| SGLang    | its own distributed launcher     | no (`E-GANG-VENDOR`)          |

Any other engine is refused `E-ENGINE-NO-GANG`, with the single-node shape (`parallelism.tensor`) as the alternative. Tenstorrent gangs are not placed (`E-TT-GANG`). A gang's engine is the plan's engine: a `shardGroups[].engine` that differs from `model.engine` is refused.

**Figure: Splitting one model across cards and machines.** One model split by tensor parallel and pipeline parallel across cards and machines; each moving dot is one token's traffic on that link, and the verdict says what the split costs on the network. The interactive figure is on the web page: <https://opod.io/docs/control-plane-endpoints/gangs/>

## In short

When a model does not fit on one card, split it. Inside one machine, set `parallelism.tensor` on a worker: no gang is needed and it is the fastest split. Across machines, write a gang in `shardGroups[]`: a list of parts, one per machine, that together run one copy of the model. The control plane starts the parts together and the leader routes to the gang as one worker.

## When you need it

- The model's weights and KV cache do not fit in one card: use `parallelism.tensor` on one machine.
- They do not fit in one machine: use a pipeline gang across machines.
- You want to use cards of two vendors for one model: a llama.cpp gang (capacity, not speed).
- You serve a mixture-of-experts model on vLLM: `parallelism.expert: true`.

## Do it

1. **Try one machine first**

   ```yaml
   workers:
     - { node: node-a, engine: vllm, parallelism: { tensor: 2 } }
   ```

   Preview it. If it fits, stop here.

2. **Write a gang across two machines**

   ```yaml
   placement: explicit
   model: { id: qwen2.5-32b-instruct, engine: vllm }
   colocation: dedicated
   workers: []
   shardGroups:
     - id: g0
       head: node-a
       parallelism: { pipeline: 2 }
       parts:
         - { node: node-a }
         - { node: node-b }
   ```

   Each part is one pod on its node. `pipeline: 2` splits the layers between the two parts; `flags.pp_layer_partition` sets the split by hand.

3. **Preview it**

   Put the plan in a create body and `POST` it to `/api/v1/endpoints/preview`. Expect one claim per part, each with `part: "g0"`, and advisories that state the cost of crossing machines.

4. **Create it, or roll it out**

   Create the endpoint with the same body, or post the plan to `POST /api/v1/endpoints/{id}/rollouts` for an existing one. A rollout also runs the fabric proof between the two machines.

## Check it worked

```bash
curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/status | jq '{phase, gangs}'
curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/shards | jq .
```

A good answer: `phase` is `serving`, `gangs[0].render` is `leaderworkerset` (or `per-part`, with the reason), and the leader's gang row for `g0` is ready. In the console the **Shards & parallelism** page shows each part on its node.

## If it fails

| Code                           | Cause                                                                                               | Fix                                                                           |
| ------------------------------ | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| `E-ENGINE-NO-GANG`             | the engine cannot form a gang                                                                       | `parallelism.tensor` on one machine, or llama.cpp, vLLM or SGLang             |
| `E-GANG-VENDOR`                | vLLM or SGLang parts on different vendors                                                           | one vendor, or llama.cpp                                                      |
| `E-GANG-HEAD`                  | `head` is not one of the parts' nodes                                                               | name a part's node, or leave it empty                                         |
| `E-GANG-NAME`                  | the gang `id` is longer than 28 characters                                                          | a shorter id                                                                  |
| `E-TP-DOMAIN`                  | `devices` per part is more than the node has                                                        | fewer `devices`, or a bigger node                                             |
| `E-PP-LAYERS`                  | more pipeline stages than the model has layers                                                      | fewer parts                                                                   |
| `E-GANG-SUBSTRATE`             | the LeaderWorkerSet controller is down, or parts are neither one per machine nor all on one machine | restore it with `helm upgrade --reset-then-reuse-values`, or reshape the gang |
| `E-GANG-MULTI`                 | several active gangs on a leader without `shard_groups`                                             | roll onto a newer leader image, or one gang                                   |
| The gang runs but never serves | the coordinator did not form                                                                        | **Shards → Re-form**, or `POST …/shards/reform`                               |

## Inside one machine first

Tensor parallelism inside one machine is the fastest split. It needs no gang: set `parallelism.tensor` on a worker.

```yaml
workers:
  - { node: node-a, engine: vllm, parallelism: { tensor: 2 } }
```

`tensor` must be a power of two the node can hold and, when the catalog records the model's architecture, divide its attention heads (`E-TP-HEADS`). llama.cpp does not split by tensor inside one worker (`E-SHAPE`).

## A pipeline gang across machines

```yaml
shardGroups:
  - id: g0
    engine: vllm
    head: node-a
    parallelism: { pipeline: 2 }
    parts:
      - { node: node-a, vramBudgetGb: 20 }
      - { node: node-b, vramBudgetGb: 20 }
```

| Field                  | Meaning                                                                                                                                                                                                                                                                                                                                         |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                   | the gang's id; at most 28 characters, because Kubernetes caps the label it stamps on every gang pod (`E-GANG-NAME`)                                                                                                                                                                                                                             |
| `engine`               | defaults to the model's engine; must equal it                                                                                                                                                                                                                                                                                                   |
| `head`                 | the node of the part that coordinates; must be one of the parts' nodes (`E-GANG-HEAD`); default the first part                                                                                                                                                                                                                                  |
| `parallelism.pipeline` | equals the number of parts; at most the model's layers (`E-PP-LAYERS`)                                                                                                                                                                                                                                                                          |
| `parallelism.tensor`   | devices per part, uniform                                                                                                                                                                                                                                                                                                                       |
| `parts[]`              | `node`, `gpu`, `vramBudgetGb`, `devices`; an empty `node` lets the placer choose a distinct node per part. A gang needs at least one part                                                                                                                                                                                                       |
| `parts[].devices`      | GPUs the part holds on its node (default 1), the same on every part; dedicated only. More than the node advertises is `E-TP-DOMAIN`                                                                                                                                                                                                             |
| `parts[].vramBudgetGb` | required on every part of a `shared` plan                                                                                                                                                                                                                                                                                                       |
| `flags`                | engine flags for the gang, for example `ctx`, `pp_layer_partition`, `tensor_split` (one list over every part). An SGLang gang takes them from core v0.4.6 (`max_model_len`, `kv_cache_dtype`, `mem_fraction_static`, `extra`, on every rank), which the chart pins in the release after 0.3.6; up to v0.4.5 its ranks started with none of them |
| `kvOffload`            | a CPU KV tier for a vLLM gang: `tier: cpu` and `sizeGb`, the gang's total, split over its ranks. New in 0.3.0                                                                                                                                                                                                                                   |
| `parked`               | set by the autoscaler when a gang is parked                                                                                                                                                                                                                                                                                                     |
| `gaveUp`               | set when the gang's leader gave up forming it after three failed heals: `at`, `attempts`, `code`, `reason`, `revision`. The gang stays parked and the autoscaler never wakes it; a rollout, or an edit that removes the field, clears it. New in 0.3.0                                                                                          |
| `shape`                | set by the autoscaler on a gang it grew from a growth shape. New in 0.3.0                                                                                                                                                                                                                                                                       |

A tensor group across the parts of a gang needs an engine whose tensor width is the gang's (vLLM over Ray, SGLang's launcher); for llama.cpp it is `E-SHAPE`.

Several gangs of one model under one leader are allowed: the leader routes to the least loaded ready gang. In core v0.4.6 that choice is load alone: a conversation's pin, the prefix pin and the route token are not read for a gang. From core v0.4.7 gangs are ranked like workers: a later turn of a conversation, or a prompt whose lead a gang served, stays on that gang while it has a free slot. That needs a leader that advertises `shard_groups`; on an older leader a plan with several active gangs is refused `E-GANG-MULTI` (roll the endpoint onto a newer leader image, park the extra gangs, or use one endpoint per gang). A gang keeps the model's full context window by default. A gang that cannot hold it fails at start; set `shardGroups[].flags.ctx`.

A gang parked by hand, on a plan whose floor keeps it up, is refused `E-PARK-FLOOR`.

## Mixed vendors

Only llama.cpp RPC spans vendors. A mixed gang is capacity, not throughput: activations cross TCP on every hop and decode is bounded by the slowest part. Automatic placement builds one only when no single vendor's pool can hold the model. Preview marks every mixed gang with an advisory. What is proven, and every other vendor rule, is on [Mixed GPU vendors](https://opod.io/docs/control-plane-endpoints/mixed-silicon/).

## How a gang lands

With the LeaderWorkerSet controller installed (`substrate.leaderWorkerSet.enabled=true`, the default), a gang whose parts share one pod template lands as **one LeaderWorkerSet**: atomic landing, and the group is recreated together when a part dies. A gang whose parts need different templates (parts on different vendors) lands as one Deployment per part. `status.gangs[].render` says which (`leaderworkerset` or `per-part`), and why.

If the chart enabled the controller but it is down, gang plans of several pods are refused `E-GANG-SUBSTRATE` until `helm upgrade --reset-then-reuse-values` restores it. Existing gangs keep serving. `E-GANG-SUBSTRATE` also refuses a gang whose parts are neither one per machine nor all on one machine: split it into one gang per machine, or put every part on one.

To re-form a gang whose parts run but whose coordinator does not: **Shards → Re-form**, `POST /api/v1/endpoints/{id}/shards/reform`, or `opodcp endpoint reform NAME` (the command is new in 0.3.0). The route answers `{"reformed": true, "shards": [ … ]}`. `GET /api/v1/endpoints/{id}/shards` shows the leader's own gang rows and their live status; `GET /api/v1/endpoints/{id}/registry` shows the leader's worker rows.

## Expert parallelism

For a mixture-of-experts model on vLLM, `parallelism.expert: true` spreads the experts over every device of the gang; each device is one attention data-parallel rank. `data` is parts × devices (derived when omitted), and `tensor` and `pipeline` are 1. Expert parallelism is a gang shape only: on a worker row it is `E-SHAPE`.

```yaml
shardGroups:
  - id: g0
    engine: vllm
    parallelism: { expert: true }
    parts:
      - { node: node-a, devices: 2 }
      - { node: node-a, devices: 2 }
```

Expert parallelism is partly proven: a two-part expert gang across machines has formed and answered, while an expert gang inside one multi-card machine has not been proven yet. Refused by name: `E-EP-ENGINE` (vLLM only), `E-EP-DENSE` (the catalog records no experts), `E-EP-SHARED` (every rank claims whole cards), `E-EP-DOMAIN` (parts on more than one machine with no passed fabric proof that measured all-to-all between them).

## Fabrics

Between machines a gang rides the pod network over Ethernet unless you give it an RDMA fabric:

| Value                                                  | Meaning                                                                               |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| `substrate.rdmaDevicePlugin.enabled`                   | install the RDMA shared device plugin; fill its `config` with your RDMA NICs          |
| `substrate.multus.enabled`                             | install Multus (thick) so a gang pod gets the fabric interface as a second attachment |
| `fabric.rdmaResource`                                  | the extended resource a gang part requests (default `rdma/hca_shared_devices_a`)      |
| `fabric.networkAttachment`                             | the NetworkAttachmentDefinition the interface comes from (default `opodcp-rdma`)      |
| `fabric.networkAttachmentDefinition.create`, `.config` | render that definition from your CNI config                                           |
| `fabric.hostNetwork`                                   | gang pods on the host network instead; for cells with at most one worker per node     |

An RDMA gang adds `IPC_LOCK`, which the Pod Security `baseline` profile does not allow.

**A link nobody read is `unknown`, not "none".** The probe reads how two cards are linked (NVLink, XGMI, a PCIe distance) from the vendor's tool. When it cannot (no tool, a driver that answers nothing, a VM that hides the fabric), the link is `unknown`. The placer may prefer a link it has read, and never requires one it has not. Until a fabric proof passes, two machines count as two domains, whatever their NICs are. An advisory that names a link says which case it is: read and fast, read and slow, or not read.

### The fabric proof

During a rollout, every gang whose parts sit on more than one machine runs `all_reduce_perf` across its own parts and must clear the bandwidth floor (`GET`/`PUT /api/v1/fabric-policy`, `bandwidthFloorGBps`, default 100). A passed proof makes those machines an RDMA **domain**. A gang inside one machine, a mixed-vendor gang, or a cell with no `engineImages.fabricProbe` image skips the step and says why. In 0.3.0 the step also runs on an endpoint's first create.

## Prefill and decode

A plan can split prefill from decode: worker rows with `role: prefill` and `role: decode` become two pools under one leader, N:M. The roles come in pairs; a plan with one role only is refused. The leader hands the KV cache from prefill to decode for vLLM; it serves a request whole on a decode worker when no prefill worker takes requests, the prefill step fails, or a repetition penalty is in force. On SGLang the roles are accepted and every request is served whole. The KV handoff, the pools and the per-role budgets are new in 0.3.0. The handoff is built for vLLM on NVIDIA and proven on hardware in one shape only: both halves on one card. A pair on two cards of one machine, and the retry on another pair after a lost transfer, are not yet proven on hardware. The leader times each handoff per pair (`opod_pd_handoff_seconds`), and each worker reports the KV its engine moved and its requests waiting on a KV load (`opod_pd_transfer_*`, `opod_pd_kv_fetch_requests`), so a slow link shows apart from a busy decoder. This arrives in the core release after v0.4.8 and is not yet proven on hardware. In the release after 0.3.6 the endpoint page's KV card shows, for each decode worker, its engine's KV transfer speed in GB/s over the card's 10 s poll and its requests waiting on a KV load by stage (waiting, moving, loaded): moving high with loaded low is a slow transfer, loaded high is a busy decoder, and a figure the engine does not report reads "not reported". The autoscaler does not read them: a pair still grows as a pair. Refused:

| Code          | Cause                                                                                                                                                                                                                                           |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `E-PD-ENGINE` | the engine has no KV connector to hand a prompt's cache from prefill to decode; or a vLLM pair sits on a vendor the handoff is not proven on — every vendor but NVIDIA today, because the AMD image does not yet carry the RIXL runtime (0.3.0) |
| `E-PD-DOMAIN` | a half with no node, or a pair across nodes with no passed fabric proof between them                                                                                                                                                            |
| `E-PD-VENDOR` | the halves sit on different vendors (0.3.0)                                                                                                                                                                                                     |
| `E-PD-TP`     | neither half's tensor degree divides the other's (0.3.0)                                                                                                                                                                                        |
| `E-PD-TIER`   | a KV tier on a half that cannot take one (0.3.0)                                                                                                                                                                                                |

A prefill/decode endpoint grows and shrinks by a whole pair; growth shapes do not apply to it.
