Module token_overlay

Module token_overlay 

Source
Expand description

2026-09-25: Launchers for the LoRA token-overlay kernels in kernels/gb10/common/token_overlay.cu:

Arguments are passed by position, so each launcher’s argument order must match its .cu signature.

Owner: model-layers ops (LoRA token overlays). Invariants: none beyond the types.

Structs§

OverlayKernels
2026-09-25: The four token-overlay kernels, resolved once at model construction with try_kernel. A missing kernel gives KernelHandle(0): the forward hooks then return without a launch, and build_overlay refuses an adapter that ships overlay tensors.

Functions§

embed_overlay_routed
2026-09-25: In-place replacement of overridden vocab rows in out ([num_tokens, h] BF16), after the embed gather.
embed_rowdiff
2026-09-25: flags[r] = (max_i |base[r,i] - served[r,i]| > thresh), one thread per row. base and served are [rows, h] BF16; flags is [rows] u8.
lmhead_overlay_routed
2026-09-25: In-place recompute of overridden logit columns in logits ([m, vocab], BF16 or FP32 to match kernel). One warp per (row, j), where j < max_n_override indexes the overridden ids of that row’s adapter slot; the kernel skips j >= n_tab[s] and ids >= vocab. hidden is [m, h] BF16; seq_slot is [m] i32, or null for the uniform active slot.