libxe2: device rows for gelu, silu, gelu_tanh, scale, mul_weight, clamp, fill, iota, act_mul, gelu_mul

These weightless elementwise ops had no libxe2 row, and an op with no weights cannot be placed on
the host, so a model whose graph declares one refused to start on Intel ("no device kernel for op
'gelu_mul' in any plugin"). libr4d serves them; the architectures that use them include Gemma 3
and 4, the embedding models (nomic-bert, embgemma, nemotron-embed), Qwen3-ASR, LFM2's SigLIP2,
Nemotron-H and the diffusion and audio models.

Each is libref's chain element by element (xe2_elem_act.cpp): erf, tanh and exp in double rounded
once to float; silu (alone or in act_mul) to a bf16 result takes the float exp and libref's chain
again near a rounding tie, as silu_mul and sigmoid do. gelu and gelu_tanh stay in double: 1 +
erf(x) cancels for negative x, so a float erf's error is not bounded by the result's.

rad-kbench: the nemotronh + moe + default fixtures, 339/339 (act_mul 60, mul_weight 10, iota 9,
silu 20); a random-weight 2-layer Gemma3 converted to .rad, every resolved kernel agrees with
libref (gelu_mul 10 cases). That Gemma3 now serves (1.5k tok/s decode on the B65); without these
rows it does not start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
aneinanderandClaude Opus 5.5 committed 2026-11-08 13:15:46 +01:00
1 parent d04a27fad3
commit b0ac7fd42c
3 files changed
+322

No files matched your search

+11
View File
@@ -11,6 +11,17 @@ namespace xe2 {
int add(const RadArgs* a, RadStream s);
int mul(const RadArgs* a, RadStream s);
int sigmoid(const RadArgs* a, RadStream s);
/* xe2_elem_act.cpp */
int gelu(const RadArgs* a, RadStream s);
int silu(const RadArgs* a, RadStream s);
int gelu_tanh(const RadArgs* a, RadStream s);
int scale(const RadArgs* a, RadStream s);
int mul_weight(const RadArgs* a, RadStream s);
int clamp(const RadArgs* a, RadStream s);
int fill(const RadArgs* a, RadStream s);
int iota(const RadArgs* a, RadStream s);
int act_mul(const RadArgs* a, RadStream s);
int gelu_mul(const RadArgs* a, RadStream s);
int scatter_rows(const RadArgs* a, RadStream s);
int layernorm(const RadArgs* a, RadStream s);
int grid_embed(const RadArgs* a, RadStream s);