Archived
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:
1 parent
e466fa07e2
commit
469441d90f
24 files changed
+848
-247
No files matched your search
+12
-10
@@ -19,16 +19,18 @@ embedding's gather, every step — needs this plugin.
|
||||
|
||||
## The embedding gather
|
||||
|
||||
`embed_lookup_q` over an E4M3 table into bf16 is the one host op a GPU deployment runs: the
|
||||
n-gram table is tens of gigabytes in the container's mapping and never on a card. Its rows come
|
||||
through `avx_ngram.cpp`, compiled baseline so the process has one of each: a row cache shared by
|
||||
every thread (2^19 rows, eight ways, CLOCK), an O_DIRECT read through io_uring for each miss, the
|
||||
ranks dividing a call's misses rather than duplicating them, and a reader thread that fetches the
|
||||
next prefill chunk's rows while the current one runs. The level's kernel decodes the rows: at
|
||||
AVX-512 the call's 256-entry bf16 table sits in eight registers and four `vpermt2w` look up 32
|
||||
codes; below it, one code at a time. The row's layout hook only checks the table's encoding —
|
||||
E4M3 with one bf16 scale, or the checkpoint's plain bf16 — and asks for no re-layout, because the
|
||||
gather reads the rows from the container file in the layout they are stored in.
|
||||
`embed_lookup_q` over an E4M3 table into bf16 is the one host op a GPU deployment runs, wherever
|
||||
`--ngram-placement` leaves the n-gram table for the host gather: in the container's mapping
|
||||
(`disk`), or in a locked copy in RAM when no device kernel for the op is loaded (`ram`). Where
|
||||
libr4d is loaded, `ram` is a pinned copy its kernel reads over the link and this one does not run.
|
||||
Its rows come through `avx_ngram.cpp`, compiled baseline so the process has one of each: a row
|
||||
cache shared by every thread (2^19 rows, eight ways, CLOCK), an O_DIRECT read through io_uring for
|
||||
each miss, the ranks dividing a call's misses rather than duplicating them, and a reader thread
|
||||
that fetches the next prefill chunk's rows while the current one runs. The level's kernel decodes
|
||||
the rows: at AVX-512 the call's 256-entry bf16 table sits in eight registers and four `vpermt2w`
|
||||
look up 32 codes; below it, one code at a time. The row's layout hook only checks the table's
|
||||
encoding — E4M3 with one bf16 scale, or the checkpoint's plain bf16 — and asks for no re-layout,
|
||||
because the gather reads the rows from the container file in the layout they are stored in.
|
||||
|
||||
`rad-avx-check` runs the op over a file-backed table with two ranks and the reader racing, at
|
||||
every level, and compares every row with the file's bytes.
|
||||
|
||||
Reference in new issue
Block a user