Skip to main content

fuse_elementwise_operations

Function fuse_elementwise_operations 

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

Fuse element-wise operations that operate on the same tensors

This pass identifies chains of element-wise operations (unary and binary) that can be fused into a single operation, reducing memory traffic and kernel launch overhead.

ยงExamples

Fusing unary operations:

x -> ReLU -> Tanh -> Sigmoid

Can be fused into:

x -> Fused(ReLU, Tanh, Sigmoid)

Fusing element-wise binary operations with the same inputs:

(a, b) -> Add -> Mul(c) -> Sub(d)