Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Layer split: --vram-reserve-later-mib, a separate reserve for the later cards

Francesco Albano5c4105c07364
diff --git a/docs/MULTI_GPU.md b/docs/MULTI_GPU.md
index 1270125b3..abf2f5a04 100644
--- a/docs/MULTI_GPU.md
+++ b/docs/MULTI_GPU.md
@@ -102,6 +102,10 @@ it goes).
A card holding more experts can change which experts run on the GPU, so the output can differ slightly from a run
without it.
+**A separate VRAM reserve for the later cards:** `--vram-reserve-later-mib N` (default: `--vram-reserve-mib`'s value).
+The card that drives the monitors needs more headroom than one that drives none; with the display on the last card,
+`--vram-reserve-mib 300 --vram-reserve-later-mib 1800` gives the first card's cache that VRAM.
+
**auto** tries every placement (all of them for two or three cards; proportional to the free VRAM beyond that) and
keeps the one whose caches would hold the most of the expert profile, hottest pairs weighted most; ties go to the
placement that leaves the fullest card the most room. The startup log prints the choice:
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index c676719a9..ce5d1b0bc 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -427,6 +427,9 @@ struct Options {
/// `VRAM <reserve_mib>` command can give part of it back to other programs and take it again. Off: one cudaMalloc.
bool vram_elastic = false;
int64_t vram_segment_mib = 512;
+ /// `--vram-reserve-later-mib N`: the reserve on a layer split's later cards (default: the same as the first).
+ /// A card that drives no display needs less than the one the monitors are on.
+ int vram_reserve_later_mib = -1;
/// Plan v0.3 P5: batched prompt processing in chunks of this many tokens (0 = the token path).
int64_t prefill_chunk = 0;
/// `--prefill auto`: the largest chunk (up to 8192) whose buffers the expert cache can lend. Every expert a chunk
@@ -1376,6 +1379,8 @@ int main(int argc, char** argv) {
else if (a == "--expert-cache-remote-placement")
o.expert_cache_remote_placement = next("--expert-cache-remote-placement");
else if (a == "--vram-reserve-mib") { o.vram_reserve_mib = std::atoi(next("--vram-reserve-mib")); o.vram_reserve_given = true; }
+ else if (a == "--vram-reserve-later-mib")
+ o.vram_reserve_later_mib = std::atoi(next("--vram-reserve-later-mib"));
else if (a == "--prefill") {
const std::string v = next("--prefill");
o.prefill_auto = v == "auto" || v.rfind("auto:", 0) == 0;
@@ -2743,7 +2748,9 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: layer split: CUDA%d free memory: %s\n", dev < 0 ? 0 : dev,
cudaGetErrorString(e));
const int64_t pf = search && split_own_auto && !place_with_reserve ? 0 : split_pf_mib;
- const int64_t reserve = ((int64_t) o.vram_reserve_mib + pf + (later ? kWindowMib : 0) +
+ const int64_t base_reserve =
+ later && o.vram_reserve_later_mib >= 0 ? o.vram_reserve_later_mib : o.vram_reserve_mib;
+ const int64_t reserve = (base_reserve + pf + (later ? kWindowMib : 0) +
(drafter ? kDrafterMib : 0)) << 20;
return std::max<int64_t>((int64_t) fb - reserve, 0);
};