[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,

Martin


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?

Sorry for my late reply. Yes I solved the problem, unfortunately I don’t have access to all files right now. Just a few information to add to my previous steps:

  • Make sure that you set the Environment Variables are sourced as described in the Setup https://tvm.apache.org/docs/install/from_source.html under the Headline “Python Package Installation” > “Methode 1”

  • If you use the CCodegen as basis for your device, make sure that you rename all classes properly to avoid name conflicts in the namespace

Should I remember further points I will add it later.

Hey Martin, Could you please share the steps how to register a new target for our own accelerator? Can you share the reference document if any?

Thanks

hei martin,could you give more step about it.Thanks!