From f9a09885c1d431f4e0520dc38813410ef8afdfcb Mon Sep 17 00:00:00 2001 From: cobra91 Date: Wed, 28 Oct 2026 22:43:26 +0100 Subject: [PATCH] Layer split: keep the draft head's room out of the last card's cache (from Strata-DualGPU) The drafter's draft head and its logits are allocated when it binds, after the expert caches are sized. One GPU already keeps their room out of its cache (#199); a split's last stage did not, so on a card without a display they had to come out of a 300 MiB reserve - or not fit at all. The last stage's cache now leaves room for them, as on one GPU. Measured on RTX 5080 + RTX 4060 Ti / 32 GB, Swift 1.5 IQ2_XS, 64K, q4_0 KV, --pipeline-windows 2, --layer-split auto, no --vram-reserve-later-mib: the engine starts, runs and survives a full bench suite (three generations, health 200) with the last card at 433 MiB free, decoding 76.9 tok/s on a 2.7K-token answer. --- src/program/generate.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 7416f4e1d5..b244e3e689 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -8587,8 +8587,13 @@ int main(int argc, char** argv) { GpuStage& st = *stp; const auto& lay = strata::kernels::cpu::expert_layout(); // the drafter and the head are already allocated by now (they load above, before this), so what is left - // to hold back is the windows - and `free_b` has already lost the drafter. - int64_t room = stage_room(st.dev, true, false); + // to hold back is the windows - and `free_b` has already lost the drafter. Not the draft head and its + // logits: the drafter allocates them when it binds, after this, as on one GPU (#199), so on the last stage + // they come out of the cache here. Out of the reserve instead, a later card without a display (300 MiB) + // had no room left for them: "mtp: the draft head does not fit" on two 16 GB cards. (Strata-DualGPU) + const int64_t draft_head = (&st == last_st && !o.mtp.empty() && st.head.loaded()) + ? (int64_t) mtp.bind_bytes(st.head.row_bytes(), n_vocab) : 0; + int64_t room = stage_room(st.dev, true, false) - draft_head; const strata::core::OnDevice on(st.dev); #if defined(STRATA_HAVE_DFLASH2) // DFlash2's own draft head and logits (and, in serve, the prompt staging) are bound on its card AFTER the caches, as the single card prices them (mtp_bind above): without