Archived
arch/common: M2XFP4 linears in the qwen35_fp8 trunk -- LinearFP8 reads an m2xfp4 weight as the MXFP4 views with the meta plane riding the weight operand
LinearFP8 recognises a plain m2xfp4 encoding (codes, E8M0 exponent and one meta byte per group of 32, no transform) and declares gemm_nt_q at dtype m2xfp4 over the producer's E4M3 pair: the weight view selects codes and meta together, the exponent plane is b_scale and b_ref as for MXFP4, and the row-part, shape and column-shard rules are the MXFP4 ones. Like the other non-block-fp8 forms it refuses a stored view. step() issues it in a block of its own with the MXFP4 GEMM's operands, and MlpFP8 keeps it off the fp8a8 gated fold, so an M2XFP4 gate_up takes the GEMM and gated quantiser pair. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
dab34da373
commit
1c6acaf84b
2 files changed
+81
-2
No files matched your search
@@ -123,9 +123,10 @@ inline int MlpFP8::declare(RadBuilder* b, Names& nm, const Geom& geom, int l, co
|
||||
* plain MXFP4 one at one to eight rows. bf16, f32-scaled, rotated MXFP4, rotated 5-bit, 4-bit
|
||||
* and int8 gate_up weights take the pair, and so does a clamped (swiglu_limit) product, which
|
||||
* neither fold computes. Declared over int8 codes, only a host kernel would take it, and that
|
||||
* would pin the layer's weights to the host. */
|
||||
* would pin the layer's weights to the host. An M2XFP4 gate_up takes the pair too. */
|
||||
const bool fold_ok = swiglu_limit <= 0 && !gate_up.f32_scale;
|
||||
if (fold_ok && !gate_up.bf16 && !gate_up.mx && !gate_up.paro5 && !gate_up.w4 && !gate_up.i8)
|
||||
if (fold_ok && !gate_up.bf16 && !gate_up.mx && !gate_up.m2x && !gate_up.paro5 && !gate_up.w4 &&
|
||||
!gate_up.i8)
|
||||
op_gated = decl_gated_fold(b, g.max_tok, gate_up.N, gate_up.K, gate_up.w, gate_up.ws,
|
||||
{ w.h.q, w.h.s },
|
||||
gq_ffn.want_x
|
||||
|
||||
Reference in new issue
Block a user