Sweep the data-flow wire and edge wording to input and source

This commit is contained in:
Dennis Kobert
2026-09-06 15:14:55 +00:00
parent 96521333d6
commit 9d3abe385f
34 changed files with 156 additions and 156 deletions

View File

@@ -147,7 +147,7 @@ fn read_index(
/// In programming terms: inside the double loop `i { j { ... } }`, *Loop Level* 0 = `j` and 1 = `i`. After inserting a third loop `k { ... }`, inside it, levels would be 0 = `k`, 1 = `j`, and 2 = `i`.
loop_level: u32,
) -> f64 {
// The chain's innermost entry is the consuming wire's own lane from the
// The chain's innermost entry is the consuming input's own lane from the
// decompose-and-promote split; the loops the reader counts sit above it.
ctx.try_index().and_then(|mut iter| iter.nth(loop_level as usize + 1)).unwrap_or(0) as f64
}

View File

@@ -28,7 +28,7 @@ fn unwrap_option<T: Default>(_: impl Ctx, #[implementations(Option<f64>, Option<
input.unwrap_or_default()
}
/// Clones the element out of its record wire.
/// Clones the element out of its record input.
#[node_macro::node(category("Debug"))]
fn clone<T: Clone>(_: impl Ctx, #[implementations(Raster<CPU>, f64)] value: &T) -> T {
value.clone()

View File

@@ -21,11 +21,11 @@ pub struct MemoLevel {
/// Helps speed up repeated renders in a computationally-heavy part of the node graph.
///
/// Stores a deep copy of the last record (a scalar wire) or the last whole
/// level (a leveled wire) that flowed through this node and replays it on
/// Stores a deep copy of the last record (a scalar input) or the last whole
/// level (a leveled input) that flowed through this node and replays it on
/// subsequent renders if the context has not changed. The owned copies survive
/// a persistent flush, so this is the memo for content whose recomputation is
/// expensive. A leveled wire's cache key normalizes the addressed lane away,
/// expensive. A leveled input's cache key normalizes the addressed lane away,
/// so per-lane pulls share one materialization of the content instead of
/// re-evaluating it per lane.
#[node_macro::node(category("General"), path(graphene_core::memo))]
@@ -35,8 +35,8 @@ fn memoize<'e, 'l>(
content: impl Node<Context<'_>>,
slot: FrameClaim<'e, 'l>,
) -> GPoll<Served<'e>> {
// A scalar wire's value may depend on the consuming lane (index readers),
// so only a leveled wire, whose level covers every lane by construction,
// A scalar input's value may depend on the consuming lane (index readers),
// so only a leveled input, whose level covers every lane by construction,
// keys with the lane normalized away.
let leveled = content.layout().depth > 0;
let lane = match leveled {
@@ -89,7 +89,7 @@ fn memoize<'e, 'l>(
return match content.materialize_level(&ctx, ctx.arena()) {
LevelStatus::Batch(batch, finality) => {
let layout = content.layout();
// SAFETY: the batch came from this edge, so it carries the edge's layout.
// SAFETY: the batch came from this input, so it carries the input's layout.
let lanes: Vec<OwnedRecord> = (0..batch.len()).map(|index| unsafe { OwnedRecord::copy_out(layout, batch.get(index).rec()) }).collect();
let entry = MemoLevel {
key,
@@ -115,7 +115,7 @@ fn memoize<'e, 'l>(
};
if let Some((value, finality)) = publishable {
let layout = content.layout();
// SAFETY: the value came from this edge, so it carries the edge's
// SAFETY: the value came from this input, so it carries the input's
// layout, and one record of it is a batch of one lane.
let batch = unsafe { core_types::node::RecordBatch::new(layout.rec(value).ptr(), 1, layout) };
// SAFETY: as above.
@@ -151,8 +151,8 @@ fn frame_memo<'e, 'l>(
content: impl Node<Context<'_>>,
slot: FrameClaim<'e, 'l>,
) -> GPoll<Served<'e>> {
// A scalar wire's value may depend on the consuming lane (index readers),
// so only a leveled wire, whose level covers every lane by construction,
// A scalar input's value may depend on the consuming lane (index readers),
// so only a leveled input, whose level covers every lane by construction,
// keys with the lane normalized away.
let leveled = content.layout().depth > 0;
let lane = match leveled {
@@ -198,7 +198,7 @@ fn frame_memo<'e, 'l>(
if leveled {
return match content.materialize_level(&ctx, ctx.arena()) {
LevelStatus::Batch(batch, finality) => {
// SAFETY: the batch came from this edge, so it carries the edge's layout.
// SAFETY: the batch came from this input, so it carries the input's layout.
let span = unsafe { MaterializedSpan::to_persistent(&batch, &promotion) };
*cache.lock().unwrap() = span.map(|span| SpanLevel { key, span, finality });
match lane < batch.len() {
@@ -220,7 +220,7 @@ fn frame_memo<'e, 'l>(
};
if let Some((value, finality)) = publishable {
let layout = content.layout();
// SAFETY: the value came from this edge, so it carries the edge's
// SAFETY: the value came from this input, so it carries the input's
// layout, and one record of it is a batch of one lane.
let batch = unsafe { core_types::node::RecordBatch::new(layout.rec(value).ptr(), 1, layout) };
// SAFETY: as above.
@@ -235,7 +235,7 @@ type MonitorValue = Arc<Mutex<Option<CtxSnapshot>>>;
/// The Monitor node is used by the editor to access the data flowing through
/// it. It stores only the evaluation context: the output is pure over
/// (context, source generations), so introspection recreates it by
/// re-evaluating this edge with the rehydrated snapshot.
/// re-evaluating this input with the rehydrated snapshot.
#[node_macro::node(category(""), path(graphene_core::memo), serialize(serialize_monitor), properties("monitor_properties"))]
fn monitor<'e, 'l>(
ctx: impl Ctx + DeriveCtx + ExtractAll + ExtractArena<'e> + ModifyIndex + Copy,

View File

@@ -1,5 +1,5 @@
//! Pilot record nodes exercising the macro's record-tier attribute io:
//! per-input tuple reads resolved against each input's wire, offset writes,
//! per-input tuple reads resolved against each input, offset writes,
//! `RemoveAttr` layout subtraction, the ElToken byte-carry for passthrough
//! elements, and the `_: ()` no-carrier form. These are the flat-wave law
//! tests; the node forms are the production authoring surface, and the
@@ -1494,8 +1494,8 @@ mod tests {
}
}
/// The compiler clears an input's bit when its edge reads the addressed
/// lane; the batch must then re-evaluate that edge per lane, since hoisting
/// The compiler clears an input's bit when its source reads the addressed
/// lane; the batch must then re-evaluate that source per lane, since hoisting
/// a lane-varying value serves the range's first lane to all of them.
#[test]
fn batch_rebinds_an_eager_input_the_compiler_cannot_prove_invariant() {

View File

@@ -372,9 +372,9 @@ pub fn stamp_layer_path<'e, T>(ctx: impl Ctx + ExtractArena<'e>, element: T, pat
#[node_macro::node(category("General"), extent(extend_extent))]
pub fn extend<T>(
ctx: impl Ctx + ExtractIndex + InjectIndex + Copy,
/// The wire whose lanes appear at the start of the extended level.
/// The input whose lanes appear at the start of the extended level.
base: impl Node<Context<'_>, Output = T>,
/// The wire whose lanes appear at the end of the extended level.
/// The input whose lanes appear at the end of the extended level.
#[expose]
new: impl Node<Context<'_>, Output = T>,
) -> Result<T, Interrupt> {
@@ -488,7 +488,7 @@ pub fn to_graphic<'e, T: graphic_types::graphic::IntoGraphicElement>(
}
/// The elementwise `Graphic` coercion the compiler-inserted converts use: each
/// lane's element converts on its own, so a typed wire feeds a graphic input
/// lane's element converts on its own, so a typed source feeds a graphic input
/// without changing the level's shape. Registered under the convert identifier.
#[node_macro::node(category(""))]
pub fn to_graphic_element<'e, T: graphic_types::graphic::IntoGraphicElement>(
@@ -537,7 +537,7 @@ fn to_graphic_unit_extent(_content: core_types::extent::ValueIn<'_, ()>, _level:
GPoll::Final(Extent::Exactly(0))
}
/// The transitional level bridge: the wire's records as the legacy list an
/// The transitional level bridge: the input's records as the legacy list an
/// unconverted consumer expects, attributes copied through their erased
/// reads and content kept in its native form. Registered under the legacy
/// convert identifiers; the rows die with the last legacy consumer.

View File

@@ -178,7 +178,7 @@ fn flat_map<Row: Clone + Send + Sync + core_types::CacheHash + 'static, T>(
}
/// Rank-model level collapse: two nested levels become one flat level. The
/// flat index already spans the edge's depth, so the eval forwards it.
/// flat index already spans the input's depth, so the eval forwards it.
#[node_macro::node(category("Test"), extent(flatten_levels_extent))]
fn flatten_levels<T>(ctx: impl Ctx + DeriveCtx + ExtractIndex, content: impl Node<Context<'_>, Output = IList<IList<T>>>) -> Result<IList<T>, Interrupt> {
let head = ctx.index_head();

View File

@@ -75,7 +75,7 @@ fn render_intermediate<T: dyn_any::StaticTypeSized + 'static + Render + WasmNotS
Ok(intermediate_of(&data, render_params))
}
/// The leveled form of `render_intermediate`: the wire's records materialize
/// The leveled form of `render_intermediate`: the input's records materialize
/// into a run, which renders directly.
#[node_macro::node(category(""))]
fn render_intermediate_leveled<T: Clone + Send + Sync + core_types::CacheHash + dyn_any::StaticTypeSized + 'static>(

View File

@@ -1027,7 +1027,7 @@ mod graphene_test {
core_types::record::test_frames(layouts.iter().map(|layout| layout.frame_bytes()).sum::<usize>().max(1 << 12))
}
/// Lifts a plain-element test source onto a record wire, returned beside its
/// Lifts a plain-element test source onto a record input, returned beside its
/// element-only layout for the generated node's constructor.
fn lifted<T, F>(kernel: F) -> (LiftedSource<T, F>, Layout)
where

View File

@@ -102,7 +102,7 @@ fn boolean_core<'e>(
#[node_macro::node(category("Vector: Modifier"), memoize)]
fn boolean_operation<'e>(
ctx: impl Ctx + ExtractArena<'e> + core_types::InjectIndex + Copy,
/// The wire of vector paths to perform the boolean operation on. Nested groups are automatically flattened.
/// The input of vector paths to perform the boolean operation on. Nested groups are automatically flattened.
content: IList<Graphic<'static>>,
/// Which boolean operation to perform on the paths.
///

View File

@@ -11,7 +11,7 @@ use graphic_types::Vector;
use graphic_types::raster_types::{CPU, GPU, Raster};
use vector_types::GradientStops;
/// Applies the specified transform to each lane of the input wire, composing onto the lane's transform attribute.
/// Applies the specified transform to each lane of the input, composing onto the lane's transform attribute.
#[node_macro::node(category("Math: Transform"), extent(transform_extent))]
fn transform<T>(
ctx: impl Ctx + DeriveCtx + ModifyFootprint,
@@ -88,14 +88,14 @@ fn reset_transform<T>(_: impl Ctx, (element, transform): (T, Attr<TransformAttr>
(element, Attr(row_transform))
}
/// Overwrites the transform of each lane of the input wire with the specified transform.
/// Overwrites the transform of each lane of the input with the specified transform.
#[node_macro::node(category("Math: Transform"))]
fn replace_transform<T>(_: impl Ctx + InjectFootprint, (element, _content_transform): (T, Attr<TransformAttr>), transform: DAffine2) -> (T, Attr<TransformAttr>) {
(element, Attr(transform))
}
// TODO: Figure out how this node should behave once #2982 is implemented.
/// Obtains the transform of the first lane of the input wire, if present.
/// Obtains the transform of the first lane of the input, if present.
#[node_macro::node(category("Math: Transform"), path(core_types::vector))]
fn extract_transform<T: Clone + Send + Sync + CacheHash + 'static>(_: impl Ctx, #[implementations(Graphic, Vector, Raster<CPU>, Raster<GPU>, Color, GradientStops)] content: IList<T>) -> DAffine2 {
match content.len() {