Expand description
Operator fusion pass — merges chains of fusible element-wise kernels.
§What is fused
Two consecutive kernel nodes a → b are fusion candidates when:
- Both are marked
fusiblein theirNodeKind::KernelLaunch. adominatesbin the dominator tree (no side path can bypassb).- There is no non-fusible node on any path from
atob. ahas exactly one output buffer shared withb’s inputs (single producer–consumer chain — avoids creating broadcast copies).- Both have the same launch configuration (same total thread count),
or
buses a configuration that is a submultiple ofa’s grid.
When a group is fusible, the pass produces a FusionGroup describing
which original nodes should be merged. The graph itself is not modified
by this pass — the Executor is responsible for lowering the fusion
groups into combined PTX.
§Algorithm
- Run topological analysis to get ASAP order and level info.
- Run dominance analysis.
- Traverse nodes in topological order; greedily extend chains of fusible nodes that satisfy the rules above.
- Return the list of
FusionGroups.
Structs§
- Fusion
Group - A group of nodes that can be merged into a single fused kernel.
- Fusion
Plan - The complete fusion plan produced by the fusion pass.
Functions§
- analyse
- Runs the fusion analysis pass on
graph.