Function sequant::eval::compute_sliced_mode_assignment

Function Documentation

inline SlicedModeAssignment sequant::eval::compute_sliced_mode_assignment(OrderedSchedule const &ordered, RichSchedule const &rich)

build the per-(value, sliced-mode) -> DAG-scope-loop SlicedModeAssignment from an already-built ordered (must be build_ordered_schedule(rich, ...)'s return value for this same rich).

Uses a two-pass fetch-site walk (populate_build_scope_walk for the enclosing-loop scope of every produced/escaped value, and ordered_schedule_dep_graph for the operand edges, leaves included): an exact pass matching a block’s representative axis against a value’s own carried Index (step (3) below), then a regime-2 relabel pass (step (4) below) recovering a CSE value’s own label from its occurrences when it was canonicalized independently of the block’s representative axis (the same physical loop, relabeled) — but records the raw facts keyed by the value’s own Index label (not a ValueCell::carried position), consistency-checked the same way (two fetch sites disagreeing on one value’s mode’s level is a scheduler bug, never resolved by averaging or last-write-wins), then remapped through the canonical LoopId enumeration (detail::enumerate_realized_levels) instead of storing the DagScopeLevel directly — this is what makes forced-split siblings (same depth/space, different ordinal) come out as distinct colors: they are distinct entries in the canonical levels list by construction.