Struct CellLegality

Struct Documentation

struct CellLegality

The legality record of one value (one ValueCell::hash): its build-site, per-axis role, and home-placement legality.

Public Members

std::size_t hash = 0

== value_key_of(ValueCell): the value id (node id + home-sliced positions), the join key with the rich schedule

container::svector<Index> build_site

The batch-loop axes this value depends on at its own node &#8212; carried in its own result or contracted at its own node (not recursively over its operand subtrees; each operand is itself a value with its own, separately-analyzed CellLegality). Filled by build_site_of.

container::svector<AxisClass> per_axis

One entry per build_site axis, classifying its role. Filled by analyze_legality.

Note

LoopRole::LoopInvariant is never stored here &#8212; every build_site axis is by construction carried or contracted, so classify_axis returns only LoopLocal/Reduction/LoopCarried at these axes. A LoopInvariant axis is the implicit case (batchable + enclosing but absent from build_site); recover it from that absence, not from a per_axis entry (see home_floor).

container::svector<Index> home_floor

The shallowest legal home mode-set for this value: the per_axis axes whose role is LoopLocal (the axes the value stays sliced on &#8212; the value is homed inside these). Every other build_site axis &#8212; Reduction, LoopCarried &#8212; is lifted out (the value is homed above it), as is any axis absent from build_site altogether (the implicit LoopInvariant case: the value never depended on it, so it was trivially hoisted over it). Filled by analyze_legality.

container::svector<Index> forced_split_axes

Loops that must re-enter (the value cannot be homed above them without a re-materializing split). Entries are per-Index-instance, not per-space-type &#8212; an outer product like A{;i_3}*A{;i_4} lists both i_3 and i_4 (both LoopCarried on space i), yet they name a single occ loop to split. Consumers that want the distinct loops (axes) to split, not the raw per-instance list, should use forced_split_types below.