Template Function sequant::eval::detail::compute_cell

Function Documentation

template<Trace EvalTrace, typename node_t, typename F, typename N, bool FHC>
ResultPtr sequant::eval::detail::compute_cell(node_t const &node, CellId cell, CellReadResolver &resolver, F const &leaf_evaluator, CacheManager<N, FHC> &cache, eval::BatchContext const &ctx)

Compute one cell’s value, reading every operand through the cell table.

The ordered executor’s own compute step: what a Build cell (and an Assemble’s implicit per-batch source) is produced by. node is the value’s production node &#8212; one op over its operands &#8212; and cell is the consumer the table resolves those operands against.

Each operand leg is a table Read of cell: CellReadResolver::fetch names the source cell, spends one of its declared lives and applies the Read’s declared slices, and the value comes back in the registry’s canonical orientation, which this converts to the operand node’s own orientation (apply_canon_phase). Two cases do not resolve to a held cell:

  • a leaf’s first touch: fetch defers (leaving the Read unconsumed), the leaf evaluator runs on the whole leaf, the result is recorded as that leaf’s cell in the canonical orientation, and the Read is then served &#8212; which is what applies the declared slice. Serving the whole leaf here instead would hand the consumer a whole operand where the schedule says a batch slice;

  • a node the table holds no cell for: a transient of this production tree. It is computed here, in place, from its own operands (recursively, by the same rules) &#8212; the executor never hands a production back to the tree-walking engine.

The op itself is apply_one_op_traced (the shaped-product hook, the recompute tally and the per-op trace event included), or sum_in_place_traced for an accumulating Sum whose left operand the table says nothing will read again (CellReadResolver::operand_drained &#8212; the table-side answer to the provenance question evaluate_impl asks the scope chain). The production’s own node and every transient of its tree go through the same gate (apply_op below).

Parameters:

ctx – The batch context every declared slice is bound against: the enclosing realized loops plus, inside a block’s batch loop, that block’s own entry. Same context the caller put on cache.

Returns:

node's own oriented result (the caller converts it to the canonical orientation the registry stores).