How to generate LLVM IR using tvmc?

Hi, I want to generate the LLVM IR for resnet50-v2-7.onnx using tvmc but I don’t have any idea regarding what arguments must be passed to it to generate LLVM IR?

Any help would really be appreciated.

Hi @kami_10x,

You can use the option --dump-code ll. All the options can be checked with tvmc compile --help.

  --dump-code FORMAT    comma separated list of formats to export the input
                        model, e.g. 'asm,ll,relay'.

Hope that helps.

1 Like

Sure leandron. Thanks for the help.

1 Like

Hi, I got the point but now, I am having another issue, while I try to compile the resnet50, tvmc compile --target "llvm -march=rv64imv -mcpu=generic-rv64" --output resnet50-v2-7-tvm.tar resnet50-v2-7.onnx

It gives the following error: LLVM ERROR: CPU 'generic' is not supported. Use generic-rv64

The LLVM I have is a cross compiler for RISC V. I don’t know why and how I need to explicitly specify the CPU using tvmc to LLVM.

There might be an issue with tvmc when parsing your target.

Can you try using separate arguments --target=llvm --target-llvm-march=rv64imv --target-llvm-mcpu=generic-rv64 rather than a single string target? Let me know if that helps.

1 Like

It still gives the same error message :frowning:

Can you please report a bug here, and we’ll have a look https://github.com/apache/tvm/issues/new

Sure @leandron , I have reported one. Thanks for the guidance.

1 Like