Struct OccurrenceRec

Struct Documentation

struct OccurrenceRec

These are what compute_dag_boulevard's conflict-aware union-find runs over: physical loops are connected components of occurrences, and a value’s identity is derived from them (“Loop identity and value identity”, doc/developer/batched_evaluation.rst). Each record carries its occurrence’s physical binding of a relabeled mode plus its own carried / home / liveness / enclosing nest.

These are the per-NodeRec fields compute_dag_boulevard computes during its post-order walk and retains through grouping, beside the per-value union/min/max: (a) two occurrences that bind a relabeled mode to different physical labels (the g.C legs’ i_3 vs i_4) are told apart by their carried; (b) each split cell’s replication factor is a product over the levels it is homed-within-but-does-not-carry, read from its subset-local ectx (enclosing loops) minus carried.

Public Members

std::size_t point

this occurrence’s production static point

std::size_t consumer_point

its structural consumer (parent) point

rec::IndexList carried

this occurrence’s canon_indices

rec::IndexList home

home_scope (plain modes)

rec::LoopList ectx

enclosing loops (excludes this node’s own)

rec::PointList ectx_opener_point

The static point of the occurrence (in the same tree) that opened each ectx entry, parallel to ectx: names the loop instance each entry is, so the boulevard can read the DP’s nesting order off the occurrences (RichSchedule::loop_order).

rec::PointList operand_points

Static points of this occurrence’s operand occurrences, left then right (empty on a leaf). An operand’s leg is its index here; the sliced-mode seam attributes its facts per leg, so one value read on both legs of a node under different labels (a self-product of a shared intermediate) gets two distinct slicings.

rec::OpenList opens

The loops this occurrence’s node opens, with their kind (Contracted: a mode this node contracts in batches; External: a carried mode whose physical loop is introduced here). Carried into RichSchedule::loop_kind once the loop slots are numbered.

rec::SlotList loop_slot

Loop identity: per carried position, the loop_slot of the batch loop that slices it (which member of its same-key group), or -1 where the position is not a batched (loop-sliced) mode. Assigned by the union-find over producer->consumer slot connectivity in compute_dag_boulevard (“Loop identity and value identity”; this file’s header comment carries the path). Parallel to carried.

rec::ReducedSlotList reduced_slot

Loop identity for the modes this occurrence’s value contracts (reduces) in batches at its own node: assigned either by uniting a producing operand’s home-sliced carried-mode node with a synthetic reduction node (the reduction loop and the operand’s slice loop are one physical loop and must share loop_slot), or – when no operand is home-sliced on the mode – by seeding that synthetic node directly (see contracted_batched below). A reduced mode has no carried position, so its slot is recorded here as (mode, loop_slot). Read by ordered_schedule's fusion_slot when it places a Reduction escape; a Reduction mode that still resolves to no slot here is a hard error there (build_ordered_schedule throws in its escape-placement loop), not a slot-0 default.

rec::IndexList contracted_batched

Modes this occurrence’s value contracts in batches at its own node (the legality build_site_of contracted test, mirrored – see NodeRec::contracted_batched). Every entry owns a loop identity: the union-find seeds a reduction component for each one, so a mode no operand is home-sliced on (an all-input reduction) is stamped in reduced_slot like any other, instead of relying on a home-sliced child to create the component.