tvm
tvm copied to clipboard
[Docs] What versions of LLVM exactly to use?
Install from Source
The page at https://tvm.apache.org/docs/install/from_source.html says this about LLVM:
We highly recommend to build with LLVM to enable all the features.
Additions/Changes Requested
But I cannot figure out which versions of LLVM are acceptable. On Ubuntu 20.04, I have clang-12 and llvm-12-dev installed from the official Ubuntu focal-updates repo, as well as clang-19 and libpolly-19-dev installed from http://apt.llvm.org/focal/ llvm-toolchain-focal main.
In my config.cmake, I tried setting USE_LLVM to /usr/lib/llvm-12/bin/llvm-config and /usr/lib/llvm-19/bin/llvm-config for ninja builds. Neither worked.
With 12:
/home/jchia/gh/tvm/src/target/llvm/llvm_module.cc:502:38: error: ‘x86’ is not a namespace-name
502 | using namespace llvm::sys::detail::x86;
With 19:
FAILED: CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_instance.cc.o
ccache /usr/bin/c++ -DDMLC_USE_FOPEN64=0 -DDMLC_USE_LOGGING_LIBRARY="<tvm/runtime/logging.h>" -DNDEBUG -DNDEBUG=1 -DTVM_GRAPH_EXECUTOR_TENSORRT -DTVM_INDEX_DEFAULT_I64=1 -DTVM_KALLOC_ALIGNMENT=64 -DTVM_LLVM_VERSION=190 -DTVM_THREADPOOL_USE_OPENMP=0 -DTVM_USE_LIBBACKTRACE=1 -DUSE_FALLBACK_STL_MAP=0 -DUSE_MICRO_STANDALONE_RUNTIME=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DDMLC_ENABLE_RTTI=0 -I/home/jchia/gh/tvm/include -I/home/jchia/gh/tvm/build/libbacktrace/include -I/home/jchia/gh/tvm/3rdparty/libcrc/include -isystem /home/jchia/gh/tvm/3rdparty/dlpack/include -isystem /home/jchia/gh/tvm/3rdparty/dmlc-core/include -isystem /home/jchia/gh/tvm/3rdparty/rang/include -isystem /home/jchia/gh/tvm/3rdparty/compiler-rt -isystem /home/jchia/gh/tvm/3rdparty/picojson -isystem /home/jchia/gh/tvm/build/crt_config -isystem /usr/local/cuda/include -isystem /usr/lib/llvm-19/include -std=c++17 -faligned-new -O2 -Wall -fPIC -fno-rtti -MD -MT CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_instance.cc.o -MF CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_instance.cc.o.d -o CMakeFiles/tvm_objs.dir/src/target/llvm/llvm_instance.cc.o -c /home/jchia/gh/tvm/src/target/llvm/llvm_instance.cc
/home/jchia/gh/tvm/src/target/llvm/llvm_instance.cc:45:10: fatal error: llvm/Support/Host.h: No such file or directory
45 | #include <llvm/Support/Host.h>
Could you clarify:
- Which versions of LLVM can be used.
- Why exactly LLVM is good/necessary, namely which features are affected and how if LLVM is not used. It's worrying to not know what downsides one is getting for not using LLVM.
- Whether this part is referring to the
USE_LLVMin the config.cmake or something else. E.g. do we need to do something about andCMAKE_C_COMPILERorCMAKE_CXX_COMPILERto point them to clang?
Triage
- needs-triage
- docs
From the llvm github repo, it appears that llvm-17 has llvm/Support/Host.h but llvm-18 and llvm-19 do not.
I met the same error for combination of (TVM v0.15.0, llvm-18). Upgrade tvm and compile TVM v0.18.0 with llvm-18 works fine for me.
This is not even a feature request. There is nothing to "not plan". The issue is just a request for clarification about which LLVM versions exactly are needed. Without documentation on the "Install from Source" page of which versions should work, users just have to try their luck with different versions.
we close the issue due to the staleness, the latest llvm18 should work
Starting with PR https://github.com/apache/tvm/pull/17631 , LLVM should compile on {10,11,12,13,14,15,16,17,18,19,20} .