Class RecordSession¶
Defined in File schedule_pin.hpp
Class Documentation¶
-
class RecordSession¶
Collects the record_term results of an optimizer run and emits them as a RootRecord: hand it to the optimizer via OptimizeOptions::recording. add and relocate are thread-safe.
Records are kept in call order and never dropped. Resolution by pointer (finish(std::vector<Expr const*> const&) and relocate) requires the optimized results to be alive, since a freed address can be reused by a later result (the newest record for an address wins); call-order finish() does not, so per-summand callers may drop each result.
Public Functions
-
explicit RecordSession(std::string root_label)¶
-
RecordSession(RecordSession const&) = delete¶
-
RecordSession &operator=(RecordSession const&) = delete¶
-
void add(Expr const *optimized, eval::schedule::TermRecord rec)¶
thread-safe; appends
rec, and keys it by the optimized summand’s Expr const* (same key as term_batch_axes) for pointer resolution
-
eval::schedule::RootRecord finish(std::vector<Expr const*> const &order) const¶
records in
order(final Sum summand pointers)- Throws:
sequant::Exception – on a pointer with no record, or if two records share a key
-
eval::schedule::RootRecord finish() const¶
records in call order (per-summand callers)
- Throws:
sequant::Exception – if two records share a key
-
void relocate(std::vector<std::pair<Expr const*, Expr const*>> const &moves)¶
Called by the optimizer when it replaces summands by copies (opt::reorder clones each summand into the final Sum): re-keys the record of each
firstpointer onto the matchingsecondpointer. Pointers with no record are skipped. Thread-safe.
-
explicit RecordSession(std::string root_label)¶