Archived
radiance 1.11.0
New models: - GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget), with decode kernels for a few rows and the DSA indexer split over the ranks - Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter - Unlimited-OCR (bf16) - Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces are fused with the junctions, overlapped with the compute and sent compressed - Ornith-1.5-35B-A3B w4a8 compose files Speed: - Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued ahead - The four-rank all-reduce is faster for every --tp 4 model - qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly - --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20% prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default Features: - Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch, and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE) - Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance - Cards with a small PCI BAR run, with kernel arguments kept in host memory - Dashboard: live acceptance figures; statsdump rotates its file at a size cap - KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot Fixes: - Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore makes room as memory pressure does and waits a step for the previous turn's release (two conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now) - Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory management is turned off there, with a warning - Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output - The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start - GLM-5.3: every refusal names the setting and the reason; its template keeps string content - Several pictures in one request no longer refuse processors that take one image at a time Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
This commit is contained in:
commit
9eaf10da6e
210 files changed
+14363
-2138
No files matched your search
@@ -147,6 +147,83 @@ int ref_moe_scatter(const RadArgs* a, RadStream) {
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ router_topk_scatter */
|
||||
/* The pair as one op, and the reference is the pair: the fused device kernel must be
|
||||
* byte-identical to these two launches, in order, over the operands the fused op carries. The
|
||||
* selection runs over the whole router's `n_expert` logits; the sort runs over this rank's slice,
|
||||
* the fused op's `n_local` standing where `moe_scatter`'s `n_expert` names the slice it owns. */
|
||||
int ref_router_topk_scatter(const RadArgs* a, RadStream s) {
|
||||
if (!have(a, 6)) return RAD_E_INVAL;
|
||||
const int64_t ne = p_int(a, "n_expert", 0);
|
||||
const int64_t nl = p_int(a, "n_local", ne);
|
||||
const int64_t k = p_int(a, "top_k", 1);
|
||||
if (ne <= 0 || k <= 0 || k > ne || nl <= 0 || nl > ne) return RAD_E_SHAPE;
|
||||
|
||||
const RadParam rp[] = { RAD_INT("n_expert", ne), RAD_INT("top_k", k),
|
||||
RAD_INT("norm", p_int(a, "norm", 0)),
|
||||
RAD_STR("dtype", p_str(a, "dtype", "bf16")) };
|
||||
const RadArgs ra{ a->t, 3, rp, 4, nullptr, 0, nullptr, a->rank, a->world_size };
|
||||
const int rc = ref_router_topk(&ra, s);
|
||||
if (rc != RAD_OK) return rc;
|
||||
|
||||
/* The fused op's operands with `expert_w` removed -- the sort's input is the selection's
|
||||
* output, named once, and `moe_scatter` takes it in operand slot 0. RadArgs reads a
|
||||
* contiguous tensor array, so the four descriptors are laid out here, by value. */
|
||||
const RadTensor t2[] = { a->t[1], a->t[3], a->t[4], a->t[5] };
|
||||
const RadParam sp[] = { RAD_INT("n_expert", nl), RAD_INT("top_k", k),
|
||||
RAD_INT("expert_base", p_int(a, "expert_base", 0)),
|
||||
RAD_STR("protect", p_str(a, "protect", nullptr)) };
|
||||
const RadArgs sa{ t2, 4, sp, 4, nullptr, 0, nullptr, a->rank, a->world_size };
|
||||
return ref_moe_scatter(&sa, s);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ router_gemm_topk_scatter */
|
||||
/* The router GEMM in front of the pair, and with `gate_b`/`gate` present the shared expert's
|
||||
* one-column gate over the same input. The reference is the launches it stands in for, and the
|
||||
* fused kernel must be byte-identical to them: the router's `gemm_nt`, the gate's `gemm_nt` at
|
||||
* N = 1, then `router_topk_scatter` over the logits. `gate_b` and `gate` come together or not at
|
||||
* all, and the operand count says which. */
|
||||
int ref_router_gemm_topk_scatter(const RadArgs* a, RadStream s) {
|
||||
/* NOT `have`: the required operands are not a prefix -- `gate_b` sits between the router's
|
||||
* weight and the outputs, and it and `gate` are null slots in the gate-absent form. The nine
|
||||
* required slots are checked by name; the pair is checked to come together or not at all. */
|
||||
if (!a || !a->t || a->n_t < 9) return RAD_E_INVAL;
|
||||
const bool gate_b = a->n_t > 2 && a->t[2].data != nullptr;
|
||||
const bool gate = a->n_t > 9 && a->t[9].data != nullptr;
|
||||
if (gate_b != gate) return RAD_E_INVAL;
|
||||
for (int i : {0, 1, 3, 4, 5, 6, 7, 8})
|
||||
if (!a->t[i].data) return RAD_E_INVAL;
|
||||
const int64_t ne = p_int(a, "n_expert", 0);
|
||||
const int64_t nl = p_int(a, "n_local", ne);
|
||||
const int64_t k = p_int(a, "top_k", 1);
|
||||
const int64_t K = p_int(a, "K", 0);
|
||||
if (ne <= 0 || k <= 0 || k > ne || nl <= 0 || nl > ne || K <= 0) return RAD_E_SHAPE;
|
||||
const char* dt = p_str(a, "dtype", "bf16");
|
||||
|
||||
/* The router: a [M, K] x b [n_expert, K]^T -> logits. gemm_nt takes a, b, y contiguously. */
|
||||
const RadTensor g3[] = { a->t[0], a->t[1], a->t[3] };
|
||||
const RadParam gp[] = { RAD_INT("N", ne), RAD_INT("K", K), RAD_STR("dtype", dt) };
|
||||
const RadArgs ga{ g3, 3, gp, 3, nullptr, 0, nullptr, a->rank, a->world_size };
|
||||
const int gc = ref_gemm_nt(&ga, s);
|
||||
if (gc != RAD_OK) return gc;
|
||||
|
||||
/* The shared expert's gate: the same arithmetic at N = 1, beside the router, over the same
|
||||
* `a`. The pair was checked to come together. */
|
||||
if (gate) {
|
||||
const RadTensor p3[] = { a->t[0], a->t[2], a->t[9] };
|
||||
const RadParam pp[] = { RAD_INT("N", 1), RAD_INT("K", K), RAD_STR("dtype", dt) };
|
||||
const RadArgs pa{ p3, 3, pp, 3, nullptr, 0, nullptr, a->rank, a->world_size };
|
||||
const int pc = ref_gemm_nt(&pa, s);
|
||||
if (pc != RAD_OK) return pc;
|
||||
}
|
||||
|
||||
/* The pair over the logits the GEMM just wrote. Every parameter the pair reads is a parameter
|
||||
* of this op, under the same name -- the fused lists are unions, so `a`'s list passes through. */
|
||||
const RadTensor t6[] = { a->t[3], a->t[4], a->t[5], a->t[6], a->t[7], a->t[8] };
|
||||
const RadArgs fa{ t6, 6, a->p, a->n_p, nullptr, 0, nullptr, a->rank, a->world_size };
|
||||
return ref_router_topk_scatter(&fa, s);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ moe_gemm, moe_gemm_q */
|
||||
/* y[i, :] = a[row(i), :] @ w[e]^T, e the expert whose offset range contains i. `a_order` picks
|
||||
* row(i): `sorted_tok[i] / top_k` for one activation row per token, i itself for one per
|
||||
|
||||
Reference in new issue
Block a user