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 -4
View File
@@ -630,10 +630,11 @@ implementation reads `res` before it stores the product over it.
The two halves of `y += scale ⊙ (B · (A · x))` at a trunk GEMM, issued by the core right after the
GEMM in the GEMM's own row slice, with several adapters and no adapter mixed in one step. `slot` is
an i32 per row naming its adapter's pool slot; **a row with `slot < 0 || slot >= S` is a base row
and neither op touches it**: `lora_shrink` writes nothing into its `t` row, and `lora_expand` does
not read or write its `y` row at all — so a base row stays bit for bit what the GEMM wrote, where
`y + 0` would already have turned a -0 into +0.
an i32 per row naming its adapter's pool slot -- the step batch's `RadBatch::lora_slot` from the
GEMM's first row on; **a row with `slot < 0 || slot >= S` is a base row and neither op touches
it**: `lora_shrink` writes nothing into its `t` row, and `lora_expand` does not read or write its
`y` row at all — so a base row stays bit for bit what the GEMM wrote, where `y + 0` would already
have turned a -0 into +0.
- `lora_shrink`: `t[m, j] = Σ_k x(m, k) · lora_a[s, j, k]`, `s = slot[m]`, f32 accumulate.
`a`/`a_scale` are the GEMM's own first two operands, and `x(m, k)` is the value `gemm_nt_q` uses