Add the rank-model extend concatenating two sources at the top level

This commit is contained in:
Dennis Kobert
2026-08-17 11:42:52 +00:00
parent fbba0cd037
commit 8508dc6c9d
4 changed files with 166 additions and 1 deletions

View File

@@ -75,4 +75,10 @@ impl LevelIn {
pub fn pushed(&self) -> bool {
self.level + 1 == self.depth
}
/// Whether the query targets the topmost level; `pushed` under the name a
/// non-creator (concat, remap) reads naturally.
pub fn top(&self) -> bool {
self.pushed()
}
}

View File

@@ -185,6 +185,16 @@ impl Extent {
_ => Extent::Free,
})
}
/// The sum of two extents, used to concatenate a level; a free operand
/// counts as one lane, so a scalar edge joins a concat as a single item.
pub fn sum(a: GPoll<Extent>, b: GPoll<Extent>) -> GPoll<Extent> {
let lanes = |extent| match extent {
Extent::Exactly(count) => count,
Extent::Free => 1,
};
a.zip(b).map(|(a, b)| Extent::Exactly(lanes(a) + lanes(b)))
}
}
/// A query over a node's nesting levels: one level, the product below or above

View File

@@ -490,6 +490,15 @@ impl<'a, N> LazyInput<'a, N> {
{
self.cell.eval_input(self.input_index, self.node, ctx)
}
/// The edge's composite extent, for kernels that split or shift indices
/// over their sources.
pub fn extent<Input>(&self, ctx: &Input, at: Level) -> GPoll<Extent>
where
N: Node<Input>,
{
self.node.extent(ctx, at)
}
}
#[cfg(test)]