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

+39 -38
View File
@@ -1,4 +1,4 @@
/* abi_layout_table.h -- every abi/ struct's size and field offsets at RAD_ABI_VERSION 17 and
/* abi_layout_table.h -- every abi/ struct's size and field offsets at RAD_ABI_VERSION 18 and
* RAD_FORMAT_VER 2, as { type, field, offset, size } rows ("" is the struct itself). A snapshot
* of the headers on x86-64 Linux, which abi_layout_test.cpp holds the layout to; regenerate it
* from the test's printout only together with a version bump. */
@@ -20,7 +20,7 @@
{ "RadArgs", "instance", 48, 8 },
{ "RadArgs", "rank", 56, 4 },
{ "RadArgs", "world_size", 60, 4 },
{ "RadBatch", "", 0, 312 },
{ "RadBatch", "", 0, 320 },
{ "RadBatch", "phase", 0, 4 },
{ "RadBatch", "step", 4, 4 },
{ "RadBatch", "n_tok", 8, 8 },
@@ -29,42 +29,43 @@
{ "RadBatch", "positions", 32, 8 },
{ "RadBatch", "cu_seqlens", 40, 8 },
{ "RadBatch", "seq_ids", 48, 8 },
{ "RadBatch", "n_out", 56, 8 },
{ "RadBatch", "out_ids", 64, 8 },
{ "RadBatch", "q_lens", 72, 8 },
{ "RadBatch", "ctx_lens", 80, 8 },
{ "RadBatch", "max_q_len", 88, 4 },
{ "RadBatch", "max_ctx_len", 92, 4 },
{ "RadBatch", "n_kv_groups", 96, 4 },
{ "RadBatch", "kv", 104, 8 },
{ "RadBatch", "n_spec", 112, 4 },
{ "RadBatch", "num_accepted", 120, 8 },
{ "RadBatch", "spec_parent", 128, 8 },
{ "RadBatch", "draft_pass", 136, 4 },
{ "RadBatch", "n_checkpoints", 140, 4 },
{ "RadBatch", "checkpoint_tok", 144, 8 },
{ "RadBatch", "checkpoint_slot", 152, 8 },
{ "RadBatch", "n_seq_decode", 160, 8 },
{ "RadBatch", "n_tok_decode", 168, 8 },
{ "RadBatch", "max_q_len_decode", 176, 4 },
{ "RadBatch", "max_q_len_prefill", 180, 4 },
{ "RadBatch", "n_draft_out", 184, 8 },
{ "RadBatch", "draft_out_ids", 192, 8 },
{ "RadBatch", "n_ahead", 200, 8 },
{ "RadBatch", "rope_pos", 208, 8 },
{ "RadBatch", "rope_mixed", 216, 4 },
{ "RadBatch", "n_mm_rows", 224, 8 },
{ "RadBatch", "mm_rows", 232, 8 },
{ "RadBatch", "mm_embd", 240, 8 },
{ "RadBatch", "enc", 248, 4 },
{ "RadBatch", "enc_n_patch", 256, 8 },
{ "RadBatch", "enc_pixels", 264, 8 },
{ "RadBatch", "enc_coord", 272, 8 },
{ "RadBatch", "enc_n_seg", 280, 8 },
{ "RadBatch", "enc_cu", 288, 8 },
{ "RadBatch", "enc_max_seg", 296, 4 },
{ "RadBatch", "gen", 300, 4 },
{ "RadBatch", "gen_b", 304, 8 },
{ "RadBatch", "lora_slot", 56, 8 },
{ "RadBatch", "n_out", 64, 8 },
{ "RadBatch", "out_ids", 72, 8 },
{ "RadBatch", "q_lens", 80, 8 },
{ "RadBatch", "ctx_lens", 88, 8 },
{ "RadBatch", "max_q_len", 96, 4 },
{ "RadBatch", "max_ctx_len", 100, 4 },
{ "RadBatch", "n_kv_groups", 104, 4 },
{ "RadBatch", "kv", 112, 8 },
{ "RadBatch", "n_spec", 120, 4 },
{ "RadBatch", "num_accepted", 128, 8 },
{ "RadBatch", "spec_parent", 136, 8 },
{ "RadBatch", "draft_pass", 144, 4 },
{ "RadBatch", "n_checkpoints", 148, 4 },
{ "RadBatch", "checkpoint_tok", 152, 8 },
{ "RadBatch", "checkpoint_slot", 160, 8 },
{ "RadBatch", "n_seq_decode", 168, 8 },
{ "RadBatch", "n_tok_decode", 176, 8 },
{ "RadBatch", "max_q_len_decode", 184, 4 },
{ "RadBatch", "max_q_len_prefill", 188, 4 },
{ "RadBatch", "n_draft_out", 192, 8 },
{ "RadBatch", "draft_out_ids", 200, 8 },
{ "RadBatch", "n_ahead", 208, 8 },
{ "RadBatch", "rope_pos", 216, 8 },
{ "RadBatch", "rope_mixed", 224, 4 },
{ "RadBatch", "n_mm_rows", 232, 8 },
{ "RadBatch", "mm_rows", 240, 8 },
{ "RadBatch", "mm_embd", 248, 8 },
{ "RadBatch", "enc", 256, 4 },
{ "RadBatch", "enc_n_patch", 264, 8 },
{ "RadBatch", "enc_pixels", 272, 8 },
{ "RadBatch", "enc_coord", 280, 8 },
{ "RadBatch", "enc_n_seg", 288, 8 },
{ "RadBatch", "enc_cu", 296, 8 },
{ "RadBatch", "enc_max_seg", 304, 4 },
{ "RadBatch", "gen", 308, 4 },
{ "RadBatch", "gen_b", 312, 8 },
{ "RadBufDecl", "", 0, 80 },
{ "RadBufDecl", "dtype", 0, 4 },
{ "RadBufDecl", "rank", 4, 4 },