Hello everyone. I am learning tvm from the tutorials and other online blogs. I still have some questions about the complete compile flow of using it. Sorry this may be a little bit long.
The picture below is the flow in my mind.
In my mind, tvm reads a onnx/pytorch/tf model and turns it into Relay IR(which is just like a graph type without the exact realization code). Then tvm turns the IR into TE, and it will use AutoTVM to do the schedule. With the auto-scheduling result, the TE will be turned into TIR.(In the process it will do many passes). At last, TIR will be transformed into llvm or C or other source languages. We can use the result languages like llvm and transformed it into the instructions that can be run in my hardware(if it has a risc-v cpu).
Now here are my quesions.
-
Autotvm doesn’t need any infomation about my hardware, does it? I read the passage and blogs about Autotvm and they said this part doesn’t need any info about the hardware.
-
Does the llvm I generate have any infomation about my hardware?
-
(Well the third one is the most one I want to ask) In the flow I discribed before, I notice that when we turn llvm to my instructions, I just need a parser or translator(which it is just like a stupid machine and it can even have no need to know what the llvm is doing). Therefore, I think it has no pass or optimize about the program, just a simple translator. If my chip or hardware’s instructions set has one instruction, which is not simple risc-v one.(Here we can take Gemmini as an example, Gemmini has an instruction that control a operation of matrix multiplication, obviously this instruction doesn’t exist in the risc-v’s set). Can autotvm be used to find an optimized result for this operation?
If the answer for 3rd question is YES, how can it do that when autotvm doesn’t know anything about our hardware. If the answer is NO, does it mean I can’t use autotvm for my own backend if the backend has any instruction defined by myself?(Usually, many accelerators have these kinds of instructions) .
Actually I think I haven’t understood the complete compile flow on my own backend(like Gemmini). Hope anyone can help me clear my confusion.