[BYOC] How to register new target properly to use regular TVM Workflow

I need some help to understand how to register a new target properly.

I started working with TVM a few month ago. I’m currently trying to add an accelerator to TVM using BYOC. I already read the Tutorials and How-To Descriptions on the tvm website, however in my opinion they are only covering parts of the complete picture.

What steps are needed beside the steps below to add a new target called “my_target” so that I can run a “normal” TVM workflow similar to:

target = “my_target”

with tvm.transform.PassContrext(opt_level=3)
      lib = relay.build(mod, target=target, params=params)”

How do I need to register the target globally so it is known by TVM and the Relay Pathes like “transform.MergeComposite” or “transform.AnnotateTarget” are called by the default workflow using “my_target” or alternatively how could I let tvm select to call my custom “partition_for_my_target(mod, params)” function?

I already followed the available how-to-guidelines (sources below) and performed the following steps

  • Register Operations that should be offloaded to the target (python/tvm/relay/op/contrib/my_target.py + add entry to init.py)
  • Create Compiler for my_target (src/relay/backend/contrib/my_target/codegen.cc)
  • Created a Cmake file and add it to CMakeList (cmake/modules/contrib/MY_TARGET.cmake + CMakeList.txt + add Option to cmake/config.cmake)

Does anyone have some information / documentation (additional explanation, forum entries I might have overseen) he could share with me to identify the missing steps?

I would be very glad if I could get some hints from the community.

Best regards,


Some additional information about my sources I uses so far. I already read and viewed:

Hello, have you solved the problem now? I configured it according to your steps, but there are still problems. Are there any follow-up steps?