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:
baKon committed 2026-10-16 20:52:09 -05:00
1 parent 09ff76701c
commit 582cda0a53
15 files changed
+141 -84

No files matched your search

+5
View File
@@ -205,6 +205,9 @@ private:
* mm_rows): carved only when the program declared an encoder, empty otherwise. */
int32_t *h_rope = nullptr, *d_rope = nullptr;
int32_t *h_mmrow = nullptr, *d_mmrow = nullptr;
/* [n_tok] each row's runtime LoRA adapter slot (RadBatch::lora_slot): carved only when the
* engine serves adapters, empty otherwise. */
int32_t *h_lora = nullptr, *d_lora = nullptr;
/* [n_kv_groups][max_seqs]: every conv group's state slot per sequence (see init()). */
int32_t* h_convslot = nullptr;
@@ -310,6 +313,8 @@ private:
* (see RadBatch::mm_embd). The staging is refilled only after its last upload has run
* (`mm_ev_`). */
bool mm_on_ = false;
/* The engine serves runtime LoRA adapters (Config::lora): the batch carries each row's slot. */
bool lora_on_ = false;
int64_t n_embd_ = 0;
std::vector<void*> mm_dev_;
uint16_t* mm_host_ = nullptr;