libref, libavx: had_quant_act_i8g, the activation of the i8a8h GEMMs

had_quant_act_fp8 at int8 codes (top 127), one body shared by both in each library, so a
rotated int8 trunk runs on the host kernels too. gemm_nt_q needs no change: both libraries pick
the int8 product from the operands' dtypes, and i8a8h's rotation is in the values. libref's
operand description takes i8a8h, and rad-avx-check gains cases for the op and the dtype.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
eddie168168andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-19 10:42:13 +02:00
1 parent 037427e67e
commit 61afe50b96
10 files changed
+84 -11

No files matched your search

+13 -3
View File
@@ -537,8 +537,10 @@ AVX_KERNEL(gated_quant_fp8) {
* is scaled by.
*
* Unlike had_quant_act_i8, 1/sqrt(g) is not applied here. <Hw, Ha> = g <w, a>, and the whole g is
* divided out of the weight scale instead, where dividing a bf16 by a power of two is exact. */
AVX_KERNEL(had_quant_act_fp8) {
* divided out of the weight scale instead, where dividing a bf16 by a power of two is exact.
*
* had_quant_act_i8g is the same at int8 codes (`top` 127), for the i8a8h weight. */
static int had_quant_q8(const RadArgs* a, float top) {
if (!rad_args_have(a, 3)) return RAD_E_INVAL;
const RadTensor *x = &a->t[0], *q = &a->t[1], *s = &a->t[2];
const int64_t n = p_int(a, "n", 0);
@@ -561,7 +563,7 @@ AVX_KERNEL(had_quant_act_fp8) {
fwht_row(buf, n, g);
for (int64_t gi = 0; gi < ngrp; ++gi) {
float sc;
fp8_group(buf, out, gi * g, gi * g + g, &sc);
fp8_group(buf, out, gi * g, gi * g + g, &sc, top);
stt(s, rowoff(s, r, ngrp) + gi * laststride(s), sc);
}
out_row(q, rowoff(q, r, n), n, out);
@@ -569,6 +571,14 @@ AVX_KERNEL(had_quant_act_fp8) {
return RAD_OK;
}
AVX_KERNEL(had_quant_act_fp8) {
return had_quant_q8(a, 448.0f);
}
AVX_KERNEL(had_quant_act_i8g) {
return had_quant_q8(a, 127.0f);
}
/* ------------------------------------------------------------- givens_rotate */
/* ParoQuant's activation side for a 16-bit GEMM: each row is divided by its channel scales and
* rotated by `stages` rounds of disjoint Givens pairs, once per part, parts side by side in y.