Archived
libxe2, arch/common: the 28 Oct pending set, the bf16 cast fused, the vectorized norm, a draft-vocab prefix
- gdn_kkt_solve on DPAS (~0.4 ms at 2048 tokens against 7.7), the int8 head's DPAS forms at 9-16 rows (verify past depth 7), the plain block norm (RadBuildCtx::plain_norm, set on the SYCL backend: `add` + `rmsnorm` where no reader takes the E4M3 codes) with the fast rmsnorm rows. - rmsnorm's bf16 rows up to 8192 wide: a work-item eight elements by one 16-byte load (the generic form walked 20 dependent loads a work-item): 24.7 -> 3.3 us a decode norm, ~3.5 ms a round. - w4a16: a bf16 activation narrowed to fp16 at the kernel's own load (the separate cast launch before every GEMM is gone), bit for bit the same. - RADIANCE_MTP_DRAFT_VOCAB=N: the 2-bit draft head over the vocabulary's first N ids (a prefix shortlist, GRIMOIRE's idea); the u2 layout hook takes an op N below the weight's rows. 131072: greedy acceptance identical on the decode proxy, draft head 650 -> 351 us a pass. KL against the exact-kernel reference (2002 positions): 0.002386, top-1 97.30% (was 0.002376 / 96.80%). Decode proxy (greedy, depth 5, mtp4): 72.0 -> 74.3 tok/s with the prefix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7580ec3d17
commit
726e532114
18 files changed
+472
-54
No files matched your search
@@ -705,6 +705,9 @@ struct Geom {
|
||||
/* RAD_ATTN_FP8_* bits: the attention products accepted in e4m3 (RadBuildCtx describes it).
|
||||
* decl_attn passes it on as `attn_paged`'s `prefill_fp8`. */
|
||||
int attn_prefill_fp8 = 0;
|
||||
/* RadBuildCtx::plain_norm: a block norm none of whose readers takes codes may run as `add` +
|
||||
* `rmsnorm` (rad_fp8.h, NormQuantFP8::x_only). */
|
||||
int plain_norm = 0;
|
||||
float eps = 1e-6f;
|
||||
/* GemmaRMSNorm's `1 +`. Qwen3.5, Qwen3-Next and Gemma normalise with `x_hat * (1 + w)` and
|
||||
* store `w` near 0.1, so reading it as a plain gain shrinks every normed activation 5-10x. An
|
||||
@@ -977,6 +980,7 @@ inline int geom_from(Geom& g, const RadModelMeta* m, const RadBuildCtx* c,
|
||||
g.wire_exact= c->tp_wire_lossy ? 0 : 1;
|
||||
g.wire_min_bytes = c->tp_wire_min_bytes;
|
||||
g.attn_prefill_fp8 = c->attn_prefill_fp8;
|
||||
g.plain_norm = c->plain_norm;
|
||||
g.eps = m->rms_eps;
|
||||
g.theta = m->rope_theta;
|
||||
g.rope_scale= 1.0f; /* yarn_from reads the model's rotary scaling */
|
||||
@@ -1447,6 +1451,22 @@ inline const RadKVGroupBatch* kv_batch(const RadBatch* b, rad_kvgroup group) {
|
||||
}
|
||||
|
||||
/* ================================================================== calibration in slices */
|
||||
|
||||
/* The draft head's rows: the vocabulary's first RADIANCE_MTP_DRAFT_VOCAB ids (a prefix shortlist,
|
||||
* rounded down to whole 16-row tiles) or all of it. Byte-level BPE vocabularies number their
|
||||
* merges by frequency, so a prefix keeps the likely drafts and the head reads that much less of
|
||||
* its weight a draft round; a draft outside it is never proposed, which costs acceptance only --
|
||||
* the verify still runs the full head. */
|
||||
inline int64_t mtp_draft_rows(int64_t n_vocab_all) {
|
||||
static const long long want = [] {
|
||||
const char* s = std::getenv("RADIANCE_MTP_DRAFT_VOCAB");
|
||||
return s ? std::atoll(s) : 0LL;
|
||||
}();
|
||||
if (want <= 0 || want >= n_vocab_all) return n_vocab_all;
|
||||
const int64_t r = (int64_t)want / 16 * 16;
|
||||
return r > 0 ? r : n_vocab_all;
|
||||
}
|
||||
|
||||
/* The layers [lo, hi) of n a calibration taps: the environment variable `var` as "lo:hi", else
|
||||
* all of them. A large model's Grams do not fit beside its weights at once, so it is calibrated
|
||||
* in slices of layers, the corpus pushed through once a slice. */
|
||||
|
||||
Reference in new issue
Block a user