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
View File
@@ -264,6 +264,7 @@ TEST(op_vocabulary) {
"scale_rows",
"softmax",
"quant_act_i8", "quant_act_i8g", "quant_act_fp8", "quant_cols_fp8", "had_quant_act_fp8", "givens_dense_quant", "givens_rotate", "had_quant_act_i8",
"had_quant_act_i8g",
"gram_accum",
/* The fused fp8 forms. A host run needs every op covered, so these keep a host-backend run
* from failing with "site 'host' is unavailable for this band". */
@@ -6435,6 +6436,17 @@ TEST(had_quant_act_fp8_rotates_before_the_absmax) {
CHECK_EQ(q.at(2), 0.0f); CHECK_EQ(q.at(3), 448.0f);
}
/* had_quant_act_i8g is the same at int8 codes: amax / 127, nothing folded either. */
TEST(had_quant_act_i8g_rotates_before_the_absmax) {
T x(RAD_F32, {1, 4}); x.f({1, 1, 1, -1});
T q(RAD_I8, {1, 4}), s(RAD_F32, {1, 2});
A a; a.t(x).t(q).t(s).i("M", 1).i("n", 4).i("group", 2).s("dtype", "f32");
CHECK_OK(run("had_quant_act_i8g", a));
CHECK_EQ(s.at(0), 2.0f / 127.0f); CHECK_EQ(s.at(1), 2.0f / 127.0f);
CHECK_EQ(q.at(0), 127.0f); CHECK_EQ(q.at(1), 0.0f);
CHECK_EQ(q.at(2), 0.0f); CHECK_EQ(q.at(3), 127.0f);
}
namespace {
void put_pair(T& t, int64_t i, int32_t id, float v) {
std::memcpy((float*)t.t.data + 2 * i, &id, 4);
@@ -6898,6 +6910,7 @@ std::vector<Geo> geometries() {
G("quant_act_fp8", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "f32")),
G("quant_cols_fp8", "M", 3, a.i("M", R).i("n", 32).s("dtype", "f32")),
G("had_quant_act_fp8", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "f32")),
G("had_quant_act_i8g", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "f32")),
G("had_quant_act_i8", "M", 3, a.i("M", R).i("n", 32).i("group", 16).s("dtype", "f32")),
G("rmsnorm_had_quant_i8", "M", 3, a.i("M", R).i("n", 32).d("eps", 1e-6).i("group", 16)
.s("dtype", "f32")),