Struct accept_any_index¶
Defined in File eval.hpp
Struct Documentation¶
-
struct accept_any_index¶
Builds a custom evaluator (see CacheManager::custom_evaluator_type) that evaluates a subtree in batches over a contracted index, to bound the peak memory of intermediates that carry that index.
For each node it is consulted on, the returned evaluator chooses a batch axis
Kviabatch_axis(node, accept)(declining if none). It asks the backend to partitionKinto contiguous element-range batches of abouttarget_batch_sizeelements each (Result::mode_batches); if that yields at most one batch it declines (so small / unselected indices are left to the standard scheme). Otherwise, for each batch it evaluates the subtree by the standard scheme on a fresh scratch cache, with every leaf carryingKsliced to the batch’s element range, and sums the partial results. This is exact becausesum_K = sum_{batches} sum_{K in batch}, and never materializes the wholeKextent of any intermediate at once.- Param le:
the leaf evaluator (captured).
- Param target_batch_size:
the desired size of each batch in elements (a user knob; no memory model is assumed). Backend-neutral: a tiled backend rounds batch boundaries to tile boundaries, so realized batches are uneven and each covers at least this many elements where possible.
- Param accept:
predicate selecting which contracted indices may be batched (e.g. only those in the auxiliary/RI IndexSpace). Defaults to any.
- Param make_scope_guard:
factory, called with the batch count, returning an RAII object held for the duration of the batched partial contractions; a backend may use it to relax block-sparse screening (scaled by the batch count) so per-batch screening does not drop small contributions that are significant once summed over the full batch axis. Defaults to a no-op (make_no_scope_guard).