Will TVM suppurt GCC as an optional CPU compiler?



I notice that TVM only suppurt LLVM for CPU backend at present. While I have a processor whose ISA was designed by our group and only have GCC as the cross compiler. How could I use GCC as the TVM basic compiler for our processor? Could TVM dump the C source code using some functions like get_source()? Or will TVM suppurt GCC as an optional CPU compiler expect for LLVM in the future? Thanks.


TVM generate LLVM IR and Source Code, the first for host/CPU and the second for GPU. The internal pass optimize on LLVM IR. So I think it would be better to get a LLVM backend for your platform. I just study TVM a few weeks, maybe I’m wrong.:stuck_out_tongue_closed_eyes:


TVM do have features to directly generate source code. Specifically, CUDA/OpenCL code is generated in the form of source code. We will need to subclass https://github.com/dmlc/tvm/blob/master/src/codegen/codegen_c.h that implements host side code generation to add a codegen_c_host.cc. You could reference other implementations that generate things like OpenCL.

The main reason we use LLVM instead of C source to generate host code is that LLVM have standard complete vector type support(in a C compiler there are no SIMD intrinsics so far, but ARM’s SIMD convention is promising).

Contribution is welcomed


If generate LLVM IR, we could leverage LLVM IR’s optimization and do more control about instructions. I don’t find the advantages to generate C source code, which will make the optimization couldn’t be controlled, because you can not control’s GCC’s behaviour.


I do agree that LLVM is the best and default for code generation. My answers are just reflects the question technically as seems there are backends where llvm is unavailable but c compiler is

How can I add a new target for tvm?