[meta-pre-RFC] Target and tvmc UX Improvements

This is a companion post to three smaller RFCs which I’ve pushed to tvm-rfcs:

This is a series of inter-related RFCs which improve the user experience of tvmc by expanding the --target argument from:

tvmc compile --target="cmsisnn, c -runtime=c -executor=aot --unpacked-api=1"


tvmc compile \
  --target=cmsisnn,c \
  --runtime=c \
  --executor=aot \

Which provides a more straight forward and compelling command line experience for users approaching TVM for the first time. To do this, we need to relocate some pieces within TVM which were contributed with the AOT executor, an example of this is the --executor flag which resides within the Target currently but in practice the effects it has are broader than the Target itself.

Command Line Composition from Internal Registry

The first RFC Command Line Composition from Internal Registry, proposes using the Target registry and populate command line arguments from it, taking:


And allowing compose-able command line arguments:

tvmc --target=c --target-c-mcpu=cortex-m3

This enables users to chain together parameters as they experiment and get feedback from tvmc regarding appropriate inputs for each of the Target options.

Migrating Target Attributes to IRModule

One major problem this surfaces, is having the current executor flag combined with the Target, it blocks a straight forward translation of the TargetKind registry - if the executor is left in place at this point, you’d have nested arguments for the executor such as:

tvmc --target=c --target-c-executor=aot --target-c-unpacked-api=1

And other arguments which don’t necessarily relate to a specific target such as the runtime; in order to rectify this, the second RFC Migrating Target Attributes to IRModule proposes moving the Executor configuration out of the Target and into the attrs on the IRModule (introduced in this PR). By moving to attrs on an IRModule, these correctly apply to all Targets and functions within the compilation.

Command Line Configuration Files

The final RFC Command Line Configuration Files, is designed to help accommodate this increase in arguments and provide a place to collect together standard configurations. So that rather than having to re-type:

tvmc compile \
  --target=cmsisnn,c \
  --runtime=c \
  --executor=aot \

You can instead have a board configuration, or system configuration, such as:

tvmc compile --config=my_board my_model.tflite

Or even better, if you just want to start using tvmc as a new user:

tvmc compile my_model.tflite

How to get involved

I’d suggest replying on the RFC that most interests you directly in tvm-rfcs but your feedback is always welcomed here :smile_cat: