Skip to main content

bind_under

Function bind_under 

Source
pub fn bind_under(
    parent: &dyn Kernel,
    program: Arc<dyn KernelProgram>,
    iter_bindings: &[(String, Value)],
) -> Result<Box<dyn Kernel>, KernelError>
Expand description

A kernel of program bound under parent: iter_bindings written first, so the child’s own scope coordinates see them, then the parent’s cells attached and its values copied in.

What the child holds when this returns is what its scope knows at construction. A parent const, and anything else fixed when the parent was initialized, is in the child’s input of the same name, by value, and Kernel::input_value reads it. A value the parent computes per cycle is attached as a cell and holds nothing until the parent computes it. So a child that needs a fact at construction declares an extern for the constant, not for a per-cycle value made from it (host questions guide, and scope_model.md §4 for the rule form by form).

The kernel’s Kernel::program_id is program’s, whichever engine program is on, so a host that sealed a plan of indices against the program can use it on every kernel bound from it.