What's the meaning of stackvm

Hi, I am new to TVM and I am reading tvm source code, I noticed our TVM host target could be either llvm or stackvm, I am confused what is exactly the meaning of stackvm ? I searched the word in https://docs.tvm.ai/index.html and can not find anything useful.

1 Like

I think it is a stack machine for llvm IR, just like jvm for bytecode.You can use llvm as cross-platform target.

target_host : str or :any:`tvm.target.Target`, optional
            Host compilation target, if target is device.
            When TVM compiles device specific program such as CUDA,
            we also need host(CPU) side code to interact with the driver
            to setup the dimensions and parameters correctly.
            target_host is used to specify the host side codegen target.
            By default, llvm is used if it is enabled,
            otherwise a stackvm intepreter is used.

The stackvm will be used if you put an x86 schedule implement onto arm platform. Thus you can run TVM on arm cpu without some op strategy support. For example, NMS only have llvm and cuda support, but you can run it on arm cpu. If there is a mistake, please correct me.

The stackvm is a simple interpreter based vm for host only evaluation. Originally it was used to implement lightweight host side calculations(e.g. calculate the grid and block size of GPU kernel before launch) when LLVM is not available.

In most cases you would want to use LLVM now. However stackvm might still be useful in certain cases if you only want light weight host side code without JITing it

I misunderstood it. It seems that stackvm is designed as a interpreter and can be embeded into relay vm or graph runtime. That’s cool and I am going to change config.cmake to enable stackvm. Thank you!