fp8: the trunk-rotation question lives beside its predicates

"The trunk is rotated int8 (linear_is_w8h or linear_is_wnh), its
activation codes one scale a trunk_g8 columns: 256 for IQ8R, 128 for
the other rotated forms" was written twice, verbatim, in flint's and
bailing_hybrid's field declarations, and the probe that answers it --
weight_enc, the two predicates, linear_w8h_group -- was re-typed at
both arches' layer-0 sites. museglimmer_ct carries the near-variant;
its question is narrower (exactly-IQ8R, not rotated-at-all), so it
keeps its own predicate.

rad_fp8.h now answers it once: trunk_rotation(enc, &g8), beside the
predicates it is made of, so the group-width semantics travel with the
forms that define them instead of with three copies of a comment. The
two call sites shrink to the probe and the named question.

Standards axis of the 2.1.0 review pass, finding 4.
This commit is contained in:
fl0l0u committed 2026-11-15 22:02:30 +00:00
1 parent 8ac613ddb9
commit a8d82678fa
3 files changed
+20 -12

No files matched your search

+11
View File
@@ -1081,6 +1081,17 @@ inline bool linear_is_wnh(const RadEncoding& e) {
zp->block[1] == RAD_FP8_BLOCK;
}
/* Whether a trunk whose first linear probed as `e` is rotated int8 -- w8h or wnh -- and if so
* how wide its activation codes' scale group is: 256 for IQ8R, 128 for the other rotated forms
* (linear_w8h_group spells the rule). An arch learns this by probing layer 0's q projection
* before declaring activations; the probe and the fields are the arch's, the question belongs
* beside the predicates it is made of. */
inline bool trunk_rotation(const RadEncoding& e, int64_t* g8) {
if (!linear_is_w8h(e) && !linear_is_wnh(e)) return false;
*g8 = linear_w8h_group(e);
return true;
}
/* The OCP-MXFP4 weight LinearFP8 serves at mxfp4a8: e2m1 codes and an E8M0 exponent per [1 x 32],
* no transform (libr4d's MXFP4 layout hook). */
enum { RAD_MX_GROUP = 32 };