ParoQuant: check the givens pairs at load; one re-tile slab for every part; one bounds helper; one mxfp4 GEMM declaration

* libr4d: givens_quant_act_fp8 gets layout/relayout/unrelayout hooks for `pairs` -- stored as is,
  refused (RAD_E_FORMAT) when a stage is not a pairing of its own group of 128, which the kernel would
  index out of bounds. relayout_parity_test covers it.
* gemm_mxfp4a8_tiled: the parts run in order on one stream, so they share one re-tiled activation;
  the scratch is one slab again.
* mx_part_bounds: the pb1/pb2 clamping in one place (mx_parts, the decode scratch hook).
* LinearFP8: one gemm_nt_q declaration and one issue path for the plain and the rotated MXFP4 weight;
  pb1/pb2 still only on a weight with parts, so a one-part op keeps its tune-cache geometry.
This commit is contained in:
Malic Zilyas committed 2026-10-08 23:35:43 +02:00
1 parent 5681da471c
commit 9af15f3a6e
9 files changed
+169 -63

No files matched your search

+5 -3
View File
@@ -5161,11 +5161,13 @@ static const RadKernelInfo kKernels[] = {
"n a multiple of 128 -- a rotation group cannot straddle the end of a row -- and group 128, "
"which is both the rotation group and the weight scale's activation block",
"bf16 in, E4M3 out in PLAIN ROW-MAJOR order, parts side by side, with an f32 scale per (row, part, "
"128 columns); the tables are the weight's int32 pairs, f32 angles and f32 channel scales",
"128 columns); the tables are the weight's int32 pairs (checked at load to pair each group's own "
"columns), f32 angles and f32 channel scales",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
ROW(cHadQuantActFp8), NOTUNE,
nullptr, nullptr, r4d_rad_givens_quant_act_fp8, nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr, r4d_rad_givens_quant_act_fp8_describe },
nullptr, nullptr, r4d_rad_givens_quant_act_fp8, nullptr, r4d_rad_layout_givens_pairs,
r4d_rad_relayout_givens_pairs, nullptr, r4d_rad_unrelayout_givens_pairs, nullptr,
r4d_rad_givens_quant_act_fp8_describe },
{ "quant_act_i8g", "quant_act_i8g", "quant",
"per-(row, 128-column) symmetric int8 quantisation of a bf16 activation",