Struct ForcedSplitLevels¶
Defined in File ordered_schedule.hpp
Struct Documentation¶
-
struct ForcedSplitLevels¶
Pass levels, global over every batched space (design section 9.2): every value gets an integer pass such that a value that needs another value’s completed form sits in a later pass than that other value.
Two kinds of dependency edge bump the reader’s pass, both keyed on the operand (the “source”) rather than the axis space:
the source is
LoopCarriedon some axis (any space): its full array exists only after its own loop closes, so every direct reader is bumped;the source is a
Reductionon some instance (anAccumulateSumescape) and the reader is produced inside that same instance (its production site is at or below the reduction’s depth, in the same nest): such a reader would otherwise see the current batch’s partial sum rather than the completed reduction (the finding pinned by the 9.1 partial-sum check). A reader produced outside the reduced instance reads the completed sum from the escape’s residency scope as always and needs no bump.inside(reader_vid, source_vid)decides this per (reader, source) pair — the caller’s lambda captures the loop chain (fusion_slot, depth_of_instance, production_depth, type_cluster) needed to resolve the source’s reduced instance(s) and the reader’s production site exactly as the escape placement does.
Forward sweep (operands before consumers): level(v) = max over direct operands o of (bump(o, v) ? pass(o) + 1 : level(o)), 0 with no operands; a bumping-edge source’s pass is its level (it is pinned, see below); a value that is the source of no bumping edge has its level as its base. Reverse sweep (consumers before operands): a non-pinned value with at least one consumer is lifted to max(base, min over its direct consumers’ passes), so a value whose readers all sit later is built with them; a value with readers in several passes keeps its base (and is materialized by the builder’s rule 4 when a later same-nest reader needs it).
Every dependency edge points to an equal or earlier pass. With only LoopCarried bumps present (no Reduction-source bump fires) the passes reduce to a two-set partition: carried sources and everything else.
Public Functions
-
inline int pass(std::size_t vid) const¶
Public Members
-
std::unordered_set<std::size_t> carried¶
LoopCarried (any space) ids.
-
std::unordered_set<std::size_t> pinned¶
sources of a bumping edge (carried values, and Reduction sources with at least one in-loop reader): the reverse lift skips every id in this set.
-
std::unordered_map<std::size_t, int> pass_of¶
value id -> pass, for every value
ordered_schedule_dep_graphreached (has a legality cell and takes part in the dependency graph); absent for a value with no legality cell, whichpass()below reports as pass 0 rather than throwing.
-
int max_pass = 0¶