prefill: fail closed when live split geometry is unknown

Head-256 split-prefill launchers now declare that their grid depends on
live KV. Without an architecture geometry key, those passes stay live
instead of replaying a stale tape. Qwen keys only a proven one-sequence
prefill. Plugin ABI 34.
This commit is contained in:
Constantin authored and StillDeadcode committed 2026-11-03 19:05:30 +01:00
1 parent ded64c0bd3
commit aa14eea76c
10 files changed
+148 -30

No files matched your search

+39 -1
View File
@@ -2178,12 +2178,14 @@ int k_copy(const RadArgs* a, RadStream s) {
}
/* A host row for every band of `op`, from a library that is not the reference. */
void attach_host_row(Fixture& f, rad_op op, RadLaunchFn fn, const char* name) {
void attach_host_row(Fixture& f, rad_op op, RadLaunchFn fn, const char* name,
uint64_t capabilities = 0) {
for (rad::Band& band : f.P.ops[op].bands) {
f.infos.push_back(RadKernelInfo{});
RadKernelInfo& ki = f.infos.back();
ki.name = name; ki.op = "rope"; ki.family = "test"; ki.domain = RAD_DOMAIN_HOST;
ki.launch = fn;
ki.capabilities = capabilities;
f.rows.push_back(rad::KernelRow{});
rad::KernelRow& kr = f.rows.back();
kr.info = &ki;
@@ -2341,6 +2343,42 @@ static uint64_t test_prefill_geometry_key(RadCtx* c, const RadBatch* b, const in
return rad_prefill_grid_key((int)b->max_q_len, bq, splits, kv_heads, (int)b->n_seq, threads);
}
TEST(legacy_prefill_keying_only_fails_closed_for_dynamic_split_rows) {
{
Fixture f;
f.add_buffer("x", RAD_BF16, 64, 4, 0);
rad_op op = loose_op(f);
attach_host_row(f, op, k_host_read, "unaffected_prefill");
CHECK_OK(f.start());
RadBatch b{};
b.phase = RAD_PHASE_PREFILL;
b.n_tok = 128; b.n_seq = 1; b.max_q_len = 128;
CHECK(f.ctx.pass_key(&b) != 0); // Unaffected legacy prefill retains reuse.
}
{
Fixture f;
f.add_buffer("x", RAD_BF16, 64, 4, 0);
rad_op op = loose_op(f);
attach_host_row(f, op, k_host_read, "live_split_prefill",
RAD_KERNEL_CAP_DYNAMIC_PREFILL_SPLIT);
CHECK_OK(f.start());
RadBatch b{};
b.phase = RAD_PHASE_PREFILL;
b.n_tok = 128; b.n_seq = 1; b.max_q_len = 128;
CHECK_EQ(f.ctx.pass_key(&b), (uint64_t)0);
b.phase = RAD_PHASE_MIXED;
CHECK_EQ(f.ctx.pass_key(&b), (uint64_t)0);
b.phase = RAD_PHASE_DECODE; b.n_spec = 1;
CHECK_EQ(f.ctx.pass_key(&b), (uint64_t)0);
b.n_spec = 0; b.draft_pass = -1;
CHECK_EQ(f.ctx.pass_key(&b), (uint64_t)0);
b.draft_pass = 0;
CHECK(f.ctx.pass_key(&b) != 0); // Ordinary decode remains recordable.
}
}
TEST(the_prefill_geometry_key_reuses_equal_grids_and_separates_changed_grids) {
Fixture f;
f.add_buffer("x", RAD_BF16, 64, 4, 0);