diff --git a/docs/MULTI_GPU.md b/docs/MULTI_GPU.md index 67fdfea1..97d4dac4 100644 --- a/docs/MULTI_GPU.md +++ b/docs/MULTI_GPU.md @@ -60,6 +60,15 @@ profiled expert plus the context's KV, the draft layer and the reserve, and says stays. On an R9700 32 GB + RX 9070 XT the R9700 holds all of the Coder's experts: with the flag 4K prompts read at 1,776 tok/s instead of 1,244 (split) and decode runs at ~60 tok/s instead of ~51 (16K prompts ~5% slower than split). +**Short prompts on a split (0.1.32, #340).** 0.1.30 gave each card's prompt path a loan from its own expert cache, +refilled after every request; on cards that hold nearly all their experts that cost short prompts up to a third of +their speed. 0.1.32 refills all cards at once, uses a smaller streaming ring on a split, and lets a card with free +VRAM keep its own prompt buffers - the same output as 0.1.31, measured on an R9700 + RX 9070 XT: 2K prompts 993 -> +1,265 tok/s, 16K 1,852 -> 1,950, decode unchanged. `STRATA_SPLIT_OWN=1` (opt-in) gives every card its own buffers: +2K 1,450 and 16K 2,227 tok/s there, but a full card then keeps a different set of experts resident, so the output +differs from the default's (stable and coherent); `STRATA_SPLIT_OWN=auto` does that only where the buffers are at +most 12% of each card's VRAM. + The engine flags behind it: `--layer-split K1[,K2..]|auto` and `--split-device D1[,D2..]` (the later stages' devices; default the next visible ones). `--layer-split K --split-device 0` runs both stages on one card sharing everything - the bit-exact check of the hand-off, not a speed mode. diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 1f60944e..73106038 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -1311,10 +1311,14 @@ int main(int argc, char** argv) { // small part of every card - at most 12% of its VRAM (16 GB and larger cards) - and borrows on smaller cards, // where the reserve would cost the cache (and the context) the paragraph above is about. Measured with own // buffers on the 9070 XT + R9700: 2K 1588 tok/s, 16K 2006 (0.1.29 1568 / 1935, 0.1.31 993 / 1852). - // STRATA_SPLIT_OWN=1: own buffers on any cards; 0: borrow (0.1.30 / 0.1.31). --split-skip-if-fits keeps the - // loans (it can fall back to one GPU, which must stay as it is). - if (!o.no_prefill_borrow && !o.split_skip_if_fits) { - const char* v = std::getenv("STRATA_SPLIT_OWN"); + // OPT-IN (the owner's choice for 0.1.32): own buffers change which experts a full card keeps resident, so the + // split's output differs from 0.1.31's; the default borrows as 0.1.31 did - with the concurrent refill and the + // 96-blob split ring that alone gave 2K +27%, 16K +5% over 0.1.31, decode unchanged, output identical. + // STRATA_SPLIT_OWN=auto: the 12% rule above; 1: own buffers on any cards; unset/0: borrow. + // --split-skip-if-fits keeps the loans (it can fall back to one GPU, which must stay as it is). + const char* own_env = std::getenv("STRATA_SPLIT_OWN"); + if (!o.no_prefill_borrow && !o.split_skip_if_fits && own_env != nullptr && own_env[0] != '0') { + const char* v = std::string(own_env) == "auto" ? nullptr : own_env; bool own = v ? v[0] == '1' : true; // the buffers of a 2048-token chunk (or the --prefill one) + a 96-blob ring (as split_pf_mib prices them) const int64_t own_chunk = o.prefill_auto || o.prefill_chunk <= 0 ? 2048 : o.prefill_chunk;