Template Function sequant::eval::evaluate_ordered_schedule¶
Defined in File ordered_executor.hpp
Function Documentation¶
-
template<Trace EvalTrace = Trace::Default, meta::can_evaluate_range Nodes, typename F, typename N, bool FHC, typename ScopeGuardFactory = ::sequant::make_no_scope_guard>
ResultPtr sequant::eval::evaluate_ordered_schedule(Nodes const &forest, OrderedSchedule const &ordered, RichSchedule const &rich, auto const &layout, F const &leaf_evaluator, CacheManager<N, FHC> &cache, std::function<std::size_t(Index const&)> const &target, ScopeGuardFactory const &make_scope_guard = {}, std::function<bool(std::ranges::range_value_t<Nodes> const&)> const &is_volatile = {})¶ The ordered executor (as-built design section 8,
doc/dev/specs/2026-09-12-batched-array-dag-eval-as-built.md). Walksordered.root.stepsin sequence, building one value per root-levelBuildStepviadetail::compute_cell(which reads every operand through the cell table, so a value an earlier step already produced is read from its cell rather than re-descended into — seecompute_cell'sdoc comment) and one value per root-levelScopeBlock(Contracted or External alike) viadetail::run_ordered_contracted_block(a realized batch loop, its ownBuildStep's/nestedchild blocks run per batch on a scratch cache, itsAccumulateSumoutputs summed across batches; itsAccumulateScatteroutputs written into a disjoint slice of a pre-sized destination each batch — both kinds stored at the level the block itself sits in on close, including a nest’s own pass-ordered sibling blocks (one per pass, latitude = pass), run in schedule order like any other set of sibling steps), then combines the forest roots’ results into the finalResultPtrvia the shared root-combine loopcombine_forest_roots(permute-to-layout+ cross-rootadd_inplace, with the Term/Permute/SumInplace trace bookkeeping).- Parameters:
forest – The forest whose per-root results are evaluated and summed.
ordered – The
OrderedSchedule(build_ordered_schedule) forforest, built fromrich/ aLegalityScheduleover it.rich – The
RichSchedulethat producedordered(compute_dag_boulevard) — used to resolve aBuildStep'svalue_idback to a forest node via itsValueCell::hashandbuild_value_node_map, and to resolve each forest root’s ownvalue_idfor the final combine.layout – The layout each root’s result is permuted to before being summed.
leaf_evaluator – The leaf evaluator, as in
sequant::evaluate.cache – The cache handle this run hangs its hooks off (backend array-ops, the peak monitor, the persistent value store); the table, not this cache, is where a value repeated across
BuildStep'soperand needs is deduped.target – Per-index batch partition size (elements): the source of each realized loop block’s batch partition (
detail::run_ordered_contracted_block'smode_batchescall).make_scope_guard – Backend scope-guard factory; unused here (no backend screening relaxation is threaded into the loop-block walk), threaded for interface symmetry with the forest-descent driver.
is_volatile – node-level volatility predicate (empty means “never volatile”), the lift of
BatchPolicy::is_volatile_leafexactly asmake_evaluator'sownis_volatile_nodelift (eval.hpp) computes it — threaded down throughdetail::run_ordered_contracted_block'srecursion but not consulted here: classifying a home value volatile-vs-persistent viasubtree_anyat the homing sites is left to the caller.
- Returns:
The summed, per-root-permuted result, as forest descent itself would produce for the same (unbatched)
forest.