diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 3f673bff..df3102f2 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1666,6 +1666,14 @@ the pairs in which the switched arm won). They are here so you can try them on y -0.1% (5/6). Boxes that hold all experts in RAM never use the stage buffers. - **`STRATA_ADAPT_LAG=2`: the adaptive tier's copies are waited for one window later** (#764). Decode, 6 pairs: Tesla P100 (PCIe 3.0 x16) +3.5% (6/6 pairs faster), RTX 5070 +0.2% (4/6), RTX 3060 -1.3% (0/6), so it stays opt-in. +- **`STRATA_ADAPT_OVERLAP` (CUDA: on, `=0` turns it off; HIP: `=1` turns it on): the adaptive tier's copies land while the next + window runs, with the same tokens.** The window takes the swaps at the same moment as with #463's wait (so the same experts run + on the GPU and the CPU in every window), but the copies go in layer order and the verify window holds a layer's plan back + until that layer's copies have landed, instead of the whole window waiting for the round (about 10 ms every fourth window on + an A4000, PCIe 3.0 x16). One GPU, the whole arena in RAM, no `--adapt-async`, `--pipeline-windows`, `STRATA_ADAPT_LAG`, + `STRATA_ADAPT_NOWAIT` or `STRATA_DMA_BATCH`; otherwise the log says why it is off. RTX A4000, 6 interleaved pairs each, + decode median tok/s: Q2_0 16 GB 62.5 -> 66.2 (+5.9%), Q2_0 as a 12 GB card 51.3 -> 54.2 (+5.7%), IQ3_XXS 16 GB 48.6 -> 52.6 (+8.3%), + IQ3_XXS as 12 GB 39.3 -> 41.5 (+5.5%), 6/6 pairs faster every time. ## Thread placement: `--aux-cpus` (Linux, off by default) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index c5cd3232..8e898a64 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -1324,9 +1324,16 @@ int adapt_lag() { /// sees the swapped-in experts as resident from its first layer, exactly as after #463's wait (so the tokens are the same /// ones); what changes is only when the bytes arrive: the copies go in layer order and the verify window holds a layer's /// plan back until that layer's copies have landed (AdaptGate in strata/core/verify.hpp). The ~10 ms a 96-swap round -/// took at the next window's start (PCIe 3.0 x16, Q2_0) is then hidden behind the window. Off by default. +/// took at the next window's start (PCIe 3.0 x16, Q2_0) is then hidden behind the window. On for CUDA (=0 turns it off), opt-in on HIP. bool adapt_overlap() { - static const bool v = [] { const char* e = std::getenv("STRATA_ADAPT_OVERLAP"); return e && e[0] == '1'; }(); + static const bool v = [] { + const char* e = std::getenv("STRATA_ADAPT_OVERLAP"); +#if defined(STRATA_USE_HIP) + return e && e[0] == '1'; // HIP: not measured yet, opt-in +#else + return !(e && e[0] == '0'); // CUDA: on since 0.1.43 (same tokens, +5.5..8.3% decode on an A4000); =0 turns it off +#endif + }(); return v; } @@ -8156,9 +8163,9 @@ int main(int argc, char** argv) { } aov = why == nullptr; if (aov) - std::fprintf(stderr, "strata serve: STRATA_ADAPT_OVERLAP=1: the adaptive tier's copies land while the next window runs " + std::fprintf(stderr, "strata serve: adaptive overlap (STRATA_ADAPT_OVERLAP=0 turns it off): the adaptive tier's copies land while the next window runs " "(same tokens, a layer waits for its own copies)\n"); - else + else if (std::getenv("STRATA_ADAPT_OVERLAP") != nullptr) // quiet when it was only the default std::fprintf(stderr, "strata serve: STRATA_ADAPT_OVERLAP=1 is off: %s\n", why); } // a layer split's later stages keep a copy of the residency table on their devices, and swap on their own