Template Function sequant::eval::analyze_legality¶
Defined in File legality.hpp
Function Documentation¶
-
template<meta::eval_node_range R>
inline LegalitySchedule sequant::eval::analyze_legality(RichSchedule const &rich, R const &forest, BatchPolicy const &policy)¶ Fold a
RichScheduleinto the first realLegalitySchedule:oneCellLegalityperValueCell, with its at-nodebuild_site(build_site_of),per_axisclassification (classify_axis),home_floor(theLoopLocalsubset ofper_axis), andforced_split_axes(theLoopCarriedsubset ofper_axis) filled in.ValueCelldoes not itself retain the forest node itshashresolves to (onlycarried, a copy of the node’scanon_indices()), soforestis re-walked once up front into a hash -> representative-node map (the same patternbuild_value_node_map, value_node_map.hpp, uses) to recover each cell’s owncontracted_indices(node). Under perfect CSE every occurrence of a value shares one node shape, so the first-visited representative suffices.- Forced splits
A value classified
LoopCarriedon axisLsurvives the axis into its own result indices, so its producingL-loopmust close before any cross-iteration consumer can read it (the consumer, at a differentLiteration, reads a value bound to a foreignLindex).Lis therefore recorded in that value’sforced_split_axes:the axis cannot be a single unbroken loop around this value. This is directly derivable from the per-axis roles alone.- No fixpoint: a value read across a forced split is not demoted here
A value
LoopLocalon a forced-split axisLthat is read by a later-pass reader is handled entirely by the sequencer (build_ordered_schedule'sper-nest pass placement, rule 4), which materializes such a value across the pass boundary at schedule-build time — “used across the split” is a property of the ordered pass structure the sequencer builds, not of the DAG this function sees, so classification here needs to react to it.analyze_legalityis therefore a single deterministic round: one classification per cell, with no re-derivation loop.