pub fn embed_overlay_routed(
gpu: &dyn GpuBackend,
kernel: KernelHandle,
ids: DevicePtr,
seq_slot: DevicePtr,
active: i32,
slot_map_tab: DevicePtr,
rows_tab: DevicePtr,
n_tab: DevicePtr,
out: DevicePtr,
num_tokens: u32,
h: u32,
vocab: u32,
stream: u64,
) -> Result<()>Expand description
2026-09-25: In-place replacement of overridden vocab rows in out
([num_tokens, h] BF16), after the embed gather.
Per row r: s = seq_slot[r], or active when seq_slot is null; skip
when s < 0, when slot_map_tab[s] is null, or when ids[r] >= vocab;
slot = slot_map_tab[s][ids[r]]; skip when slot < 0 or
slot >= n_tab[s]; otherwise copy rows_tab[s][slot] over out[r].
ids is [num_tokens] u32; the three tables hold one entry per adapter
slot; vocab is the length of each slot map.