Template Function sequant::eval::schedule::record_dag

Function Documentation

template<meta::eval_node_range R>
DagRecord sequant::eval::schedule::record_dag(RichSchedule const &rich, LegalitySchedule const &legality, OrderedSchedule const &ordered, R const &forest, std::vector<RootRecord> const &roots, std::function<bool(std::ranges::range_value_t<R> const&)> const &is_volatile = {}, dryrun::CostModel const *cm = nullptr, std::function<std::size_t(Index const&)> const &block_of = {})

Value ids: the value’s first occurrence in forest order, “<term key>#<

ordinal>”, “<term key>#scale” or “<root label>+<k>”. That occurrence is also the engine’s frame for the value’s cell (

home_modes_in_cell_frame: “the rich cell’s own frame – the first occurrence’s labels”), so the id’s term is the term whose index labels expr, the mode lists and the legality fields of the record are spelled in; every other occurrence has its own labels, recorded per occurrence. roots supplies term keys in forest order (roots[r].terms[t].key for root r, summand t).

Static points are matched to forest nodes by reproducing compute_dag_boulevard's numbering: one post-order (left, right, node) over every tree in forest order, leaves included, one counter across trees. This needs nothing beyond the forest itself and resolves every occurrence (each occurrence is one point), whereas going through build_value_key_node_map / resolve_value_node would give one node per value and lose which term each other occurrence sits in. The count is cross-checked against RichSchedule::num_points.

Parameters:
  • is_volatile – the node-level volatility predicate the evaluation runs with (see evaluate_ordered_schedule), which decides persistence; empty means no leaf is volatile

  • cm – when non-null, every value record is priced by this cost model: modeled_footprint = detail::cell_footprint at block_of (the per-batch slab) and modeled_size = memsize over the carried modes; null leaves both 0

  • block_of – the block (sliced) extent of a batched mode, as the schedule was built with; empty means 1

Throws:

sequant::Exception – when the forest and roots disagree (tree or summand count, a Sum spine node that is not an in-place Sum), or when a value, block step or legality record cannot be resolved