Archived
libxe2: every op Qwen3.8-27B-PARO-M2XFP4 needs, correctness first -- the 27B serves on the B65
Kernels, each libref's arithmetic in libref's order: - gemm_nt_q at m2xfp4 (xe2_gemm_m2.cpp) with libref's m2 layout hooks, and givens_dense_quant (xe2_givens.cpp, the rotation in double as libref's) - the gated delta net (xe2_gdn.cpp): gdn_conv_prep, gdn_conv_update, gdn_kkt_solve, gdn_chunk_scan, gdn_recurrent_update (per-candidate and anchor state forms), gdn_gated_rmsnorm, gdn_conv_recurrent_update; each work-item one iteration of libref's parallel loop, the per-(sequence, head) workspaces in a shared device workspace (xe2_common: workspace()) - rope's multi-component modes (mrope, imrope, axial) and rope_table - logits_gemm over an fp8 128x128 joined head, gemm_nt_bias with its epilogue - mul, sigmoid, scatter_rows, layernorm, grid_embed, attn_dense (the vision tower) - dflash_conv and logit_rerank (plain and joined head) for the DFlash2 drafter libref's gemm_m2 gains the parts (pb1/pb2) every other ParoQuant grid and libr4d's mx_parts already define -- weight rows [0, e1), [e1, e2), [e2, N) read activation copies 0, 1, 2 side by side -- since this model's fused projections are rotated per piece and the oracle declined them; its shape hook widens a and a_scale by the part count. Both m2 arms now take the stored codes-then-meta blob as the engine describes it, u8 [N, K], beside the shape hook's rank-1 form (libref refused the engine's launch; only libr4d had been run on it). rad-kbench on the fixture: every new row at rel_l2 0 (90 gdn/givens cases, 108 rope, 80 elementwise, 20 attn_dense, the drafter's and the heads'). On the B65 the model starts with every op on the card and answers "The capital of France is" -> " Paris.\nThe capital of Germany is Berlin.\nThe capital of Italy is" (greedy), at 0.1 tok/s: the correctness-first kernels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018EpFgqQidSnH8zo7boVZC1
This commit is contained in:
1 parent
f98b4070cd
commit
4921641578
15 files changed
+2251
-78
No files matched your search
+10
-2
@@ -1186,8 +1186,16 @@ int gemm_q_shape(const RadParam* p, int n_p, int operand, bool bias, RadOpdDesc*
|
||||
* reads back as the two planes' bytes concatenated (encoding.cpp) -- the codes rows, then
|
||||
* the meta rows -- which ref_gemm.cpp's own arm decodes against `b_scale`. */
|
||||
const int64_t akb = (mx || m2) ? (K + 127) / 128 : kb;
|
||||
o.t((uint32_t)((mx || m2) ? RAD_F8E4M3 : RAD_I8), { M, K }); /* a */
|
||||
o.t_fill((uint32_t)RAD_F32, { M, akb }, (uint32_t)RAD_FILL_SIGMOID, 0); /* a_scale */
|
||||
/* m2xfp4 parts (pb1/pb2, gemm_m2): one activation copy a part, side by side. */
|
||||
int64_t parts = 1;
|
||||
if (m2) {
|
||||
const int64_t pb1 = gi(p, n_p, "pb1", 0), pb2 = gi(p, n_p, "pb2", 0);
|
||||
const int64_t e1 = pb1 > 0 ? std::min<int64_t>(pb1, N) : N;
|
||||
const int64_t e2 = pb2 > 0 ? std::max<int64_t>(e1, std::min<int64_t>(pb2, N)) : N;
|
||||
parts = e2 < N ? 3 : (e1 < N ? 2 : 1);
|
||||
}
|
||||
o.t((uint32_t)((mx || m2) ? RAD_F8E4M3 : RAD_I8), { M, parts * K }); /* a */
|
||||
o.t_fill((uint32_t)RAD_F32, { M, parts * akb }, (uint32_t)RAD_FILL_SIGMOID, 0); /* a_scale */
|
||||
if (m2)
|
||||
o.t((uint32_t)RAD_U8, { N * (K / 2 + K / 32) }); /* b -- codes then meta bytes */
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user