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
@@ -91,6 +91,11 @@ Every one of these options is needed:
|
||||
- **`--network host`**: the server binds the host's addresses directly, IPv4 and IPv6, with no
|
||||
NAT in front of it.
|
||||
|
||||
And one more for `--ngram-table ram`: **`--ulimit memlock=-1`**. The copy of the n-gram table is
|
||||
locked in RAM, and Docker's default memlock limit is far below its 47.7 GiB; without it the server
|
||||
says so at the first request and reads the table from the container as it does by default.
|
||||
`deploy/compose/common.yaml` sets it.
|
||||
|
||||
The image sets `GPU_MAX_ALLOC_PERCENT=100` and `GPU_MAX_HEAP_SIZE=100`. The HIP runtime's defaults
|
||||
cap one allocation, and the heap, below what the placement plan hands out.
|
||||
|
||||
|
||||
@@ -866,6 +866,7 @@ one line naming each one the command line moved.
|
||||
| `--host-pool-mib N` | 0 | pinned host tier (weights) |
|
||||
| `--host-weights NAMES` | none | embedding tables kept in the pinned host pool and read in place over the link (comma-separated, a trailing `*` matches a prefix); charged to `--host-pool-mib`, and only a weight embedding lookups alone read is accepted. See §4.3 |
|
||||
| `--weights-disk-tier` | off | read weights that fit neither VRAM nor the host pool from the container (O_DIRECT); routed experts a layer at a time |
|
||||
| `--ngram-table MODE` | disk | where the n-gram embedding's host gather reads its rows: `disk` from the container through a row cache, `ram` from a copy of the whole table in locked host memory (Qwen3.8-Flash-Next: 47.7 GiB), made in the background from the first request. `ram` needs the memory and a memlock limit that large (`--ulimit memlock=-1` in Docker); short of either it says so and stays on `disk` |
|
||||
|
||||
**Idle session tiers**
|
||||
|
||||
|
||||
+7
-1
@@ -783,7 +783,7 @@ either wire, byte-identical to the three kernels it stands in for.
|
||||
| op | params | operands |
|
||||
|---|---|---|
|
||||
| `embed_lookup` | `M`(range) `n_embd` `n_vocab` `dtype` `vocab_offset`/opt `wscale`:f64/opt | `tokens`, `wte`w → `x` |
|
||||
| `embed_lookup_q` | `M`(range) `n_embd` `n_vocab` `dtype` `vocab_offset`/opt `wscale`:f64/opt | `tokens`, `wte`w, `scale`w? → `x`, `ahead`? |
|
||||
| `embed_lookup_q` | `M`(range) `n_embd` `n_vocab` `dtype` `vocab_offset`/opt `wscale`:f64/opt `resident`/opt | `tokens`, `wte`w, `scale`w? → `x`, `ahead`? |
|
||||
| `logits_gemm` | `M`(range) `n_vocab` `n_embd` `dtype` | `x`, `lm_head`w → `logits` |
|
||||
| `ngram_ids` | `M`(range) `heads` `ngram` `eos` | `tok`, `state`:inout, `cu`, `mult`w, `vocab_sizes`w, `offsets`w, `cache_idx`?, `has_init`?, `num_accepted`? → `ids`, `ahead_ids`? |
|
||||
| `ple_gate` | `M`(range) `n` `hc` `eps`:f64 `dtype` `wadd`:f64/opt `gate_eps`:f64/opt | `k`, `q`, `v`, `w_key`w, `w_query`w, `w_conv`w → `gv`, `gvn` |
|
||||
@@ -891,6 +891,12 @@ the alignment the filesystem reports for direct I/O, or its block size where it
|
||||
btrfs does; one read of the table proves it before the first row is served. A filesystem with no
|
||||
direct I/O at all cannot hold a container with this table.
|
||||
|
||||
**`resident` keeps the table in RAM instead**, for a deployment that has the memory: libavx copies
|
||||
it once into locked huge pages, in the background from the first gather that carries it, and reads
|
||||
the copy from then on; until the copy is in place, and wherever the process cannot lock that much,
|
||||
the rows come from the file as above. The result is the same either way. An architecture sets it
|
||||
from `RadBuildCtx::ngram_table_ram` (`--ngram-table ram`).
|
||||
|
||||
The placement planner runs an op on the host when **every weight operand of it** is `Site::Host`,
|
||||
which is why the table must be a weight operand at all: `gather_rows` takes a plain `IN` operand and
|
||||
would never trigger it. And the host kernel has to live in a production plugin — libavx, the host
|
||||
|
||||
Reference in new issue
Block a user