radiance 1.0.11

- The n-gram embedding table (Qwen3.8-Flash-Next's per-layer embedding) can be gathered on the
  card. libr4d gains a row for embed_lookup_q whose output is the host gather's to the bit, and
  --ngram-placement uses it: ram keeps a pinned copy in RAM that the cards read in place over the
  link, so a step has no host work in it; vram puts the whole table on every card that holds it;
  disk reads it from the container on the host, as before. auto takes the first of the three that
  holds the table and prints why it passed over the others. Without a device kernel for the gather,
  ram is the locked copy the host gather reads and vram is refused, as in 1.0.10.
- The pinned copy is not charged to RLIMIT_MEMLOCK; the host gather's locked copy still is, so
  --ulimit memlock=-1 matters only on a run without the cards.
- The idea and a first kernel for the device gather came from Code000.
This commit is contained in:
Deadcode committed 2026-10-05 16:34:37 +02:00
1 parent e466fa07e2
commit 469441d90f
24 files changed
+848 -247

No files matched your search

+16 -7
View File
@@ -249,9 +249,12 @@ public:
* `embedding_host_used` is the same tables' weight bytes, the unit the tier totals count in. */
int64_t embedding_host_bytes = 0;
int64_t embedding_host_used = 0;
/* --ngram-placement ram: the n-gram tables the load phase copies into locked memory. They stay
* on the mapped tier as far as every pool is concerned; this is what the copy costs in RAM. */
/* --ngram-placement ram: the n-gram tables the load phase copies into host memory. They stay
* on the mapped tier as far as every pool is concerned; this is what the copy costs in RAM.
* `ngram_copy_card` says which copy: pinned memory a device kernel reads in place over the
* link, or locked memory the host gather reads. */
int64_t ngram_copy_bytes = 0;
bool ngram_copy_card = false;
/* ROUTED EXPERTS ON THE FILE TIER have no address of their own: a routed layer's are read into
* one of two VRAM buffers before the layer's first expert op and published there until the next
* routed layer starts (place/stager.h, FileStager). `file_layer_max` is the most one layer's
@@ -377,17 +380,23 @@ struct WeightFootprint {
int64_t mapped = 0; /* no device kernel can read them; they never enter a pool at all */
int64_t hosted = 0; /* --embedding-placement ram: in the pinned host pool, off the card */
/* The tables the two placement flags move, wherever the buckets above count them: `embedding`
* is inside statics or hosted, `ngram` inside mapped. */
* is inside statics or hosted, `ngram` inside statics when a device kernel reads it and it is
* placed in VRAM, inside mapped otherwise. */
int64_t embedding = 0;
int64_t ngram = 0;
/* An n-gram table some device kernel reads, which the strategies place like any weight. No
* plugin has one today; it is what makes --ngram-placement vram mean something. */
/* A device kernel reads the n-gram table, so it can be on the card or read over the link from
* pinned host memory; without one only the host gather reads it, from RAM or the container. */
bool ngram_device = false;
/* A host kernel gathers it, so it can stay in the container (--ngram-placement disk). */
bool ngram_host = false;
int64_t n_units = 0;
};
/* `embedding` is what the token embedding's placement resolved to; only Ram moves it out of the
* statics. Stated by every caller, so the budget and the planner cannot count it differently. */
void weight_footprint(const Program& prog, WeightFootprint* out, TablePlacement embedding);
* statics. `ngram` is the n-gram table's; only Vram puts it among them, and only where a device
* kernel reads it. Stated by every caller, so the budget and the planner cannot count it
* differently. */
void weight_footprint(const Program& prog, WeightFootprint* out, TablePlacement embedding,
TablePlacement ngram);
/* THE TABLES THE PLACEMENT FLAGS MOVE, by what reads them and not by name: a model-level weight
* that at least one op reads and that only `embed_lookup` reads is a token embedding table, and