Replace a specific NNVM Node with a pre-written function, and generate LLVM

I’ve been trying to modify the NNVM build to do this, and my approach has become extremely convoluted and I think that’s a sign that I’m doing something wrong.

I noted that at the end of nnvm.compiler.build the graph enters as NNVM ops, then at the end is a graph of tvm_op.
So I added my custom function as a packed function, modified NodeAttr to have an extra flag noting that it’s my function so I could check for it in CodeGen.

Of-course this meant I also had to modify GraphFusion, etc to make sure it didn’t touch those nodes.
All of this seems overly complicated to me, and I’ve realized that this also means I will never be able to merge updates into my fork without major re-working.

Is there an easier way to do this?

For GraphFusion part, you can change the op’s registered pattern to OPACHE, so GraphFusion would not consider to fuse this op.