Unable to install TVM along with LLVM on Windows

I’m trying to build and install TVM package on Windows Machine.

I’ve followed this steps for installation:

git clone --recursive https://github.com/dmlc/tvm
mkdir build
cp cmake/config.cmake build

Building LLVM from source:

mkdir mybuilddir
cd mybuilddir
cmake …
cmake --build .
cmake --build . --target install

The build is successful with llvm-config installed in C:\Program Files (x86)\LLVM\bin. And, I add this to the Windows Path variable

I then modify build/config.cmake to add set(USE_LLVM ON)

Then, I’m trying to build TVM using these commands:

mkdir build
cd build
cmake -G “Visual Studio 15 2017 Win64” -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=“Release” …

and, I’m getting this error:

– Build with RPC support…
– Build with Graph runtime support…
CMake Error at cmake/util/FindLLVM.cmake:21 (list):
list sub-command REMOVE_ITEM requires list to be present.
Call Stack (most recent call first):
cmake/modules/LLVM.cmake:5 (find_llvm)
CMakeLists.txt:171 (include)

– Build with LLVM
– Set TVM_LLVM_VERSION=00
– Configuring incomplete, errors occurred!

Apologies for this beginner level question, but how do I fix this?

I did add this: message(STATUS “LLVM_LIBS” ${LLVM_LIBS}) and it returned me an empty string for LLVM_LIBS.

Try pointing LLVM_DIR to llvm/build/lib/cmake/llvm

That worked, thank you. But, I’m getting another error when building with visual studio .sln file.

I build the nnvm by running the same script under the nnvm folder with:

cd nnvm
cmake -G “Visual Studio 14 2015 Win64” -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=“Release” …

And, I build the tvm.sln file. I get this error:

LNK1181 cannot open input file ‘…\llvm-6.0.1.src\mybuilddir\Release\lib\LLVMDemangle.lib’ (tvm Project)

LNK1181 cannot open input file ‘Release\tvm.lib’ (tvm_topi project)

LNK1181 cannot open input file ‘Release\tvm.lib’ (nnvm_compiler project)

no, you don’t build nnvm explicitly. nnvm should be built with tvm.sln.

cd tvm
mkdir build
cmake … # set LLVM_DIR, etc.
open tvm.sln and build

These should be enough to build tvm.lib, tvm_runtime.lib, nnvm_compiler.lib etc.

I tried the steps you mentioned without building nnvm explicitly. And, I get the same errors.

LNK1181 cannot open input file ‘…\llvm-6.0.1.src\mybuilddir\Release\lib\LLVMDemangle.lib’ (tvm Project)

LNK1181 cannot open input file ‘Release\tvm.lib’ (tvm_topi project)

LNK1181 cannot open input file ‘Release\tvm.lib’ (nnvm_compiler project)

Do you think if there is problem with my LLVM build?

I don’t know, but make sure your path is correct.

Hi,

Did you found the answer?
I mean was the problem with your LLVM build?

Hi

Do you mean something like this?
cmake -G “Visual Studio 14 2015 Win64” -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=“Release” -DLLVM_DIR=llvm/build/lib/cmake/llvm …

or like this?
cmake -G “Visual Studio 14 2015 Win64” -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=“Release” -DLLVM_DIR=F:\soft\llvm-6.0.0.src\build\lib\cmake\llvm …

yes, either way should be fine.

Thank you.

I had linker error but I fixed the issue. Now I have one problem:
“my Release folder is empty and I get Release/tvm.lib cannot be opened”
What can I do?