Archived
radiance 1.4.0
- Qwen3.8-Flash-Next on one card: the heat engine moves 64 experts a step (was 8), its copies and the prefill's expert staging run on the card's DMA engines instead of as copy kernels, and at decode the next layer's likeliest experts are copied onto the card ahead of its GEMMs. Against 1.3.0 at --tp 1: prefill +17-20% from 8K tokens up, throughput under load +16-20% - deploy/compose/flashnext-tp1.yaml: Qwen3.8-Flash-Next on one card and 64 GB of host RAM (4096-token prefill steps, 4 sequences, a 301K-token cache) - #61: --busy-prefill-chunk (default auto): a long prefill leaves the rest of the step to the requests decoding beside it and to new arrivals, instead of taking all of it (baKon) - LiquidAI's LFM2 and LFM2-VL, and d1's /v1/systemone (after zivius's PR #50) - a startup report: every option with its value and where it came from, the hardware, and what on it costs speed with the fix; /diagnostics serves it (behind the API key; without one, only to the same machine) - #69: a GPU memory fault names the buffer and kernel argument behind it and ends the server at once (exit status 70), instead of hanging or writing a core of tens of gigabytes - #64: a card without Resizable BAR is refused at startup, naming what to turn on, instead of crashing at the first launch - the image is built with ROCm 10.1 (the host's amdgpu driver must support it), with ROCm's libLLVM rebuilt so the same source compiles to the same kernels every time; a source build takes ROCm 10.1 or 7.2 - #71: the image ships curl, jq and a CA bundle, so --model <HF repo id> works in the container, and hfget.sh runs under its busybox (baKon) - --profile-ops shows how long each op's lane sat idle before it; cardclock.py skips an integrated GPU instead of stopping
This commit is contained in:
1 parent
d5b65cddc6
commit
dc339b4cd2
153 files changed
+12956
-1067
No files matched your search
+22
-1
@@ -95,7 +95,8 @@ typedef int (*RadInitFn) (const RadParam* p, int n_p, int rank, int world_
|
||||
typedef void (*RadFiniFn) (void* instance);
|
||||
|
||||
/* The launch. Must not allocate and must not synchronise. Returns RAD_OK or negative; a negative
|
||||
* return aborts the step and fails the requests in it, naming the kernel and the geometry. */
|
||||
* return aborts the step and fails the requests in it, naming the kernel and the geometry. A launch
|
||||
* handed `link_gate` may return RAD_LINK_ENDED instead of RAD_OK (rad_kernel_collective). */
|
||||
typedef int (*RadLaunchFn) (const RadArgs* a, RadStream stream);
|
||||
|
||||
/* ================================================================== the described launch */
|
||||
@@ -597,6 +598,26 @@ typedef void (*RadPluginCloseFn)(void);
|
||||
* before it, which is always correct. The symbol name is `rad_kernel_concurrent`. */
|
||||
typedef int (*RadKernelConcurrentFn)(int i);
|
||||
|
||||
/* Optional, and a promise about kernel `i` of rad_kernel_at: nonzero means it is a COLLECTIVE --
|
||||
* its launches exchange data with the other ranks' cards, so the interconnect carries their bytes
|
||||
* for as long as they run and the step waits on it. The engine then keeps its own bulk traffic on
|
||||
* the same links (weights it streams onto the card while the card computes) out of their way for
|
||||
* that time. A plugin that does not export the symbol, or answers 0, has only the conventional
|
||||
* `all_reduce` op treated as one. The symbol name is `rad_kernel_collective`.
|
||||
*
|
||||
* 2 promises more: every launch of the kernel ends that time itself, as soon as the last byte the
|
||||
* other ranks send this card for it has landed -- a kernel that reduces after the exchange has the
|
||||
* link to spare for the rest of its run. The engine then hands each launch it holds the link for
|
||||
* the parameter `link_gate`, the address of a 64-bit word in memory the kernel reaches at system
|
||||
* scope; a launch without it holds nothing and has nothing to end. The kernel reads the word on
|
||||
* the device as it starts -- not the host in the launch call, where the hold has not taken effect
|
||||
* yet -- and, once those bytes have landed, takes one off it with a system-scope atomic if it was
|
||||
* odd; an even word it leaves alone. A launch that did so returns RAD_LINK_ENDED; any other
|
||||
* success is RAD_OK, and the engine then ends the hold behind the launch, so a path that does not
|
||||
* know the word is always safe. */
|
||||
typedef int (*RadKernelCollectiveFn)(int i);
|
||||
#define RAD_LINK_ENDED 1
|
||||
|
||||
/* Optional: nonzero declares this kernel library a REFERENCE implementation -- written to be
|
||||
* plainly correct rather than fast. Three things follow, for any library that says so and for no
|
||||
* other, whatever it is called:
|
||||
|
||||
+6
-1
@@ -152,9 +152,14 @@ typedef struct RadVocabHeader {
|
||||
int32_t bos, eos, eot, pad_id, unk, sep;
|
||||
uint32_t add_bos, add_eos;
|
||||
rad_stroff chat_template;
|
||||
uint64_t reserved[4];
|
||||
uint64_t flags; /* RAD_VOCAB_*; zero in a file written before the field existed */
|
||||
uint64_t reserved[3];
|
||||
} RadVocabHeader;
|
||||
|
||||
/* BPE: a pre-token that is already a vocabulary entry is emitted whole instead of merged
|
||||
* (tokenizers' `ignore_merges`). LFM2's vocabulary sets it. */
|
||||
enum { RAD_VOCAB_IGNORE_MERGES = 1u << 0 };
|
||||
|
||||
enum { RAD_TT_NORMAL = 1, RAD_TT_UNKNOWN = 2, RAD_TT_CONTROL = 3,
|
||||
RAD_TT_USER_DEFINED = 4, RAD_TT_BYTE = 6 };
|
||||
|
||||
|
||||
@@ -376,6 +376,42 @@ int rad_route_report(RadCtx* c, int layer, const RadRouting* r);
|
||||
* `n_expert` -- the router then writes its own buffer and reports that. */
|
||||
int32_t* rad_route_counts(RadCtx* c, int layer, int64_t n_expert);
|
||||
|
||||
/* THE NEXT-LAYER EXPERT PREFETCH, at decode. A routed layer names the next routed layer at its router
|
||||
* input; the core applies that layer's router to this layer's input rows, takes the experts the next
|
||||
* layer is likeliest to route that sit in the pinned host pool, and copies them onto the card while
|
||||
* the rest of this layer runs. Just before the next layer's routed GEMMs it points their weight-table
|
||||
* entries at the copies, where the copies have landed and the entries still name the pool slots they
|
||||
* were made from. It changes no result: a copy holds the bytes of its slot. It is on where the
|
||||
* placement keeps experts in a pinned pool and the device backend can spare a DMA engine for it, and
|
||||
* a pass of more than 16 rows makes no prediction; the three calls are no-ops otherwise.
|
||||
*
|
||||
* `parts` names, for each of the next layer's experts, the weights its unit is made of (at most four,
|
||||
* e.g. the gate-up matrix and its scales and the down matrix and its scales), as the routed GEMMs
|
||||
* read them through weight tables; 0 where an expert has fewer or none. An expert is prefetched only
|
||||
* where each of its weights is in exactly one table and all of them sit in one pool slot. The arrays
|
||||
* must outlive the context; the core reads the routing counts only to rank and count, never to choose
|
||||
* an expert's bytes. `layer` is the next layer's index as rad_route_report and
|
||||
* rad_expert_prefetch_step name it; `router` is its router, [n_expert, n_embd] bf16. */
|
||||
typedef struct RadPrefetchNext {
|
||||
int layer;
|
||||
rad_weight router;
|
||||
int64_t n_expert, top_k;
|
||||
int64_t n_parts;
|
||||
const rad_weight* parts; /* [n_expert * n_parts] */
|
||||
const int32_t* count_at; /* [n_expert]: where the expert's count is in the layer's routing
|
||||
counts (rad_route_counts), -1 for nowhere; null when at its index */
|
||||
} RadPrefetchNext;
|
||||
|
||||
/* At this layer's router input: `h` rows [r0, r0 + rows) of n_embd bf16, read in place on another
|
||||
* stream -- the block must not overwrite them before this layer's routed GEMMs. */
|
||||
int rad_expert_prefetch(RadCtx* c, const RadPrefetchNext* next, rad_buf h, int64_t r0, int64_t rows,
|
||||
int64_t n_embd);
|
||||
/* After this layer's routed down GEMM: the copies cross the link from here, under the next layer's
|
||||
* attention rather than under this layer's own streamed experts. */
|
||||
int rad_expert_prefetch_mark(RadCtx* c);
|
||||
/* Ahead of `layer`'s routed GEMMs, on every routed layer of every pass. */
|
||||
int rad_expert_prefetch_step(RadCtx* c, int layer);
|
||||
|
||||
/* A weight's pointer, for the rare op that genuinely needs one (a plugin-private kernel invoked
|
||||
* outside the op vocabulary). Waits on the mover. Using this forfeits nothing except the ability
|
||||
* to move that weight while the pointer is live, so it is legal only within one issue. */
|
||||
|
||||
Reference in new issue
Block a user