Fusion Node Processing

Only AscBackend and AscBackend nodes can be fused. After fusion, nodes of the AscBackend type are generated if loop axis fusion is supported. If loop axis fusion is not supported, nodes of the FusedAscBackend type are generated.

Node fusion requires AscBackend fusion in the original graph and subgraph fusion of AscGraph under AscBackend. During subgraph fusion, the load and store nodes on AscGraph need to be eliminated. Figure 1 shows the fusion node processing principles.

  • Check whether the two AscBackend nodes can be fused based on whether the loop axes are the same. If loop axis fusion is supported, the two AscGraph nodes of the AscBackend type are fused. (For details about the fusion process, see Figure 2.)
  • If loop axis fusion is not supported, the AscBackend node is placed in a subgraph of a new FusedAscBackend. The backend determines whether to generate multiple kernels or a kernel that contains multiple loops.
  • The FusedAscBackend that does not support loop axis fusion and the AscBackend in the original graph are directly fused into a new FusedAscBackend.
  • The subgraph of FusedAscBackend may contain AscBackend that can be fused in a loop. The framework should fuse the loop axis as much as possible.
Figure 1 Fusion node processing
Figure 2 Loop axis fusion