sched, mem: the per-request switch reaches the device, and the cache keeps the modes apart

`projection_on_rows` expands each request's choice across its tokens once per step, into the int32
mask hc_project reads; rows outside every sequence are zeroed first, so the reused arena region can
never carry a previous step's flag.

The prefix cache keys a projected request's blocks on the vector itself, through the same extension
point the runtime LoRA adapter uses: one content key spanning the whole sequence, pushed into
`media_keys` beside the adapter's, so every block overlaps it. Blocks and linear-state checkpoints
(whose keys are the same chained hash) therefore never cross modes; an unprojected request, or a
deployment with no vector, adds no span and hashes exactly as before, and an adapter and a vector
compose.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent 809257e393
commit 66c6d71254
3 files changed
+57 -7

No files matched your search

+2 -2
View File
@@ -1476,9 +1476,9 @@ int Engine::serve(std::unique_ptr<StallWatch> watch) {
const uint64_t t0 = rad_mono_ns();
PrefixCache& pc = ranks_[0]->prefix;
std::vector<MMContentKey> mk;
media_keys(req, &mk);
media_keys(req, &mk, cvec_salt_for(req.sp.use_control_vector));
const std::vector<BlockHash> want =
pc.restorable_from(req.prompt, mk, cvec_salt_for(req.sp.use_control_vector));
pc.restorable_from(req.prompt, mk);
if (want.empty()) return;
/* The whole chain in one restore. With 4-token blocks a long conversation is tens of
* thousands of entries; batched, it is one launch per (group, layer) per staging batch