radiance 1.0.12

- Wrong answers under concurrency on models with gated delta net layers (Qwen3.8-Flash-Next,
  Qwen3.8-27B, Qwen3.6-35B-A3B). A conv state slot was one entry wider in the allocation than in
  the state the kernels index, so clearing the slot a newly admitted request was given -- and a
  prefix-cache checkpoint's save and restore -- reached into the next request's conv and n-gram
  windows. A request decoding beside an admission then lost part of its recent context: a right
  first token followed by a context-free continuation ("1. **Identify the numbers..." for "What
  is 65 times 3?"), repeated or skipped digits. A single request was never affected. One
  definition of the slot now, and the server refuses to start if the allocation and the kernels
  ever disagree on it. Present since 1.0.0; reported with a strict concurrent sanity check.
- --num-speculative-tokens 0 no longer stops the engine at the first multi-sequence decode step:
  an all-reduce argument struct's padding was uninitialised, and a recorded pass's audit read it
  as a changed argument.
This commit is contained in:
Deadcode committed 2026-10-05 18:27:23 +02:00
1 parent 469441d90f
commit a4845834ea
10 files changed
+106 -31

No files matched your search

+9 -8
View File
@@ -773,15 +773,16 @@ TEST(linear_state_is_sized_per_sequence) {
CHECK_EQ(b.program().kv_groups[gl].bytes_per_state, 32LL * 128 * 128 * 4);
CHECK_EQ(b.program().kv_groups[gl].bytes_per_block, 0);
/* A rolling window of conv_width-1 + n_spec + 1 entries, so a speculative rejection is a
* change of read offset rather than a recompute (spec §10).
/* A rolling window of conv_width-1 + n_spec entries, so a speculative rejection is a change of
* read offset rather than a recompute (spec §10).
*
* THE +1 IS THE VERIFY STEP'S OWN OUTPUT. A verify writes 1 + n_spec conv outputs before
* anyone knows which survive, so peak occupancy is the retained history PLUS all of them --
* which is the modulus BatchBuilder::init and Scheduler::conv_window cycle the cursor by. A
* state sized without it is overrun by one entry every verify. rad_builder.cpp's own note on
* `entries` is the argument. */
CHECK_EQ(b.program().kv_groups[gc].bytes_per_state, 32LL * 128 * (4 - 1 + 4 + 1) * 4);
* EXACTLY THE STATE TENSOR'S EXTENT. The kernels lay a slot out from the tensor's last extent,
* conv_width-1 + n_spec, and the KV manager clears, checkpoints and restores the slot this
* figure describes; one entry more here put each of those over the start of the next
* sequence's window. rad_builder.cpp's note on `entries` is the argument. */
CHECK_EQ(b.program().kv_groups[gc].bytes_per_state, 32LL * 128 * (4 - 1 + 4) * 4);
CHECK_EQ(b.program().kv_groups[gc].bytes_per_state,
32LL * 128 * conv_window_entries(cd, 4) * 4);
}
/* ================================================================== names, notes, the C surface */
+42
View File
@@ -731,6 +731,48 @@ TEST(kv_conv_slot_is_a_rolling_window) {
CHECK_EQ(kv.free_states(G_CONV), s0);
}
/* THE SLOT THE MANAGER HANDS OUT IS THE SLOT THE KERNELS INDEX. The kernels take a conv slot's
* layout from the state tensor's last extent, conv_width-1 + n_spec; the manager clears a slot
* when it hands it out and saves and restores it at a checkpoint in the layout bytes_per_state
* describes. A builder figure one entry wider a slot -- what the allocation once carried --
* made handing slot s to a new sequence zero the start of slot s+1's window, the window of a
* sequence still decoding. The manager refuses the disagreement rather than serve with it. */
TEST(kv_refuses_a_state_slot_the_kernels_would_not_index) {
auto group = [](int kind, int64_t bytes_per_state) {
KVGroupInfo k;
k.name = "state";
k.decl.kind = kind;
k.decl.dtype = RAD_BF16;
k.decl.n_head_kv = 2;
k.decl.head_dim = 8;
k.decl.state_dim[0] = 4;
k.decl.state_dim[1] = 8;
k.decl.conv_width = 4;
k.layers = { 0, 1 };
k.bytes_per_state = bytes_per_state;
return k;
};
auto configure = [](const KVGroupInfo& k) -> int {
std::vector<KVGroupInfo> g;
g.push_back(null_group());
g.push_back(k);
Config cfg = small_config();
cfg.n_spec = 3;
cfg.checkpoint_slots = 0;
Pools p;
if (p.configure(cfg, 0, &rad_malloc_allocator(), &rad_malloc_allocator()) < 0)
return RAD_E_NOMEM;
KVManager kv;
return kv.configure(g, cfg, p.kv());
};
/* Conv: (4-1) + 3 = 6 entries of 2 x 8 bf16 channels, over two layers. */
CHECK_OK(configure(group(RAD_KV_CONV, 6LL * 2 * 8 * 2 * 2)));
CHECK_EQ(configure(group(RAD_KV_CONV, 7LL * 2 * 8 * 2 * 2)), RAD_E_SHAPE);
/* Linear: 2 heads of 4 x 8 bf16, over two layers. */
CHECK_OK(configure(group(RAD_KV_LINEAR, 2LL * 4 * 8 * 2 * 2)));
CHECK_EQ(configure(group(RAD_KV_LINEAR, 2LL * 4 * 8 * 2 * 2 + 64)), RAD_E_SHAPE);
}
TEST(kv_adopts_the_blocks_a_cache_hit_found) {
Fixture f;
CHECK_OK(f.build(/*with_linear=*/false));