0

I've built LLVM from source following these instructions and now I am attempting to build TVM from source according to the instructions in this official website

I do the cmake3 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ .. command and get the following output

-- Build with RPC support...
-- Build with Graph runtime support...
-- Build with Graph runtime debug support...
-- VTA build with VTA_HW_PATH=/research/d1/lj2001/tvm/3rdparty/vta-hw
-- Build VTA runtime with target: sim
-- Found CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
-- Found CUDA_CUDA_LIBRARY=/usr/local/cuda/targets/x86_64-linux/lib/stubs/libcuda.so
-- Found CUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so
-- Found CUDA_NVRTC_LIBRARY=/usr/local/cuda/lib64/libnvrtc.so
-- Found CUDA_CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so
-- Found CUDA_CUBLAS_LIBRARY=/usr/local/cuda/lib64/libcublas.so
-- Found CUDA_CUBLASLT_LIBRARY=/usr/local/cuda/lib64/libcublasLt.so
-- Build with CUDA support
-- Use llvm-config=/research/d1/lj2001/llvm/bin/llvm-config
-- Found LLVM_INCLUDE_DIRS=/research/d1/lj2001/llvm/include
-- Found LLVM_DEFINITIONS=-D_GNU_SOURCE;-D_DEBUG;-D__STDC_CONSTANT_MACROS;-D__STDC_FORMAT_MACROS;-D__STDC_LIMIT_MACROS
...
-- Found TVM_LLVM_VERSION=120
-- Build with LLVM
-- Set TVM_LLVM_VERSION=120
-- Build with contrib.random
-- Build with contrib.sort
-- Build with contrib.hybriddump
-- Git found: /bin/git
-- Found TVM_GIT_COMMIT_HASH=27abfadc55e79e3d40b7de7d4b87eb87a19b7b97
-- Performing Test SUPPORT_CXX14
-- Performing Test SUPPORT_CXX14 - Success
-- Building with TVM Map...
-- Build with thread support...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /research/d1/lj2001/tvm/build

But when I run make -j24 I get the following output:

Scanning dependencies of target tvm_runtime_objs
Scanning dependencies of target tvm_objs
[ 10%] Built target tvm_runtime_objs
Scanning dependencies of target tvm_runtime
[ 10%] Linking CXX shared library libtvm_runtime.so
[ 10%] Built target tvm_runtime
[ 10%] Building CXX object CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_llvm.cc.o
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateBroadcast(llvm::Value*, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:480:82: error: ‘llvm::ElementCount::ElementCount(unsigned int, bool)’ is private within this context
  480 |       llvm::ConstantVector::getSplat(llvm::ElementCount(lanes, /*Scalable=*/false), zero);
      |                                                                                  ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Type.h:24,
                 from /research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:23,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/Support/TypeSize.h:39:3: note: declared private here
   39 |   ElementCount(unsigned Min, bool Scalable) : Min(Min), Scalable(Scalable) {}
      |   ^~~~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecSlice(llvm::Value*, int, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:488:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  488 |   int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
      |                                                                                ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecFlip(llvm::Value*)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:504:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  504 |   int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
      |                                                                                ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecPad(llvm::Value*, int)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:518:80: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  518 |   int num_elems = llvm::cast<llvm::VectorType>(vec->getType())->getNumElements();
      |                                                                                ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘llvm::Value* tvm::codegen::CodeGenLLVM::CreateVecConcat(std::vector<llvm::Value*, std::allocator<llvm::Value*> >)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:532:79: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  532 |     total_lanes += llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
      |                                                                               ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:539:93: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  539 |       const size_t lhs_lanes = llvm::cast<llvm::VectorType>(lhs->getType())->getNumElements();
      |                                                                                             ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:540:93: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  540 |       const size_t rhs_lanes = llvm::cast<llvm::VectorType>(rhs->getType())->getNumElements();
      |                                                                                             ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc: In member function ‘virtual llvm::Value* tvm::codegen::CodeGenLLVM::CreateIntrinsic(const tvm::tir::CallNode*)’:
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:844:72: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  844 |     int l = llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
      |                                                                        ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:848:72: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  848 |     int l = llvm::cast<llvm::VectorType>(v->getType())->getNumElements();
      |                                                                        ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
/research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:853:81: warning: ‘unsigned int llvm::VectorType::getNumElements() const’ is deprecated [-Wdeprecated-declarations]
  853 |     int num_elems = llvm::cast<llvm::VectorType>(v0->getType())->getNumElements() * 2;
      |                                                                                 ^
In file included from /research/d1/lj2001/llvm/include/llvm/IR/Constants.h:31,
                 from /research/d1/lj2001/llvm/include/llvm/IR/Operator.h:19,
                 from /research/d1/lj2001/llvm/include/llvm/Analysis/TargetTransformInfo.h:24,
                 from /research/d1/lj2001/tvm/src/target/llvm/llvm_common.h:33,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.h:49,
                 from /research/d1/lj2001/tvm/src/target/llvm/codegen_llvm.cc:25:
/research/d1/lj2001/llvm/include/llvm/IR/DerivedTypes.h:534:10: note: declared here
  534 | unsigned VectorType::getNumElements() const {
      |          ^~~~~~~~~~
make[2]: *** [CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_llvm.cc.o] Error 1
make[1]: *** [CMakeFiles/tvm_objs.dir/all] Error 2
make: *** [all] Error 2

How do I fix this?

  • In the first place, avoid building from source where possible. LLVM, at least, is available in pre-built packages for many of the more popular operating systems. – John Bollinger Oct 11 '20 at 12:45
  • The error appears to indicate a source-code incompatibility between the version of TVM you are building and the version of LLVM you are building it against. In that case, you would need to figure out from TVM documentation and / or from relative TVM and LLVM release dates which versions work together. You might also find more information on TVM's issue tracker and / or project discussion forums. – John Bollinger Oct 11 '20 at 12:49
  • @JohnBollinger Thanks. I'm taking your advice and am now trying to get the binary of LLVM from here (https://releases.llvm.org/download.html) but my linux is Cent OS 7 with the architecture x86_64 and I can't find the appropriate version for this architecture. – Jang Hyeon Choi Oct 11 '20 at 13:47
  • I acknowledge that I said "in the first place", but that was meant as a *logical* first, not a "do this first". It is not useful to look for a pre-built package before you have an idea of which version you need. And if you cannot avoid building LLVM for your particular target platform then so be it. For the record, though, do look first at the packages provided by your operating system. CentOS 7 does not offer LLVM packages, but CentOS 8 does (these are of course unusable for you; it's just an observation). – John Bollinger Oct 11 '20 at 13:58

0 Answers0