Archived
abi: RadBatch::lora_slot, each row's runtime LoRA adapter; RAD_ABI_VERSION 18
The per-row adapter slot moves from the core's `lora_slot` derivation into the step batch, beside the other per-row arrays: [n_tok] i32 device, the row's slot in the adapter pools, < 0 or >= S a base row, null when the engine serves no adapters. The batch builder fills it from Request::lora_slot where it fills token_ids and positions, in the slab every rank's batch already points into -- one address per rank for the engine's life, uploaded in stream order ahead of the step's kernels -- so a recorded pass replays it the way it replays token_ids. Ctx::pass_key reads the pointer; the adapter ops are issued whatever the slots hold, so nothing a pass launches depends on their values. Off: the slab carves nothing for it (a zero-length carve), no buffer is declared, and every other slab offset and the arena are what they were. The derivation, its program buffer and Program::lora_slot_buf are gone. abi_layout_table regenerated at 18 (RadBatch grows to 320 bytes, the fields after seq_ids move by 8); sched_test holds the per-row fill, and that the slot array is the only thing adapters add to the slab.
This commit is contained in:
1 parent
09ff76701c
commit
582cda0a53
15 files changed
+141
-84
No files matched your search
@@ -1121,6 +1121,52 @@ TEST(derived_metadata_is_computed_once_per_step_into_the_arena) {
|
||||
CHECK_EQ(ci[0], cslot * 4 + (p.e[0].conv_cursor % 4));
|
||||
}
|
||||
|
||||
/* RadBatch::lora_slot: every row of a sequence carries its request's runtime LoRA slot, -1 for a
|
||||
* base request, in the step's row order (decode rows first). */
|
||||
TEST(the_step_batch_carries_each_rows_adapter_slot) {
|
||||
Fixture f;
|
||||
f.build();
|
||||
f.cfg.lora.max_loras = 2;
|
||||
CHECK_OK(f.start());
|
||||
|
||||
auto r = f.request(100, 64);
|
||||
r->lora_slot = 1;
|
||||
r->lora_uid = 7;
|
||||
CHECK(f.add(std::move(r)) != 0);
|
||||
const RadBatch* b = f.sch.step();
|
||||
CHECK(b != nullptr);
|
||||
CHECK(b->lora_slot != nullptr);
|
||||
CHECK_EQ(b->n_tok, (int64_t)100);
|
||||
for (int64_t i = 0; i < b->n_tok; ++i) CHECK_EQ(b->lora_slot[i], 1);
|
||||
f.commit_plain();
|
||||
|
||||
f.submit(64, 64);
|
||||
b = f.sch.step();
|
||||
CHECK(b != nullptr);
|
||||
CHECK_EQ(b->n_tok, (int64_t)65);
|
||||
CHECK_EQ(b->lora_slot[0], 1); /* the adapter request's decode row */
|
||||
for (int64_t i = 1; i < 65; ++i) CHECK_EQ(b->lora_slot[i], -1); /* the base prefill */
|
||||
}
|
||||
|
||||
/* With no adapters served the field is null and the step slab is byte for byte what it was before
|
||||
* the field existed: the slot array is the only thing adapters add to it. */
|
||||
TEST(no_adapters_no_slot_array) {
|
||||
Fixture f;
|
||||
f.build();
|
||||
CHECK_OK(f.start());
|
||||
f.submit(32, 8);
|
||||
const RadBatch* b = f.sch.step();
|
||||
CHECK(b != nullptr);
|
||||
CHECK(b->lora_slot == nullptr);
|
||||
|
||||
Config on = f.cfg;
|
||||
on.lora.max_loras = 2;
|
||||
const int64_t off_bytes = BatchBuilder::device_bytes(f.prog, f.cfg, f.kv.geom);
|
||||
const int64_t on_bytes = BatchBuilder::device_bytes(f.prog, on, f.kv.geom);
|
||||
CHECK(off_bytes > 0);
|
||||
CHECK_EQ(on_bytes - off_bytes, (f.cfg.max_tok * 4 + 255) / 256 * 256);
|
||||
}
|
||||
|
||||
TEST(state_chunk_bounds_split_a_long_prefill_at_absolute_multiples) {
|
||||
DeriveInput in;
|
||||
StepPlan plan;
|
||||
|
||||
Reference in new issue
Block a user