Operator Fusing

数据结构

class Node {

   Node* inputs;

   Node* outputs;

}

1. 判断父子节点能否fuse,如果能,则push to fusing_array[父,子]。(注意去重)

2. 对于每个父子节点,调用子节点.fuse(父节点)

伪代码:

son.fuse(father) :

  for i in son.inputs:

     if i == father.outputs[0]:

   i.func = father

  son::Make(remake = true);

 

void son::Make() {

  op = i1.func + i2.func;

}

 

void son::Compile() {

  // Compile负责遍历它的节点,如果是func,则继续展开。

}

 

posted @ 2021-12-23 19:28  xuyv  阅读(33)  评论(0编辑  收藏  举报