Template Function sequant::eval::dryrun::compute_volatility

Function Documentation

template<class Forest, class IsVolatile>
std::unordered_map<std::size_t, bool> sequant::eval::dryrun::compute_volatility(Forest const &forest, IsVolatile const &is_volatile)

Bottom-up memoized volatility over an evaluation forest: a node is volatile iff is_volatile flags it directly, or (for an internal node) either child is volatile &#8212; the same rule the gated sequant::cache_manager factory applies while building its NV/V frontier (see cache_manager.hpp’s DAG walk). Keyed by TreeNode::hash_value() (rather than the node identity itself) so a caller can classify a CacheManager::recompute_tally() entry &#8212; keyed by the same node identity but not necessarily the same node object &#8212; by its hash.

Parameters:
  • forest – the evaluation forest (a range of eval nodes).

  • is_volatilebool(TreeNode const&): true if the node is intrinsically volatile. Only its value on leaves matters in practice (volatility propagates up), but it is consulted on every node, matching cache_manager's gated factory.

Returns:

a map from hash_value() to whether that value is volatile.