apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators

Home Page:https://tvm.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Docs] What versions of LLVM exactly to use?

jchia opened this issue · comments

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_LLVM in the config.cmake or something else. E.g. do we need to do something about and CMAKE_C_COMPILER or CMAKE_CXX_COMPILER to 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.