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:
keptn42 authored and StillDeadcode committed 2026-10-05 12:52:50 +02:00
1 parent 4252353bc2
commit e6c8a3d7fa
18 files changed
+363 -56

No files matched your search

+8
View File
@@ -614,6 +614,14 @@ struct Config {
* is a server that is correct and several orders of magnitude slow. The tier needs no directory
* of its own; the container is the file. */
bool weights_disk_tier = false;
/* --ngram-table disk|ram: where the host gather of a table too large for any card -- the n-gram
* embedding, 47.7 GiB in Qwen3.8-Flash-Next -- reads its rows. disk, the default, reads them
* from the container through a row cache and holds no more of the table than that. ram copies
* the table once into locked host memory, in the background from the first request, and reads
* the copy: a faster prefill and a few percent of throughput, for the table's size in RAM. A
* process that cannot lock that much says so and stays on disk. A deployment choice and not a
* tuning one, because only the operator knows what else the host's memory is for. */
bool ngram_table_ram = false;
std::string placement = "auto"; /* all_vram | layer_offload | expert_tiered | auto */
/* MODEL-LEVEL WEIGHTS KEPT IN THE PINNED HOST POOL by name, comma-separated (a trailing '*'