core/format, arch/common, libr4d: the ParoQuant M2XFP4 import -- Import::ParoM2 reads a paroquant_m2xfp4 checkpoint's planes and rotations, served as rotated MXFP4 is

A paroquant_m2xfp4 checkpoint (format m2xfp4, groups of 32, subgroups of 8, rotation groups of
128) is imported as ParoQuant's MXFP4 is: the codes, exponents and weight_meta bytes become the
m2xfp4 scheme's three planes byte for byte, joined row by row, with the learned rotations beside
them as the givens tables. LinearFP8 declares the rotated form like the rotated MXFP4 one, through
givens_dense_quant into its own E4M3 pair, and libr4d's layout hook and both m2xfp4 rows accept
it, the rows running a fused projection's parts (pb1/pb2) one launch a part as the mxfp4a8 rows
do. libref accepts the rotated planes and runs the parts as its mxfp4a8 arm does; libavx serves
no M2XFP4. checkpoint_test covers the import, quant_m2xfp_test libref's parts and r4d_selftest
libr4d's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugypufyandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-26 15:22:39 +01:00
1 parent b6ad757bfa
commit 2c645333a1
11 files changed
+469 -102

No files matched your search

+5 -4
View File
@@ -635,7 +635,8 @@ so the activation takes the same rotation once a token.
of `a' = a cos t + b sin t, b' = b cos t - a sin t`. Each pair lies inside one scale group, so the
matrices belong to the weight: rad-convert composes them once in f64 and stores them as the
weight's `t.dense` table, which the layout hook (`r4d_rad_layout_gdense`) only moves. Consumers
are `gemm_nt_q` at `mxfp4a8` (`out` fp8) and at `w4a8i8_asym` / `w5a8i8` (`out` i8).
are `gemm_nt_q` at `mxfp4a8` and `m2xfp4` (`out` fp8) and at `w4a8i8_asym` / `w5a8i8` (`out`
i8).
- **`givens_rotate`** is the same rotation stage by stage with no quantiser, `y` in its own dtype
(f16), for the 16-bit-activation weights `w5a16` and `w4a16_asym`, whose GEMM serves any `M`
(rows past 64 run as chunks of 64).
@@ -645,9 +646,9 @@ A fused projection (gate|up, qkv|z) was rotated per checkpoint tensor, so the ac
`pairs` and `angle` stack each part's `stages` rows and `rscale` has one row per part. `gemm_nt_q`'s
`pb1` and `pb2` are the row bounds of the weight's parts: rows `[0, pb1)`, `[pb1, pb2)` and
`[pb2, N)` meet copies 0, 1 and 2 of the wide `a`/`a_scale`. `pb1` absent is one part; `pb2` absent
ends the second part at `N`. The `mxfp4a8` rows and the asymmetric 4- and 5-bit rows read them;
host rows that do not (libavx) refuse a call that names one rather than contract against the wrong
copy.
ends the second part at `N`. The `mxfp4a8` and `m2xfp4` rows and the asymmetric 4- and 5-bit rows
read them; host rows that do not (libavx) refuse a call that names one rather than contract against
the wrong copy.
### Int8 and gated fp8 fusions (device-only)