@sho no problem, apologies if this is a bit confusing.
There are actually two roles LLVM could play in TVM:
- To build TVM from source
- As a Target backend (e.g.
relay.build(..., target="llvm")
), in which case TVM links against LLVM (e.g. LLVM is a static library) at compile time, and TVM then contains the code-generation pieces of LLVM and is in turn able to emit machine code to implement a model, just like LLVM does.
This is correct. TVM’s compilation flow is:
- import models into Relay
- “lower” Relay into TIR
- “codegen” TIR to match the target.
// Target("llvm") or Target("c") mostly matters here
So the final codegen step is where TIR is translated into some type of machine code. That could be LLVM’s Intermediate Representation (which we can generate when TVM is linked against LLVM–like in kind #2 above), C source code, CUDA code, or other types.