Template Function sequant::opt::eliminate_common_subexpressions_batched¶
Defined in File common_subexpression_elimination.hpp
Function Documentation¶
-
template<std::ranges::range VectorLike, std::regular_invocable<ExprPtr> Transformer, bool force_hash_collisions = false>
BatchedCSEResult sequant::opt::eliminate_common_subexpressions_batched(VectorLike &expr_trees, std::span<const std::optional<std::vector<Index>>> expr_batch_indices, const Transformer &expr_to_tree, CSEOptions<std::ranges::range_value_t<VectorLike>> opts = {})¶ Like eliminate_common_subexpressions, but takes into account that expressions can be computed in batches over different sets of indices. Consecutive expressions that share the same batch indices are processed together, such that subexpressions are only shared among expressions that are batched identically.
- Parameters:
expr_trees – Container (vector-like) of evaluation trees
expr_batch_indices – The batch indices of each of the given trees. An empty optional means that the tree has no well-defined set of batch indices, which causes it to be processed on its own, without batching. Must have as many elements as there are trees on input.
expr_to_tree – See eliminate_common_subexpressions
opts – See eliminate_common_subexpressions. The batch indices are taken from
expr_batch_indicesinstead of from the options.