mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3788] [CLOSED] [Engine] q36: offload whole expert layers to helper GPUs (peer prefill, row split, and the slot-layout + context-fit fixes) #4781
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#4781
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/3788
Author: @maoyufeng1985
Created: 10/23/2026
Status: ❌ Closed
Base:
main← Head:rebase-foundation📝 Commits (10+)
02d522aqwen36: whole layers' experts run on helper GPUs (--expert-cache-device1..3)d404c3aqwen36: opt-in int8 KV cache (--kv fp32|int8|k8v8|k8v32|k32v8)6f205cdqwen36: int8 KV cache extends to the MTP block (--kv now applies to every state index)b53cceaqwen36: per-entry helper split (the helper takes the entries it holds, not whole layers)4d1d904plans: the post-rebase measurements (four-config parity, the warmup fix, MTP)16c9b55plans: the warmup OOB independent review and the real bottleneck (22.6 ms/token of host wait, 56 tok/s ceiling)3287425qwen36: STRATA_Q36_HELPER_ASYNC - the helper's wait overlaps the layer's own workb9f74c0plans: the helper-async A/B (+7%, 26.6 vs 25.1 tok/s) and the presence-based-flag pitfallaed169fplans: cross-layer queue design - zero-copy off is the real win (+48%), ring design held in reservec9daa20qwen36: one stderr line naming STRATA_REMOTE_ZEROCOPY when helpers are opened📊 Changes
29 files changed (+7887 additions, -369 deletions)
View changed files
📝
CMakeLists.txt(+6 -2)📝
include/strata/core/expert_cache.hpp(+16 -0)📝
include/strata/core/remote_expert_opt.hpp(+6 -1)📝
include/strata/core/remote_experts.hpp(+101 -25)📝
include/strata/kernels/cpu/expert_layout.hpp(+11 -0)📝
include/strata/kernels/iq_kernels.hpp(+7 -0)➕
plans/2026-10-15-ornith-build-bench.md(+30 -0)➕
plans/2026-10-15-port-multigpu-qwen35.md(+122 -0)➕
plans/2026-10-15-pull-upstream-local-patches.md(+74 -0)➕
plans/2026-10-17-q36-three-card-runbook.md(+993 -0)➕
plans/2026-10-19-q36-23ms-breakthrough.md(+137 -0)➕
plans/2026-10-19-q36-beyond-100tok-roadmap.md(+114 -0)➕
plans/2026-10-19-q36-rendezvous-off-moe-end.md(+228 -0)➕
plans/2026-10-20-q36-1p3h-optimal.md(+350 -0)➕
plans/2026-10-20-q36-prefill-helper-vram.md(+442 -0)➕
plans/2026-10-21-q36-peer-ima-root-cause.md(+519 -0)➕
plans/2026-10-21-q36-stager-benefit-negative.md(+190 -0)📝
src/core/expert_cache.cpp(+9 -3)📝
src/core/remote_expert_opt.cu(+83 -32)📝
src/core/remote_experts.cpp(+413 -146)...and 9 more files
📄 Description
Problem
On a one-GPU-plus-host-RAM box, the q36 (Qwen3.6-35B-A3B) prompt phase was the wall:
a P100 as the primary and three P104s idle. This workstream moves whole layers' experts
onto the helper GPUs and prefill-parallelizes them, and fixes the two correctness bugs
that made the offload produce NaN instead of answers.
Result (192.168.1.98, P100 + 3×P104, no P2P): prompt prefill goes from ~156 tok/s
(peers off) to ~246–254 tok/s (row split + peers on + the host route), and decode is
unchanged (tg128 52.1–53.0). Everything is opt-in; the default path (no helper flags,
no
--kv, default context) is byte-identical to the last release.What is here (one coherent stack, 27 commits)
--expert-cache-device1..3), in two geometries:layer stripes, and the row split (
STRATA_Q36_HELPER_PARALLEL=1, each helper takesexpert % n == kof every layer and the helpers run one layer at the same time).own, results back through pinned host rows (
STRATA_Q36_PREFILL_PEERS=1STRATA_Q36_PREFILL_PEERS_HOST=1).a layer's experts as
w + z * expert_bytes, which only works when two consecutiveexperts of a layer sit exactly the engine's
strideapart. Two separate layouts brokethat: 256-byte alignment (a Q6_K layer's stride 2041200 becomes 2041344) and the
row split's expert-outer ranked order (a layer's two experts end up ~40 slots apart,
gap 76722000 instead of 2041200). The fix lays slots out with the engine's step and
layer-major, and checks the property at startup and per layer — a cache whose slot
geometry is not the engine's is a startup failure naming the layer, not NaN rows in
the first answer.
looked at the context, so
--max-context 512on a big card got a 2048-token chunk andwrote past the KV (an illegal-memory-access instead of a refusal). The chunk is now
clamped to the context, and a prompt that cannot fit (prompt + MTP drafts + 1 > ctx)
refuses with a clear message, RC=2.
--mtp-calibrate N.Validation
All measured on 192.168.1.98, model
Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf.Passed:
--bench-pp 160 --bench-tg 8, row split + peers on + host route)runs RC=0 with no IMA and no NaN; all 40 layers finite. A six-configuration matrix
(wide pp512 window, one helper, stripe mode, peers-off parity
gen: 220) is green.--mtp 2with three helpers, tg128 51.5–52.8against the 52.1–53.0 measured before the slot renumber - the draft chain did not
regress.
--max-context 512command now refuses with RC=2; a prompt that fitsthe 512-cell context still runs at 79.4 tok/s; the default-context answer is unchanged.
--tokens 32 --n 1).Not run:
path is untouched, but the other backends were not compiled here.
--kv int8: the engine reports the flag INERT in thatshape (the MTP block's layer is hybrid), so it is not a measurement.
Failed: none.
Limits
Everything is opt-in behind its flag or option; a default run is unchanged. Validation
is CUDA-only. The full evidence trail, with every number and how it was measured, is in
plans/2026-10-21-q36-peer-ima-root-cause.md.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.