From f706caececa16ba4efc7f979eb0fc91628812a9c Mon Sep 17 00:00:00 2001 From: eddie168168 Date: Sat, 17 Oct 2026 15:42:07 +0800 Subject: [PATCH] docs: i8a8h in OPS.md's dtype list; had_quant_act_i8g folds nothing Its consumer's scale carries the whole 1/group, as had_quant_act_fp8's does; the per-row had_* int8 forms fold 1/sqrt(group) and are not interchangeable with it. TOOLS.md: libr4d reads the int8 block rows rotated too. Co-Authored-By: Claude Opus 5.5 --- docs/OPS.md | 16 +++++++++++----- docs/TOOLS.md | 10 +++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/OPS.md b/docs/OPS.md index 71719d4a..81c231ab 100644 --- a/docs/OPS.md +++ b/docs/OPS.md @@ -40,11 +40,14 @@ here is such a choice. otherwise; strides are the kernel's business, not the schema's. - Where an op takes `dtype`, it is a string naming the operand combination, so a weight format and an activation format share one key: `bf16`, `f16`/`fp16`, `f32`/`fp32`, `u8`, `fp8_e4m3`, - `fp8a8`, `fp8a16`, `i8a8`, `w4`, `w4a8`, `w4a8_asym`, `w4a8h`, `w8a8`, `w4a16`, `w8a16`, `w2a8`, - `mxfp4a8`, `w5a16`, `w4a16_asym`, `w5a8i8`, `w4a8i8_asym`, and the codebook expert forms - `w4nla8h`, `w4nl64a8h`, `w4nl32a8h`, `w5nl64a8h` (`docs/MOE-W4.md`). + `fp8a8`, `fp8a16`, `i8a8`, `i8a8h`, `w4`, `w4a8`, `w4a8_asym`, `w4a8h`, `w8a8`, `w4a16`, + `w8a16`, `w2a8`, `mxfp4a8`, `w5a16`, `w4a16_asym`, `w5a8i8`, `w4a8i8_asym`, and the codebook + expert forms `w4nla8h`, `w4nl64a8h`, `w4nl32a8h`, `w5nl64a8h` (`docs/MOE-W4.md`). - `w4a8h` is `w4a8` with a `group`-wide Walsh–Hadamard along K baked into the stored weight (`docs/MOE-W4.md`). + - `i8a8` is an i8 weight with a bf16 scale per (row, 128 of K) against an int8 activation on + the same grid; `i8a8h` is that weight rotated by a 128-wide Walsh–Hadamard along K, its scale + carrying the 1/128 (libquant's `transform=fwht128`), met by `had_quant_act_i8g`. - `w4a8_asym` is the unsigned-nibble-minus-zero-point grid instead of the symmetric one. - `fp8a8` and `fp8a16` say whether a block-scaled E4M3 weight meets an fp8 or a bf16 activation. - `w5a16` and `w4a16_asym` are ParoQuant's int5 and z-lab's int4 (u5 / u4 codes, an f16 scale and @@ -470,8 +473,11 @@ not slow. `libref/ref_quant.cpp` is the definition. (`group <= 0` or `group >= n` is one per row). The scale is `amax / 127` (1 for a zero group) and each code the value over it rounded to nearest even and clamped to ±127, row-major. They feed the int8 trunk GEMM (`gemm_nt_q` at `dtype=i8a8`), which folds a scale per K block. The `had_` form - rotates first. `dequant` inverts `quant_act_i8g`: the scale stream's extent gives the group count - and `group` each group's width. + rotates first and, like `had_quant_act_fp8`, folds nothing: its consumer is a weight at + `dtype=i8a8h`, whose scale carries the whole 1/`group`. It is not interchangeable with the + per-row `had_*` int8 forms, which fold 1/sqrt(`group`) into the activation's scale. `dequant` + inverts `quant_act_i8g`: the scale stream's extent gives the group count and `group` each group's + width. The rotation is unnormalised butterflies at ascending strides `1, 2, 4, ... group/2`, pairing `i` with `i + h` where `(i & h) == 0`. The `1/sqrt(group)` is folded into the scale rather than applied diff --git a/docs/TOOLS.md b/docs/TOOLS.md index bba746bf..40bd4843 100644 --- a/docs/TOOLS.md +++ b/docs/TOOLS.md @@ -204,11 +204,11 @@ group=32 scale=u6 scale2=f16 group2=256`; a ternary BitNet weight is `table=tern A container can hold only what some kernel reads. The converter checks every planned encoding against the layout hooks of the kernels declare resolved and refuses one that no kernel accepts, so a grid libquant can write is usable only once a kernel library takes it. libr4d reads the plain -floats; block-scaled fp8 and fp8 rows; int8 block rows (the W8A8 trunk and lm_head); the routed -experts as fp8, int4 (`i4*bf16[1x128]/fwht128`) or the `w4nl`/`w5nl` codebooks under E4M3 scales -([MOE-W4.md](MOE-W4.md)); the dense w4, w8 and mxfp4 GEMM rows; and the 2-bit draft head. Every -encoding also decodes through the core, which the converter's error report, the oracle and the -quantisers' tests use. +floats; block-scaled fp8 and fp8 rows; int8 block rows (the W8A8 trunk and lm_head), plain or +rotated (`i8*bf16[1x128]/fwht128`); the routed experts as fp8, int4 (`i4*bf16[1x128]/fwht128`) or +the `w4nl`/`w5nl` codebooks under E4M3 scales ([MOE-W4.md](MOE-W4.md)); the dense w4, w8 and mxfp4 +GEMM rows; and the 2-bit draft head. Every encoding also decodes through the core, which the +converter's error report, the oracle and the quantisers' tests use. The recipes for the containers this tree serves are in `data/recipes/`. `scripts/convfn.sh` and `scripts/convdspark.sh` are the reference conversions.