mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #492] [CLOSED] Heterogeneous multi-GPU roles: whole model on one GPU, the MTP draft head on the other #2666
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#2666
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/492
Author: @hireymage
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:hetero-roles-pr📝 Commits (10+)
1bd572fdocs: heterogeneous multi-GPU MAIN+DRAFT design (Fase 1 analysis)3a48cbecore: per-device DeviceCaps discovery + the peer matrix in strata-device41cb550core: one shared device_cc_major accessor under the kernel-selection sites97b824dgenerate: --main-device / --draft-device flags, validation, roles banner302820dmtp: the drafter's device follows the role, own RoPE when it crosses devicesc967f99mtp: the draft head crosses devices on its own, no peer access assumed4c7261fmtp: honest cross-device errors, the roles validation follows the real constraint0679e5averify: the window hand-off rides a mapped host mirror; no peer access needede66030fexpert_cache: rebuild layer_next_ in open_sized; per-layer admission read out of slot 04b07e90mtp: the drafter's gr_read scratch runs on its own device in roles mode📊 Changes
12 files changed (+1479 additions, -36 deletions)
View changed files
➕
docs/HETERO_MGPU_PLAN.md(+597 -0)📝
include/strata/core/device.hpp(+38 -0)📝
include/strata/core/mtp.hpp(+23 -2)📝
include/strata/core/verify.hpp(+11 -0)📝
src/core/conversation_snapshot.cpp(+14 -0)📝
src/core/device.cu(+89 -0)📝
src/core/device_main.cpp(+34 -0)📝
src/core/mtp.cpp(+214 -12)📝
src/core/verify.cpp(+16 -1)📝
src/kernels/cuda/qsa_select.cu(+7 -12)📝
src/program/generate.cpp(+229 -9)➕
tools/hetero-test.sh(+207 -0)📄 Description
Closes/addresses discussion in #490.
What this adds
Heterogeneous multi-GPU roles — a different way to use two (not necessarily equal) GPUs than
--split-device: 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 drafter is tiny next to the main model, so moving it off the main GPU returns its VRAM (~870 MiB + the draft head) to the main GPU's expert cache, while the drafter gets its own device entirely.New (all opt-in, no behavior change when none are passed):
--main-device N --draft-device M— explicit role placement; both directions work. The drafter's K/V, ring restore, gr workspace and graph captures are re-homed on the draft device; the verify window's hand-off rides a mapped host mirror, so no peer access is ever assumed;--auto-roles— pick the roles from the capability records (main= device 0, draft = the best free remaining; refuses when < 2 CUDA devices or no--mtpis loaded);--draft-prefill-parallel— the prompt fill queues and overlaps the decode instead of blocking it;--draft-chain-batch— the draft chain's step graphs launch back to back with ONE wait per round instead of one per step (drafting 4.63 → 4.14 ms/round on the source rig, ~11 %);per-device DeviceCapsdiscovery + the peer matrix instrata-device, and a per-role VRAM report after binding, so the trade is visible at start.The discipline: placement never changes the output, only the measured time
All claims are on greedy token streams compared bit-exactly across repeated runs, compared under equal expert residency (equal auto slot counts, or a forced
--expert-cache Nshared by both runs) — because when the roles split, the drafter's VRAM frees up on the main GPU, the expert cache there grows, and a different expert-cache size legitimately decodes differently today. Under that rule the roles 0→1, 1→0, reversed, batched and pipelined all reproduce the same-device stream token for token.The plan, the measurements and the step record live in
docs/HETERO_MGPU_PLAN.md(sections 10–12 hold the Fase-7/8/9/12/13 numbers and the gate rule).How to reproduce on your own rig
runs the variant matrix (single- and two-GPU rigs; the harness detects the rig itself), extracts the greedy stream md5s, picks bit-exactness references by residency, and writes
/tmp/het/report.md— the full run table, verdicts and the residency-dividend note. Any report pasted into #490 is exactly the evidence this feature still needs from non-Pascal rigs.Source-rig validation (2× GTX 1080 Ti, cc 6.1, 125B Q2_0 pack, 16 runs): 20 PASS / 0 FAIL, stream md5 clusters by residency (V0=V1f=V2
c1c2827c7571; V1=V3–V6dc295284ab30), V1f vs V0 bit-identical — the placement-exactness proof.Review notes
hetero-roles), but only the role/flags/harness features are proposed here.--split-devicepath is untouched.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.