Template Struct NameRecyclingOptions¶
Defined in File name_recycling.hpp
Struct Documentation¶
-
template<typename TreeNode>
struct NameRecyclingOptions¶ Options for recycle_intermediate_names.
Public Members
- SEQUANT_DESIGNATED_INIT_ONLY
-
std::function<bool(std::size_t, const TreeNode&)> is_recyclable¶
Whether the result of the tree at the given position is an intermediate whose name may be changed (and recycled). Required.
-
std::function<bool(std::size_t, const TreeNode&)> starts_new_value = {}¶
Whether the (recyclable) tree at the given position starts a new value of its result, i.e. overwrites rather than adds to a previous value of the same object. If not provided, only the first occurrence of an object as a result starts a new value and later occurrences add to it.
-
ShapeCompatibility shape_compatibility = ShapeCompatibility::ExactBlock¶
Shape compatibility required for recycling a name.
-
std::function<bool(const TreeNode &previous, const TreeNode ¤t)> extra_compatible = {}¶
Additional requirement for the value defined by the second tree to take over the name of the value defined by the first tree (e.g. matching IRREPs or batching)
-
std::function<bool(const TreeNode &definition, const Expr &named)> name_acceptable = {}¶
Additional requirement for a name (given as the tensor or variable it would be assigned to) to be used for the value defined by the given tree (e.g. to keep names unique across IRREPs of values in other groups)
-
std::vector<std::pair<std::size_t, std::size_t>> repeated_regions = {}¶
Ranges [begin, end) of tree positions that are executed repeatedly (e.g. inside a loop). A value that is used inside such a range but is defined outside of it, stays alive until the end of the range.
Warning
Loop-carried uses (a use inside such a range that precedes a redefinition of the same intermediate in that range, i.e. that reads the value from the previous iteration) are not supported: such a use is associated with the definition preceding it in the given order. This situation is not detected.
-
IntermediateNamePool::LabelGenerator label_gen = IntermediateNamePool::default_label_generator()¶
Generates names for intermediates from the basename (label without trailing digits) of their original label and a counter
-
detail::TensorNormalizer normalize = {}¶
If set, tensors are identified by the form produced by this normalizer rather than by their form in the trees. This is needed if tensors are later rewritten (e.g. by a code generator reordering their slots) such that tensors of different blocks may end up referring to the same object.