Archived
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:
1 parent
037427e67e
commit
61afe50b96
10 files changed
+84
-11
No files matched your search
+14
-3
@@ -360,8 +360,11 @@ int ref_quant_cols_fp8(const RadArgs* a, RadStream) {
|
||||
* ~0.2% error per group (a fifth of the int4 grid's own error).
|
||||
*
|
||||
* The output is not interchangeable with quant_act_fp8's: only a weight plane stored as w4a8h
|
||||
* carries the matching rotation and /g. */
|
||||
int ref_had_quant_act_fp8(const RadArgs* a, RadStream) {
|
||||
* carries the matching rotation and /g.
|
||||
*
|
||||
* had_quant_act_i8g is the same at int8 codes (`top` 127), for the i8a8h weight, whose scale
|
||||
* carries the /g the same way. */
|
||||
static int had_quant_act_q8(const RadArgs* a, float top) {
|
||||
if (!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);
|
||||
@@ -383,7 +386,7 @@ int ref_had_quant_act_fp8(const RadArgs* a, RadStream) {
|
||||
const int64_t k0 = gi * g;
|
||||
for (int64_t i = 0; i < g; ++i) buf[i] = ldt(x, xb + (k0 + i) * xs);
|
||||
fwht(buf, g);
|
||||
const float sc = q8_group([&](int64_t i) { return buf[i]; }, g, 448.0f, q,
|
||||
const float sc = q8_group([&](int64_t i) { return buf[i]; }, g, top, q,
|
||||
qb + k0 * qs, qs);
|
||||
stt(s, rowoff(s, r, ngrp) + gi * laststride(s), sc);
|
||||
}
|
||||
@@ -391,6 +394,14 @@ int ref_had_quant_act_fp8(const RadArgs* a, RadStream) {
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
int ref_had_quant_act_fp8(const RadArgs* a, RadStream) {
|
||||
return had_quant_act_q8(a, 448.0f);
|
||||
}
|
||||
|
||||
int ref_had_quant_act_i8g(const RadArgs* a, RadStream) {
|
||||
return had_quant_act_q8(a, 127.0f);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- givens_rotate */
|
||||
/* ParoQuant's activation side: each row divided by its channel factors and rotated by `stages`
|
||||
* rounds of disjoint Givens pairs, written in y's dtype. A weight stored as v = w . D . G_1 ... G_S
|
||||
|
||||
Reference in new issue
Block a user