LegalizeOps: can we register ops legalization like in relay?

Hi, @slai-nick. Thank you for the question. LegalizeOps is for lowering each op to PrimFunc implementation which serves as an internal path as opposed to BYOC which is for an external path.

To offload to your BYOC target, you can define the pattern of your target ops and perform RunCodegen pass as in this test caes: https://github.com/apache/tvm/blob/unity/tests/python/relax/test_codegen_tensorrt.py#L98

This tutorial also walkthroughs how these passes work: [Unity][Tutorial] TVM Unity BYOC

1 Like