Archived
libxe2: fused attention prologue (qkv_norm_rope, qkv_norm_rope_kv_store)
The one-launch prologue that Gemma 3, Gemma 4, Hunyuan v3 and the DFlash2 drafter use where a kernel library declares it (libr4d did; libxe2 did not, so those models ran the unfused five or six launches a layer). docs/OPS.md requires it byte-identical to the unfused ops, so each step is libxe2's own: xe2_rmsnorm's bf16 head-row norm (its partition and reduce_over_group; XE2_EXACT=1 libref's ascending sum, as xe2_rmsnorm then takes), the bf16 rounding the norm stores, xe2_rope's arithmetic on its frequency table, xe2_kv_store's conversion. A sub-group a (token, head), the head staged in local memory for the rotary pairs. The schemas are libr4d's. XE2_NO_FUSED_PROLOGUE=1 leaves the two rows undeclared, so an architecture takes its unfused chain: the A/B, and an escape hatch. Gemma 4 E2B: greedy outputs identical with and without (4 requests), decode 58.0 -> 58.6 tok/s. A random Gemma 3 (v_norm 0): identical, 1570 -> 1600 tok/s. Default fixture 2144/2144. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25c8fbd136
commit
0c7606423b
3 files changed
+366
-5
No files matched your search
@@ -28,6 +28,8 @@ int logit_softcap(const RadArgs* a, RadStream s);
|
||||
int rel_sinusoid(const RadArgs* a, RadStream s);
|
||||
int pool_rows(const RadArgs* a, RadStream s);
|
||||
int qk_norm_rope(const RadArgs* a, RadStream s);
|
||||
int qkv_norm_rope(const RadArgs* a, RadStream s);
|
||||
int qkv_norm_rope_kv_store(const RadArgs* a, RadStream s);
|
||||
int conv1d_dw(const RadArgs* a, RadStream s);
|
||||
int conv2d(const RadArgs* a, RadStream s);
|
||||
int attn_local_rel(const RadArgs* a, RadStream s);
|
||||
|
||||
Reference in new issue
Block a user