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
+2
-13
@@ -29,14 +29,13 @@ bool is_coded(uint32_t dt) {
|
||||
}
|
||||
|
||||
rad_buf decl_persist(Builder& b, const std::string& name, uint32_t dtype, uint32_t rank,
|
||||
const int64_t* shape, int kind = RAD_BUF_PERSIST, const char* derive = nullptr) {
|
||||
const int64_t* shape) {
|
||||
RadBufDecl d{};
|
||||
d.dtype = dtype;
|
||||
d.rank = rank;
|
||||
for (uint32_t i = 0; i < rank; ++i) d.shape[i] = shape[i];
|
||||
d.kind = kind;
|
||||
d.kind = RAD_BUF_PERSIST;
|
||||
d.domain = RAD_DOMAIN_DEVICE;
|
||||
d.derive = derive;
|
||||
return b.decl_buffer(name.c_str(), &d);
|
||||
}
|
||||
|
||||
@@ -130,16 +129,6 @@ int lora_declare(Builder& b, const LoraDeclare& d) {
|
||||
P.lora_t.push_back(sc);
|
||||
}
|
||||
|
||||
/* ---- the per-token slot, derived by the core each step (core/sched/derive.cpp) */
|
||||
{
|
||||
const int64_t sh[1] = { max_tok };
|
||||
P.lora_slot_buf = decl_persist(b, "lora.slot", RAD_I32, 1, sh, RAD_BUF_DERIVED, "lora_slot");
|
||||
if (!P.lora_slot_buf) {
|
||||
RAD_ERR("lora: could not declare the per-token slot buffer");
|
||||
return RAD_E_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- the two ops behind each targeted GEMM */
|
||||
P.lora_sites.clear();
|
||||
int n_refused = 0;
|
||||
|
||||
Reference in new issue
Block a user