[GH-ISSUE #490] Heterogeneous multi-GPU roles: whole model on one GPU, the MTP draft head on the other (+ test harness) #225

Closed
opened 2026-11-04 01:41:03 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @hireymage on GitHub (Oct 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/490

Hello Niko — while working with Strata's MTP speculative decoding on a two-GPU box, I noticed the GPUs don't have to be (and rarely are) equal, and today's --split-device uses them as one pipeline, which costs capacity on both and doesn't separate the model from the drafter. So I explored a different placement: the whole model (KV + verify) stays on the main GPU, only the MTP draft head runs on the second one — no P2P required, no layer split. The point of doing this with two unequal GPUs: the drafter is tiny relative to the 125B main, so moving it (≈870 MiB + the draft head) off the main GPU gives the main GPU's expert cache that VRAM back, while the drafter gets a whole GPU's free VRAM to grow its own buffers; and the two directions of "which card is the main" let the user match whatever hardware they actually own.

What I built on top of 0.1.34 (sm61-hetero-0134, ~10 commits, all opt-in flags, default behavior unchanged):

  • --main-device N --draft-device M — explicit role placement (both directions work; the drafter's K/V, ring restore, workspace and graph captures all get re-homed on the draft device);
  • --auto-roles — pick the roles from the capability records (main = device 0, draft = the best free remaining);
  • --draft-prefill-parallel — the prompt fill overlaps the decode instead of blocking it (works with the roles);
  • --draft-chain-batch — the draft chain's step graphs launch back to back with one wait per round instead of one per step (drafting went 4.63 → 4.14 ms/round same-device, ~11 %);
  • a per-role VRAM report after binding, so the trade is visible at start.

The guarantee I wanted before claiming anything: placement never changes the output, only the measured time. Every claim below is on greedy token streams compared bit-exactly, across repeated runs, and — this is the part I'd like to stress — the honest subtlety is that expert residency is not placement: when the roles split, the drafter's VRAM frees up on the main GPU, the auto expert cache there grows, and a different expert-cache size legitimately decodes differently today. So all bit-exactness comparisons are done under equal residency (either the same auto slot count, or a forced --expert-cache N shared by both runs). Under that rule, roles 0→1, 1→0, reversed, batched and pipelined all reproduce the same-device stream token for token (e.g. the roles run with a forced cache is bit-identical to the no-roles baseline).

Where I think more speed is still on the table (reasons, not results — this is the part I'd most want measured by other people):

  • prefill using both GPUs: right now the prefill is expert-mmap I/O-bound on my pack (78–98 % of the window is page-cache reads of experts), pipelining the prompt fill into the decode didn't move the needle here — but with a cached/pinned expert profile, or a smaller model, an actual two-GPU prefill split may pay off;
  • draft speed: the chain batching above recovered a measurable slice of the drafter's own latency (4.63→4.14 ms/round on a 1080 Ti; the drafter is ~0.5 % of a ~939 ms decode window on this rig, so it's measured, not felt — a faster second GPU should make the batch's per-step wait elimination worth proportionally more).

How to test it on your own rig (the piece I'd most like to hand over): I built a portable harness, tools/hetero-test.sh — you give it your build dir and your own model-load flags, it runs the variant matrix (baseline / roles both ways / prefill-parallel / chain-batch / both / auto-roles; a single-GPU batch variant falls back automatically), extracts the greedy stream from each log, picks bit-exactness references by residency (the rule above, encoded), and writes an OUT/report.md table (accepted/of-totals, tok/round, ms/round drafting, expert slots, stream md5) plus the verdicts — ready to paste back. On my rig (2× GTX 1080 Ti, 125B Q2_0 pack, 16 runs) it reported 20 PASS / 0 FAIL, and the report's md5 clusters reproduce exactly what I measured by hand. A report from any non-Pascal rig — one GPU or two unequals — would be exactly the evidence both of us need before I open a clean hetero-only PR (I kept my sm_61 work separate, so the PR branch is easy to cut).

I have not opened the PR yet because I'd rather this land as: issue first, your read on the idea, then a small PR (flags + the drafter device handling + the harness), not a dump.

Originally created by @hireymage on GitHub (Oct 2, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/490 Hello Niko — while working with Strata's MTP speculative decoding on a two-GPU box, I noticed the GPUs don't have to be (and rarely are) equal, and today's `--split-device` uses them as one pipeline, which costs capacity on both and doesn't separate the model from the drafter. So I explored a different placement: **the whole model (KV + verify) stays on the main GPU, only the MTP draft head runs on the second one** — no P2P required, no layer split. The point of doing this with two unequal GPUs: the drafter is tiny relative to the 125B main, so moving it (≈870 MiB + the draft head) off the main GPU **gives the main GPU's expert cache that VRAM back**, while the drafter gets a whole GPU's free VRAM to grow its own buffers; and the two directions of "which card is the main" let the user match whatever hardware they actually own. **What I built on top of 0.1.34 (`sm61-hetero-0134`, ~10 commits, all opt-in flags, default behavior unchanged):** - `--main-device N --draft-device M` — explicit role placement (both directions work; the drafter's K/V, ring restore, workspace and graph captures all get re-homed on the draft device); - `--auto-roles` — pick the roles from the capability records (main = device 0, draft = the best free remaining); - `--draft-prefill-parallel` — the prompt fill overlaps the decode instead of blocking it (works with the roles); - `--draft-chain-batch` — the draft chain's step graphs launch back to back with **one** wait per round instead of one per step (drafting went 4.63 → 4.14 ms/round same-device, ~11 %); - a per-role VRAM report after binding, so the trade is visible at start. **The guarantee I wanted before claiming anything: placement never changes the output, only the measured time.** Every claim below is on greedy token streams compared bit-exactly, across repeated runs, and — this is the part I'd like to stress — the honest subtlety is that **expert residency is not placement**: when the roles split, the drafter's VRAM frees up on the main GPU, the auto expert cache there grows, and a different expert-cache size legitimately decodes differently today. So all bit-exactness comparisons are done **under equal residency** (either the same auto slot count, or a forced `--expert-cache N` shared by both runs). Under that rule, roles 0→1, 1→0, reversed, batched and pipelined all reproduce the same-device stream token for token (e.g. the roles run with a forced cache is bit-identical to the no-roles baseline). **Where I think more speed is still on the table** (reasons, not results — this is the part I'd most want measured by other people): - **prefill using both GPUs**: right now the prefill is expert-mmap I/O-bound on my pack (78–98 % of the window is page-cache reads of experts), pipelining the prompt fill into the decode didn't move the needle *here* — but with a cached/pinned expert profile, or a smaller model, an actual two-GPU prefill split may pay off; - **draft speed**: the chain batching above recovered a measurable slice of the drafter's own latency (4.63→4.14 ms/round on a 1080 Ti; the drafter is ~0.5 % of a ~939 ms decode window on this rig, so it's measured, not *felt* — a faster second GPU should make the batch's per-step wait elimination worth proportionally more). **How to test it on your own rig (the piece I'd most like to hand over):** I built a portable harness, `tools/hetero-test.sh` — you give it your build dir and your own model-load flags, it runs the variant matrix (baseline / roles both ways / prefill-parallel / chain-batch / both / auto-roles; a single-GPU batch variant falls back automatically), extracts the greedy stream from each log, picks bit-exactness references **by residency** (the rule above, encoded), and writes an `OUT/report.md` table (accepted/of-totals, tok/round, ms/round drafting, expert slots, stream md5) plus the verdicts — ready to paste back. On my rig (2× GTX 1080 Ti, 125B Q2_0 pack, 16 runs) it reported **20 PASS / 0 FAIL**, and the report's md5 clusters reproduce exactly what I measured by hand. **A report from any non-Pascal rig — one GPU or two unequals — would be exactly the evidence both of us need** before I open a clean hetero-only PR (I kept my sm_61 work separate, so the PR branch is easy to cut). I have not opened the PR yet because I'd rather this land as: issue first, your read on the idea, then a small PR (flags + the drafter device handling + the harness), not a dump.
Author
Owner

@hireymage commented on GitHub (Oct 2, 2026):

The code is up for whoever wants to actually run this:

  • Branch hetero-roles on my fork: https://github.com/hireymage/Strata/tree/hetero-roles (built on 0.1.34; every flag is opt-in, no behavior changes when none are passed)
  • git clone -b hetero-roles https://github.com/hireymage/Strata.git — build as you normally build Strata (the CUDA arch of YOUR cards is picked up automatically; I verified the branch compiles and runs on cc 6.1, i.e. anything ≤ your cards should be a subset)
  • Run the harness (tools/hetero-test.sh): tools/hetero-test.sh <your-build-dir> "<your model-load flags>" /tmp/het 60 2 — one GPU or two; it auto-detects the rig, runs the variants (baseline / roles both ways / prefill-parallel / chain-batch / both / auto-roles), and writes /tmp/het/report.md with the greedy stream md5s, the bit-exactness verdicts and the expert-slot counts
  • Paste the report back here (or in your own issue reply) — the md5 clusters + slot counts are exactly the evidence I asked for

Note on expectations: on a single-GPU rig you get the --draft-chain-batch variant alone; the roles need --mtp and two devices.

<!-- gh-comment-id:5951248878 --> @hireymage commented on GitHub (Oct 2, 2026): The code is up for whoever wants to actually run this: - **Branch `hetero-roles` on my fork**: https://github.com/hireymage/Strata/tree/hetero-roles (built on 0.1.34; every flag is opt-in, no behavior changes when none are passed) - `git clone -b hetero-roles https://github.com/hireymage/Strata.git` — build as you normally build Strata (the CUDA arch of YOUR cards is picked up automatically; I verified the branch compiles and runs on cc 6.1, i.e. anything ≤ your cards should be a subset) - **Run the harness** (`tools/hetero-test.sh`): `tools/hetero-test.sh <your-build-dir> "<your model-load flags>" /tmp/het 60 2` — one GPU or two; it auto-detects the rig, runs the variants (baseline / roles both ways / prefill-parallel / chain-batch / both / auto-roles), and writes `/tmp/het/report.md` with the greedy stream md5s, the bit-exactness verdicts and the expert-slot counts - Paste the report back here (or in your own issue reply) — the md5 clusters + slot counts are exactly the evidence I asked for Note on expectations: on a single-GPU rig you get the `--draft-chain-batch` variant alone; the roles need `--mtp` and two devices.
Author
Owner

@hireymage commented on GitHub (Oct 2, 2026):

Opening #492 — the hetero-only PR (no sm_61/Pascal build work carried; the clean branch is cherry-picked onto current main and compiles for cc 8.6). Same goal as the issue: your read first, reports from other rigs welcome either place.

<!-- gh-comment-id:5951423758 --> @hireymage commented on GitHub (Oct 2, 2026): Opening #492 — the hetero-only PR (no sm_61/Pascal build work carried; the clean branch is cherry-picked onto current main and compiles for cc 8.6). Same goal as the issue: your read first, reports from other rigs welcome either place.
Author
Owner

@Niko1221 commented on GitHub (Oct 2, 2026):

Thanks, an interesting idea, and the harness in #492 is thorough. By your own numbers drafting is about 0.5% of a decode window, so the gain is mainly the ~1 GB of VRAM the drafter would give back to the expert cache. Moving the drafter to its own device touches its KV, its prompt pass and the hand-off, so we'll review #492 properly when there's room. Keeping it open as a feature.

<!-- gh-comment-id:5956993604 --> @Niko1221 commented on GitHub (Oct 2, 2026): Thanks, an interesting idea, and the harness in #492 is thorough. By your own numbers drafting is about 0.5% of a decode window, so the gain is mainly the ~1 GB of VRAM the drafter would give back to the expert cache. Moving the drafter to its own device touches its KV, its prompt pass and the hand-off, so we'll review #492 properly when there's room. Keeping it open as a feature.
Author
Owner

@Niko1221 commented on GitHub (Oct 4, 2026):

We reviewed #492 against 0.1.38. The idea holds up: with no new flags, the default path stays byte-identical once it's rebased (the conflicts are in generate.cpp's adaptive tier and are already covered by #463). It can't go in yet, though:

  • The HIP build breaks: cudaPointerGetAttributes / cudaMemoryType* have no mappings in the HIP compat header.
  • --main-device doesn't place the model anywhere: it always runs on CUDA0, so --main-device 1 --draft-device 0 runs everything on GPU 0.
  • --draft-prefill-parallel can overwrite the prompt pass's rows before the cross-device copy reads them.
  • A failure in localize_rope only prints a warning and carries on.
  • Binding the drafter a second time copies the full head to the draft card.
  • The drafter's VRAM is reserved on the main card instead of the draft card.
  • The verify mirror isn't Portable on HIP.
  • Roles together with --peer-device aren't refused.
  • The draft card isn't synced after a conversation-cache ring restore.

A smaller PR would be easier to take: --draft-device N alone (no --main-device / --auto-roles / --draft-prefill-parallel) with those fixes, the DeviceCaps probe only behind a flag, and the qsa_select refactor left out. By your own numbers drafting is ~0.5% of a window, so the gain is mainly the ~1 GB of VRAM handed back to the main card's expert cache.

<!-- gh-comment-id:5979966985 --> @Niko1221 commented on GitHub (Oct 4, 2026): We reviewed #492 against 0.1.38. The idea holds up: with no new flags, the default path stays byte-identical once it's rebased (the conflicts are in `generate.cpp`'s adaptive tier and are already covered by #463). It can't go in yet, though: - The HIP build breaks: `cudaPointerGetAttributes` / `cudaMemoryType*` have no mappings in the HIP compat header. - `--main-device` doesn't place the model anywhere: it always runs on CUDA0, so `--main-device 1 --draft-device 0` runs everything on GPU 0. - `--draft-prefill-parallel` can overwrite the prompt pass's rows before the cross-device copy reads them. - A failure in `localize_rope` only prints a warning and carries on. - Binding the drafter a second time copies the full head to the draft card. - The drafter's VRAM is reserved on the main card instead of the draft card. - The verify mirror isn't Portable on HIP. - Roles together with `--peer-device` aren't refused. - The draft card isn't synced after a conversation-cache ring restore. A smaller PR would be easier to take: `--draft-device N` alone (no `--main-device` / `--auto-roles` / `--draft-prefill-parallel`) with those fixes, the DeviceCaps probe only behind a flag, and the qsa_select refactor left out. By your own numbers drafting is ~0.5% of a window, so the gain is mainly the ~1 GB of VRAM handed back to the main card's expert cache.
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6155932357 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
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#225
No description provided.