libr4d: the dense integer rows take the group they compute -- a Q8_0 weight at group 32 was read as 128

The dense integer kernels compile their group in and read no `group` argument, and neither the
rows nor the layout hooks checked it: w8_enc_layout accepted an `i8*f16[1x32]` weight (a Q8_0
block) at group 32 and the kernel computed it at 128. The twelve dense gemm_nt_q rows now carry
C_EQ("group", ...), and the four hooks (w4, w5, w8, w2a8) answer RAD_E_DTYPE at any other group,
the one code select() counts as a refusal. relayout_parity_test pins the hooks, plugin_test the
rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NunzeandClaude Opus 5.5 authored and StillDeadcode committed 2026-10-28 12:49:18 +01:00
1 parent 385318f81a
commit d73abc28d5
4 files changed
+97 -12

No files matched your search

+22
View File
@@ -1126,6 +1126,28 @@ TEST(libr4d_resolves_every_band_of_glm_mla_split_by_rows) {
}
}
/* The dense integer gemm_nt_q kernels compile their group in, so their rows take no other: at
* group 64 each dtype is a miss, at 128 it resolves. At M = 1 every skinny, tiled and prefill row
* of these dtypes is a candidate. */
TEST(libr4d_resolves_a_dense_integer_gemm_only_at_its_group) {
const std::string so = libr4d();
if (so.empty()) return;
Registry r;
CHECK(r.load_plugin(so, 0) >= 0);
for (const char* dtype : { "w4a16", "w5a16", "w4a16_asym", "w4a8i8_asym", "w5a8i8", "w2a8",
"w8a16", "w4a8", "w4a8_asym", "w8a8" }) {
Geometry g;
g.set_i("M", 1);
g.set_i("N", 256);
g.set_i("K", 256);
g.set_s("dtype", dtype);
g.set_i("group", 64);
CHECK_EQ(picked(r.select("gemm_nt_q", g, RAD_DOMAIN_DEVICE)), "<none>");
g.set_i("group", 128);
CHECK(r.select("gemm_nt_q", g, RAD_DOMAIN_DEVICE) != nullptr);
}
}
/* ================================================================== constraints that are not intervals */
namespace {
std::string extra_dir() { return home() + "/testkernels/extra"; }