Is adding a customized optimized operator possible?

Hi guys, I’m using TVM to optimize the model from yolov5.

I found that all relay IR operators are written by tir-like code (or it is tir) in the TVM.

From the tutorial, writing an operator by using TE has to represent the calculate information and then create the schedule for it.

And, from the tutorial again, after I load the yolov5 model into TVM and become relay IR, it seems can only use AutoTVM to find the best schedule for the model.

By knowing that AutoTVM has to give the template to each operator, I guess there must be the templates in the TVM source code but I didn’t find them. And the codes in “tvm/python/tvm/topi/transform.py” look like TE but they are different from the TE type in tutorial.

Without finding the TE and schedule of pre-write operators, if I build my own operator by TE and use AutoTVM or AutoScheduler to optimize it (by the tutorial way), is it possible to add it into TVM to replace any of the existing operators?

Thanks a lot.

Say if you are running on an X86 device, the TVM pre-defined operators (compute & its schedule, as in TE) can mostly be found in tvm/python/tvm/topi/x86. Alternatively, you can also find the actual implementations for each operators in the relay graph in tvm/python/tvm/relay/op/strategy/x86.py, from where you can be directed to the definition of these operators.

Hope this helps~

Thanks for your reply.

It seems I can just edit the schedule to optimize operators on the specific development board instead of adding a new one. I’ll try it.

Thanks again!