Template Function sequant::cache_manager(meta::eval_node_range auto const&, auto&&, size_t, FootprintOf, double, IsBatchableIndex)

Function Documentation

template<bool force_hash_collisions = false, typename FootprintOf = zero_footprint, typename IsBatchableIndex = never_batchable>
auto sequant::cache_manager(meta::eval_node_range auto const &nodes, auto &&is_volatile, size_t min_repeats = 2, FootprintOf footprint_of = {}, double max_footprint = 0., IsBatchableIndex is_batchable_index = {})

Parameters:
  • nodes – the evaluation forest.

  • 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.

  • min_repeats – minimum NP repeats to cache (default 2).

  • footprint_ofdouble(TreeNode const&): the materialized storage footprint of a node’s result (e.g. its element count or byte size). Consulted only when max_footprint > 0.

  • max_footprint – footprint gate: any node whose footprint_of exceeds this is NOT cached (neither as an NP repeat nor as a P frontier node), so it is recomputed by each consumer instead of being materialized whole and held. This bounds the peak/sustained footprint of huge intermediates that carry a free large-space index (e.g. a half-transformed DF integral with a free projected-AO index), at the cost of recomputation. 0 (default) disables the gate.

  • is_batchable_indexbool(Index const&): an index the runtime batched evaluator slices over (typically the DF/RI auxiliary). A node whose result (canonical) indices contain such an index carries a batchable axis FREE: the evaluator slices it per batch and the single-term optimizer prices it sliced, so caching it whole would hold an intermediate both other components mean to slice. Such nodes are NOT cached (neither NP repeat nor P frontier) &#8212; recomputed (sliced under each consumer’s batch trigger) instead of materialized whole and held. This is the structural counterpart of max_footprint: the batch axis, not a byte threshold, identifies the free-large-index intermediates. The default never_batchable accepts nothing, leaving the veto inert.