Source code of operator fusion

Hi,

I’d like to study how operator fusion is implemented in TVM. Which parts of the source code I should look into? I found some older posts, but their links were deprecated probably due to code refactoring.

Thank you!

It’s here https://github.com/apache/tvm/blob/main/src/relay/transforms/fuse_ops.cc

Thank you! I have a quick follow-up question. Is there a way to manually disable/control operator fusion in Relay?

No, op fusion in Relay is fixed.

seems you can set the opt_level = 0 to disable op fusion.

We can disable it using the disabled_pass option :

with tvm.transform.PassContext(opt_level=3, disabled_pass=["OpFusion"]):
    lib = relay.build(mod, target=target, params=params)