pub struct EmbedOverlay {
pub rows: CudaSlice<f32>,
pub spans: Vec<(usize, usize, usize)>,
}Expand description
Mixed-embedding prime overlay: image embeddings that replace <|image_pad|> token
embeddings at prompt-relative positions during prime_cache_overlaid. rows holds all
images’ merger outputs concatenated ([total_rows, n_embd]); each span is
(prompt_pos, row_off, n_rows) — rows [row_off, row_off+n_rows) land at prompt
positions [prompt_pos, prompt_pos+n_rows). Spans must not overlap.
Fields§
§rows: CudaSlice<f32>§spans: Vec<(usize, usize, usize)>Implementations§
Source§impl EmbedOverlay
impl EmbedOverlay
Sourcepub fn window(&self, off: usize, len: usize) -> Option<EmbedOverlay>
pub fn window(&self, off: usize, len: usize) -> Option<EmbedOverlay>
Sub-window for a prime call covering prompt-relative [off, off+len): spans clipped
and rebased so the callee sees call-relative positions (the serve prefill tick primes
a prompt across multiple prime_cache_overlaid calls). rows is an Arc clone, not a
copy. None = no image rows in this window (caller may prime plain).
Sourcepub fn splice_into(
&self,
e: &Engine,
embedded: &mut CudaSlice<f32>,
chunk_off: usize,
t: usize,
n_embd: usize,
) -> Result<(), Box<dyn Error>>
pub fn splice_into( &self, e: &Engine, embedded: &mut CudaSlice<f32>, chunk_off: usize, t: usize, n_embd: usize, ) -> Result<(), Box<dyn Error>>
The mixed-embedding splice itself: image rows overwrite placeholder-token embeddings
inside a prime call’s prompt-relative window [chunk_off, chunk_off + t), BEFORE any
downstream transform (stream expansion, trunk walk). ONE implementation shared by the
single-engine hyper walk and the ppN stage-0 intake (lane/glm5-vision-default-on) so
the splice point cannot drift between arms. embedded is the [t, n_embd] token
embedding buffer of this call; rows must live on e’s device.