spark: key BF16 and IQ8R prefill tape geometry

This commit is contained in:
Constantin committed 2026-11-03 13:53:46 -05:00
1 parent 416c231a18
commit f692c3f446
2 files changed
+51 -5

No files matched your search

+18 -5
View File
@@ -386,17 +386,30 @@ TEST(spark_prefill_keys_match_live_r4d_split_grid) {
CHECK_EQ(spark25_prefill_key::pass_key(r), (uint64_t)0);
MetaKV meta = spark_meta();
RadBuilder b;
RadBuildCtx ctx = build_ctx();
REQUIRE_EQ(spark25_bf16::declare(&b, meta.meta(), &ctx), RAD_OK);
RadBuilder bf16_builder;
REQUIRE_EQ(spark25_bf16::declare(&bf16_builder, meta.meta(), &ctx), RAD_OK);
RadKVGroupBatch kv{}; kv.group = spark25_bf16::models[0].kv;
RadBatch batch{}; batch.phase = RAD_PHASE_PREFILL; batch.n_tok = batch.max_q_len = 256;
batch.n_seq = batch.n_kv_groups = 1; batch.kv = &kv;
int32_t used[1] = {1536}; RadCtx c{};
const uint64_t plugin_k4 = spark25_bf16::pass_key(&c, &batch, used);
REQUIRE(plugin_k4 != 0);
const uint64_t bf16_k4 = spark25_bf16::pass_key(&c, &batch, used);
REQUIRE(bf16_k4 != 0);
used[0] = 2048;
CHECK(spark25_bf16::pass_key(&c, &batch, used) != plugin_k4);
CHECK(spark25_bf16::pass_key(&c, &batch, used) != bf16_k4);
MetaKV iqmeta = spark_meta();
iqmeta.m.quant = "w8a8_fwht128";
iqmeta.set("quantization_config.quant_method", "w8a8")
.set("quantization_config.fmt", "fwht128");
RadBuilder iq_builder; spark_iq8r_encodings(iq_builder);
REQUIRE_EQ(spark25_w8a8::declare(&iq_builder, iqmeta.meta(), &ctx), RAD_OK);
kv.group = spark25_w8a8::models[0].kv;
used[0] = 1536;
const uint64_t iq_k4 = spark25_w8a8::pass_key(&c, &batch, used);
REQUIRE(iq_k4 != 0);
used[0] = 2048;
CHECK(spark25_w8a8::pass_key(&c, &batch, used) != iq_k4);
#else
CHECK_EQ(spark25_prefill_key::pass_key({}), (uint64_t)0);
#endif