libref, libavx: GLM-5.3's ops -- mHC, clamped SwiGLU, f32 routing, KDA, the DSA indexer, MLA

The reference and CPU forms of the ops GLM-5.3-Flash's graph needs, with their schemas and shape
hooks: mhc_pre / mhc_post / mhc_contract and the column-split pair mhc_pre_partial /
mhc_pre_finish; swiglu_clamped; gemm_nt_f32 (bf16 activation, f32 weight and result) for the
router logits and the indexer's head gates; router_sigmoid_topk (correction-bias top-k);
kda_update with per-channel decay and both state forms; dsa_pool, dsa_query and dsa_score; and
mla_attn and mla_project for absorbed latent attention. moe_gather takes f32 expert weights beside
bf16, and fp8a8f32 joins the dtype list. docs/OPS.md states each op.

ref_test checks every op against hand-computed cases, avx_check_hand the CPU forms against
libref, build_test the indexer cache's page size.

Co-Authored-By: Nunze <lorenz.lamping1@web.de>
This commit is contained in:
John McDonoughandNunze authored and StillDeadcode committed 2026-10-19 20:13:47 +02:00
1 parent c8311068d0
commit da77f86332
21 files changed
+3217 -19

No files matched your search

+2 -1
View File
@@ -492,7 +492,8 @@ static int moe_gemm_impl(const RadArgs* a, bool quant, int ncls = 2) {
if (ts && cb_joined(wse[(size_t)e])) return RAD_E_DTYPE;
}
mw[(size_t)e] = as_mat(&we[(size_t)e], k);
SW[(size_t)e] = make_scales(quant && ts ? &wse[(size_t)e] : nullptr, n, k, false);
SW[(size_t)e] = make_scales(quant && ts ? &wse[(size_t)e] : nullptr, n, k,
we[(size_t)e].dtype == RAD_FP4E2M1);
}
const int64_t fy = N / parts;