mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #490] Heterogeneous multi-GPU roles: whole model on one GPU, the MTP draft head on the other (+ test harness) #225
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#225
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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-deviceuses 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 %);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 Nshared 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):
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 anOUT/report.mdtable (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.
@hireymage commented on GitHub (Oct 2, 2026):
The code is up for whoever wants to actually run this:
hetero-roleson 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)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.mdwith the greedy stream md5s, the bit-exactness verdicts and the expert-slot countsNote on expectations: on a single-GPU rig you get the
--draft-chain-batchvariant alone; the roles need--mtpand two devices.@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.
@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.
@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:cudaPointerGetAttributes/cudaMemoryType*have no mappings in the HIP compat header.--main-devicedoesn't place the model anywhere: it always runs on CUDA0, so--main-device 1 --draft-device 0runs everything on GPU 0.--draft-prefill-parallelcan overwrite the prompt pass's rows before the cross-device copy reads them.localize_ropeonly prints a warning and carries on.--peer-devicearen't refused.A smaller PR would be easier to take:
--draft-device Nalone (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.@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.