Template Function sequant::eval::compute_dag_boulevard

Function Documentation

template<meta::eval_node_range R, typename BlockOfFn>
RichSchedule sequant::eval::compute_dag_boulevard(R const &forest, dryrun::CostModel const &cm, BlockOfFn const &block_of)

Linearize an eval forest into a RichSchedule of rich value cells over a single post-order static-point timeline.

Stamps the lifetime masks first (so home_scope, which reads sliced_modes, is populated), then walks every tree in post-order (children before parent), assigning each visited node &#8212; leaves included &#8212; a monotone static point. On descent each node’s node_slice_mask() loops are pushed onto an enclosing-batch-context stack visible to that node’s children, and popped before the node itself is recorded: a node’s own realized loop encloses its operands but not its own (loop-result) value.

Nodes are then grouped by hash_value() &#8212; the same value identity CacheManager uses &#8212; into one ValueCell per distinct value. Under perfect CSE the group’s first_use is its single (earliest) production point and its last_use is the latest structural consumer (the max parent point over the group; a root with no parent contributes its own point). home_depth, carried, and home_modes are read off the first occurrence (the seed-residency meet is identical across occurrences of a hoisted value); enclosing_modes accumulates across every occurrence, since a demoted mode may only enclose the value at some of its occurrences.

block_of is any Index -> std::size_t callable giving the block (sliced) element count for a mode; only used while walking (to size the enclosing-batch-context entries pushed on descent) &#8212; cm is accepted for signature symmetry with detail::cell_footprint but not otherwise used here (no footprint is computed).