Archived
n-gram table: --ngram-table ram reads it from a locked copy in RAM
embed_lookup_q reads the n-gram table through a row cache and direct reads, and about half of a step's rows are first-seen, so steps wait on the drive. --ngram-table ram (default disk, unchanged) copies the table into locked huge pages in the background, checks the copy against the mapping and then serves the gather from memory. MemAvailable, RLIMIT_MEMLOCK and the cgroup limit are checked first; if any is short the table stays on disk. The flag reaches the plugin as an optional `resident` parameter of embed_lookup_q.
This commit is contained in:
1 parent
4252353bc2
commit
e6c8a3d7fa
18 files changed
+363
-56
No files matched your search
@@ -63,6 +63,10 @@ static const Flag g_flags[] = {
|
||||
{ "--weights-disk-tier", nullptr, "read weights that fit neither VRAM nor the host pool from the\n"
|
||||
" container on disk (O_DIRECT); a routed expert is read a layer\n"
|
||||
" at a time, so a step is paced by the drive" },
|
||||
{ "--ngram-table", "MODE", "disk (default) or ram: where the n-gram embedding's host gather\n"
|
||||
" reads its rows. ram copies the table into locked host memory\n"
|
||||
" in the background from the first request and reads the copy\n"
|
||||
" (Qwen3.8-Flash-Next: 47.7 GiB; needs a memlock limit that large)" },
|
||||
{ "--prefix-cache-host-mib", "N", "copy finished conversations' KV to host memory, up to N MiB,\n"
|
||||
" so their VRAM can go to experts and a return restores\n"
|
||||
" instead of re-prefilling. 0 is off. Part of it holds\n"
|
||||
@@ -398,6 +402,12 @@ int config_parse(int argc, char** argv, Config* c) {
|
||||
}
|
||||
}
|
||||
else if (S("--weights-disk-tier")) { c->weights_disk_tier = true; }
|
||||
else if (S("--ngram-table")) {
|
||||
if (!(v = need(i))) return RAD_E_INVAL;
|
||||
if (!std::strcmp(v, "disk")) c->ngram_table_ram = false;
|
||||
else if (!std::strcmp(v, "ram")) c->ngram_table_ram = true;
|
||||
else { RAD_ERR("--ngram-table takes disk or ram, not '%s'", v); return RAD_E_INVAL; }
|
||||
}
|
||||
else if (S("--prefix-cache-host-mib")) { if (!(v = need(i))) return RAD_E_INVAL; c->prefix_cache_host_mib = atoll(v); }
|
||||
else if (S("--prefix-cache-dir")) { if (!(v = need(i))) return RAD_E_INVAL; c->prefix_cache_dir = v; }
|
||||
else if (S("--prefix-cache-disk-mib")) { if (!(v = need(i))) return RAD_E_INVAL; c->prefix_cache_disk_mib = atoll(v); }
|
||||
|
||||
Reference in new issue
Block a user