CUDA: the tail-skip default stays off when 90% or more of the experts are in the GPU cache (#1884); STRATA_TAIL_SKIP_MAX_CACHED moves the line

This commit is contained in:
Niko1221 committed 2026-10-10 22:16:48 +02:00
1 parent 0636c4642f
commit 6ab541f625
2 files changed
+19 -2

No files matched your search

+4 -1
View File
@@ -1572,7 +1572,10 @@ tokens identical to 0.1.42 without the change, on the RTX 3060, the RTX A4000 al
Where it applies: serve on a CUDA build with one GPU or a layer split (every stage skips by itself). Not applied, and no line printed: when every expert is
in VRAM (nothing is missed), with `--batch` / `parallel` slots (a window then mixes requests, and one request's skip would depend on another's
tokens: kept off until measured), with a peer-expert tier or a helper GPU, on HIP and SYCL builds. The request log gets
tokens: kept off until measured), with a peer-expert tier or a helper GPU, on HIP and SYCL builds, and (0.1.42.1, #1884) when 90% or more
of all the experts are in the GPU cache: the few misses are cheap there and the skip costs more draft acceptance than it saves (a Tesla V100 32 GB
with Coder IQ1_M, 94.8% of the experts cached, 99.9% decode hits: draft acceptance 70.1% to 68.2%, decode 1-2% slower than 0.1.41). A start-up line
says so; `STRATA_ROUTE_TAIL_SKIP=7` turns it on anyway, and `STRATA_TAIL_SKIP_MAX_CACHED=<percent>` moves the line (101 = never). The request log gets
`route tail skip: N missed experts skipped` (cumulative) while it is active.
**Answers differ slightly from 0.1.41** (`STRATA_ROUTE_TAIL_SKIP=0` brings them back). Teacher-forced KL of the decode path (the default's own greedy text and the default sampled at T=0.8, 28 chat prompts of code,
+15 -1
View File
@@ -8079,7 +8079,21 @@ int main(int argc, char** argv) {
{
const char* tse = std::getenv("STRATA_ROUTE_TAIL_SKIP");
#if !defined(STRATA_USE_HIP)
const bool tail_default_ok = tse == nullptr && !all_experts_resident && o.batch == 0 && o.peer_device < 0;
// #1884: with nearly every expert in the GPU cache (V100 32 GB, Coder IQ1_M: 94.8% of the experts, 99.9% decode hits) the few
// misses are cheap and the skip costs more draft acceptance (70.1% -> 68.2%) than it saves: -1..2% decode. No default then.
size_t cached_experts = 0;
for (int32_t r : host_res) cached_experts += r >= 0 ? 1 : 0;
// (STRATA_TAIL_SKIP_MAX_CACHED=<percent>, default 90, moves the line; 101 = never)
const char* mcs = std::getenv("STRATA_TAIL_SKIP_MAX_CACHED");
const double max_cached = mcs != nullptr && mcs[0] != 0 ? std::atof(mcs) / 100.0 : 0.90;
const bool nearly_all_cached = !host_res.empty() && !all_experts_resident &&
(double) cached_experts >= max_cached * (double) host_res.size();
const bool tail_default_ok = tse == nullptr && !all_experts_resident && !nearly_all_cached && o.batch == 0 &&
o.peer_device < 0;
if (tse == nullptr && nearly_all_cached && o.batch == 0 && o.peer_device < 0)
std::fprintf(stderr, "strata serve: STRATA_ROUTE_TAIL_SKIP is off by default: %.1f%% of the experts are in the GPU cache, so "
"few are missed and skipping them costs more draft acceptance than it saves; "
"STRATA_ROUTE_TAIL_SKIP=7 turns it on\n", 100.0 * (double) cached_experts / (double) host_res.size());
#else
const bool tail_default_ok = false; // HIP and SYCL stay as they were
#endif