Archived
M2XFP4 (MXFP4v2): quantiser, gfx1201 WMMA kernels, host rows, df2 wiring, .rad packer (Import::ParoM2), stability fixes (counters-in-scratch x3, aql publish fences), kbench rows, runbook (REMAINING.md)
This commit is contained in:
1 parent
9eaf10da6e
commit
ea0908596b
60 files changed
+4619
-193
No files matched your search
@@ -0,0 +1,4 @@
|
||||
# Kernel rows a replay of this fixture reaches (rad-kbench --coverage).
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
gemm_m2xfp4a8_decode
|
||||
@@ -0,0 +1,4 @@
|
||||
# Kernel rows a replay of this fixture reaches (rad-kbench --coverage).
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
gemm_m2xfp4a8_decode
|
||||
@@ -0,0 +1,4 @@
|
||||
# Kernel rows a replay of this fixture reaches (rad-kbench --coverage).
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
gemm_m2xfp4a8_decode
|
||||
@@ -0,0 +1,4 @@
|
||||
# Kernel rows a replay of this fixture reaches (rad-kbench --coverage).
|
||||
# A row listed here and not reached fails the replay; regenerate with
|
||||
# --coverage-write when a row is added or deliberately retired.
|
||||
gemm_m2xfp4a8_decode
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
# q38-27b-m2xfp4-df2.recipe -- Qwen3.8-27B trunk + DFlash2 drafter at M2XFP4.
|
||||
# f32 norm casts: the qwen35_fp8 plugin declares these norms RAD_F32 and the
|
||||
# mapped tier cannot widen bf16 at load.
|
||||
blk.*.attn_norm.weight cast dtype=f32
|
||||
blk.*.attn_q_norm.weight cast dtype=f32
|
||||
blk.*.attn_k_norm.weight cast dtype=f32
|
||||
blk.*.ffn_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_q_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_k_norm.weight cast dtype=f32
|
||||
dflash.blk.*.ffn_norm.weight cast dtype=f32
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
dflash.fc.weight m2xfp4
|
||||
dflash.blk.*.attn_q.weight m2xfp4
|
||||
dflash.blk.*.attn_k.weight m2xfp4
|
||||
dflash.blk.*.attn_v.weight m2xfp4
|
||||
dflash.blk.*.attn_output.weight m2xfp4
|
||||
dflash.blk.*.ffn_gate_up.weight m2xfp4
|
||||
dflash.blk.*.ffn_down.weight m2xfp4
|
||||
blk.*.attn_qg.weight m2xfp4
|
||||
blk.*.attn_q.weight m2xfp4
|
||||
blk.*.attn_k.weight m2xfp4
|
||||
blk.*.attn_v.weight m2xfp4
|
||||
blk.*.attn_output.weight m2xfp4
|
||||
blk.*.ssm_inz.weight m2xfp4
|
||||
blk.*.ssm_out.weight m2xfp4
|
||||
blk.*.ffn_gate_up.weight m2xfp4
|
||||
blk.*.ffn_down.weight m2xfp4
|
||||
v.* cast dtype=bf16
|
||||
@@ -0,0 +1,19 @@
|
||||
# q38-27b-m2xfp4.recipe -- Qwen3.8-27B trunk at M2XFP4, no drafter.
|
||||
# f32 norm casts: the qwen35_fp8 plugin declares these norms RAD_F32 and the
|
||||
# mapped tier cannot widen bf16 at load.
|
||||
blk.*.attn_norm.weight cast dtype=f32
|
||||
blk.*.attn_q_norm.weight cast dtype=f32
|
||||
blk.*.attn_k_norm.weight cast dtype=f32
|
||||
blk.*.ffn_norm.weight cast dtype=f32
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_qg.weight m2xfp4
|
||||
blk.*.attn_q.weight m2xfp4
|
||||
blk.*.attn_k.weight m2xfp4
|
||||
blk.*.attn_v.weight m2xfp4
|
||||
blk.*.attn_output.weight m2xfp4
|
||||
blk.*.ssm_inz.weight m2xfp4
|
||||
blk.*.ssm_out.weight m2xfp4
|
||||
blk.*.ffn_gate_up.weight m2xfp4
|
||||
blk.*.ffn_down.weight m2xfp4
|
||||
v.* cast dtype=bf16
|
||||
@@ -0,0 +1,19 @@
|
||||
# q38-27b-m2xfp4.recipe -- Qwen3.8-27B trunk at M2XFP4, no drafter.
|
||||
# f32 norm casts: the qwen35_fp8 plugin declares these norms RAD_F32 and the
|
||||
# mapped tier cannot widen bf16 at load.
|
||||
blk.*.attn_norm.weight cast dtype=f32
|
||||
blk.*.attn_q_norm.weight cast dtype=f32
|
||||
blk.*.attn_k_norm.weight cast dtype=f32
|
||||
blk.*.ffn_norm.weight cast dtype=f32
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
blk.*.attn_qg.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_q.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_k.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_v.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.attn_output.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_inz.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ssm_out.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_gate_up.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
blk.*.ffn_down.weight rtn codes=fp4_e2m1 group=32 scale=e8m0
|
||||
v.* cast dtype=bf16
|
||||
@@ -0,0 +1,45 @@
|
||||
# q38-27b-paro-m2xfp4-df2.recipe -- a ParoQuant M2XFP4 Qwen3.8-27B (quant_method
|
||||
# paroquant_m2xfp4) with the DFlash2 drafter.
|
||||
#
|
||||
# tools/rad_pack_m2xfp4.py <paroqant result dir> --model <donor> --recipe \
|
||||
# data/recipes/q38-27b-paro-m2xfp4-df2.recipe --draft <DFlash2> -o q38-27b-paro-m2xfp4-df2.rad
|
||||
#
|
||||
# The trunk's linears are imported as they ship, and need no rule: e2m1 codes, an E8M0 exponent a 32
|
||||
# of K and the scheme's metadata byte a group (four 2-bit subgroup multipliers, subgroup s in bits
|
||||
# [2s, 2s+2)), stored in the ROTATED basis ParoQuant trained them in, with the rotations beside
|
||||
# them as the encoding's "givens" transform (abi/rad_encoding.h): per projection the Givens pairs
|
||||
# and angles of krot stages inside groups of 128 columns, and the channel scales. A fused gate|up or
|
||||
# qkv|z keeps one set of tables a checkpoint tensor (parts). rad-convert writes them as planes of
|
||||
# the weight; the GEMM is the plain M2XFP4 one, and the activation is rotated in front of it
|
||||
# (givens_dense_quant) -- nothing is re-quantised, so the weights are the fine-tune's to the bit.
|
||||
#
|
||||
# What the checkpoint does NOT ship in a form the architecture declares gets a rule. `convert`
|
||||
# loads the donor fp16, so everything it does not re-quantise is fp16 where the plugin declares
|
||||
# bf16 or f32: `cast` rounds once. The head is quantised as in every recipe here; the MTP head is
|
||||
# not read, since the DFlash2 drafter displaces it. THE DRAFTER is made as small as its acceptance
|
||||
# allows, as in q38-27b-m2xfp4-df2.recipe.
|
||||
|
||||
blk.*.attn_norm.weight cast dtype=f32
|
||||
blk.*.attn_q_norm.weight cast dtype=f32
|
||||
blk.*.attn_k_norm.weight cast dtype=f32
|
||||
blk.*.ffn_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_q_norm.weight cast dtype=f32
|
||||
dflash.blk.*.attn_k_norm.weight cast dtype=f32
|
||||
dflash.blk.*.ffn_norm.weight cast dtype=f32
|
||||
|
||||
blk.*.ssm_ab.weight cast dtype=bf16
|
||||
blk.*.ssm_conv1d.weight cast dtype=bf16
|
||||
token_embd.weight cast dtype=bf16
|
||||
v.* cast dtype=bf16
|
||||
|
||||
output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
||||
dflash.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16 rule=search
|
||||
|
||||
dflash.fc.weight m2xfp4
|
||||
dflash.blk.*.attn_q.weight m2xfp4
|
||||
dflash.blk.*.attn_k.weight m2xfp4
|
||||
dflash.blk.*.attn_v.weight m2xfp4
|
||||
dflash.blk.*.attn_output.weight m2xfp4
|
||||
dflash.blk.*.ffn_gate_up.weight m2xfp4
|
||||
dflash.blk.*.ffn_down.weight m2xfp4
|
||||
@@ -0,0 +1,26 @@
|
||||
# q38-2b-distill-m2xfp4.recipe -- empero-ai/Qwen3.8-2B-Distill (the bf16 release) with every 2D
|
||||
# trunk linear at M2XFP4, the metadata-augmented MXFP4 of arXiv 2601.19213: an OCP E2M1 code an
|
||||
# element, an E8M0 exponent a group of 32 and one metadata byte a group whose four 2-bit subgroup
|
||||
# extra mantissas refine the exponent to (1 + k/4) . 2^E, the exponent's bias in {-1, 0, 1}
|
||||
# searched with the subgroups by least squared error (4.5 bits an element). The quantiser is
|
||||
# libquant's `m2xfp4`, adaptive=1 by default; adaptive=0 pins the bias at 0.
|
||||
#
|
||||
# rad-convert /home/zee/models/hf/Qwen3.8-2B-Distill \
|
||||
# --recipe data/recipes/q38-2b-distill-m2xfp4.recipe \
|
||||
# -o /home/zee/models/rad/q38-2b-distill-m2xfp4.rad
|
||||
#
|
||||
# Everything the rules do not name stays bf16 as the checkpoint holds it: the norms, the embedding
|
||||
# and lm_head (the 27B containers put the head at block fp8 -- one rule, add it here if wanted),
|
||||
# the delta net's a/b projection (32 rows, kept as the other q38 recipes keep it), the vision
|
||||
# tower and the router. Rank-1 weights a pattern happens to match are declined by the quantiser
|
||||
# and kept as they are. The first rule that matches a weight decides it.
|
||||
|
||||
blk.*.attn_qg.weight m2xfp4
|
||||
blk.*.attn_q.weight m2xfp4
|
||||
blk.*.attn_k.weight m2xfp4
|
||||
blk.*.attn_v.weight m2xfp4
|
||||
blk.*.attn_output.weight m2xfp4
|
||||
blk.*.ssm_inz.weight m2xfp4
|
||||
blk.*.ssm_out.weight m2xfp4
|
||||
blk.*.ffn_gate_up.weight m2xfp4
|
||||
blk.*.ffn_down.weight m2xfp4
|
||||
Reference in new issue
Block a user