Skip to main content

fuse_map_reduce

Function fuse_map_reduce 

Source
pub fn fuse_map_reduce(graph: &mut EinsumGraph) -> Result<FusionStats, IrError>
Expand description

Fuse reduction operations with their producers when possible

This pass identifies patterns where a reduction operation directly follows an element-wise operation on the same data. In such cases, the operations can often be fused to avoid materialization of intermediate results.

ยงExample

x -> Map(f) -> Sum

Can be fused into:

x -> MapReduce(f, Sum)