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

+12 -6
View File
@@ -122,13 +122,19 @@ private:
* (engine_bringup.cpp says how auto chooses). */
int resolve_table_placement(const std::vector<VramFacts>& facts,
const std::vector<int64_t>& emb_bytes, int64_t kv_floor,
int64_t ngram_bytes, bool ngram_device);
/* --ngram-placement ram: the locked copy of the container's [src, src + n), file offset `foff`,
* made once and shared by every rank. */
int lock_table_copy(const uint8_t* src, int64_t n, int64_t foff, void** out, std::string* why);
/* The copies made, each [base, base + bytes), and the container address each one copies.
* Unlocked and unmapped in ~Engine after the ranks that read them are gone. */
int64_t ngram_bytes, bool ngram_device, bool ngram_host);
/* --ngram-placement ram: the copy of the container's [src, src + n), file offset `foff`, made
* once and shared by every rank -- locked for the host gather, or pinned for a device kernel
* to read over the link (`card`). */
int copy_table(const uint8_t* src, int64_t n, int64_t foff, bool card, void** out,
std::string* why);
/* An auto-chosen pinned copy that could not be made: every rank's n-gram gather to the host. */
bool ngram_gather_to_host();
/* The copies made: the locked ones, each [base, base + bytes); the pinned ones, rad_dev_alloc
* RAD_MEM_HOST_MAPPED ranges; and the container address each one copies. Freed in ~Engine
* after the ranks that read them are gone. */
std::vector<TableCopy> table_copies_;
std::vector<void*> card_copies_;
std::vector<std::pair<const void*, void*>> table_copy_of_;
int load_weights();
int configure_kv();