Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unable to build TVM with LLVM 19 #17140

Closed
mshr-h opened this issue Jul 8, 2024 · 0 comments · Fixed by #17141
Closed

[Bug] Unable to build TVM with LLVM 19 #17140

mshr-h opened this issue Jul 8, 2024 · 0 comments · Fixed by #17141
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug

Comments

@mshr-h
Copy link
Contributor

mshr-h commented Jul 8, 2024

I attempted to build TVM with LLVM 19 but failed with the following errors. I checked the LLVM docs and PRs and found that it seems like they dropped Module.h include during LLVM 19 development cycle which caused the error. I'll send the PR to fix it.
llvm/llvm-project#96892
https://llvm.org/doxygen/classllvm_1_1Module.html

Expected behavior

TVM successfully compiles

Actual behavior

Got the below error message.

FAILED: CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o 
ccache /usr/bin/c++ -DDMLC_USE_FOPEN64=0 -DDMLC_USE_LOGGING_LIBRARY="<tvm/runtime/logging.h>" -DNDEBUG=1 -DTVM_INDEX_DEFAULT_I64=1 -DTVM_LLVM_HAS_AARCH64_TARGET=1 -DTVM_LLVM_VERSION=190 -DTVM_LOG_DEBUG -DTVM_THREADPOOL_USE_OPENMP=0 -DTVM_USE_LIBBACKTRACE=1 -DUSE_FALLBACK_STL_MAP=0 -DUSE_MICRO_STANDALONE_RUNTIME=1 -DUSE_RELAY_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DDMLC_ENABLE_RTTI=0 -I/home/ubuntu/data/sandbox/_dep/tvm/include -I/home/ubuntu/data/sandbox/_dep/tvm/build/libbacktrace/include -I/home/ubuntu/data/sandbox/_dep/tvm/3rdparty/libcrc/include -isystem /home/ubuntu/data/sandbox/_dep/tvm/3rdparty/dlpack/include -isystem /home/ubuntu/data/sandbox/_dep/tvm/3rdparty/dmlc-core/include -isystem /home/ubuntu/data/sandbox/_dep/tvm/3rdparty/rang/include -isystem /home/ubuntu/data/sandbox/_dep/tvm/3rdparty/compiler-rt -isystem /home/ubuntu/data/sandbox/_dep/tvm/3rdparty/picojson -isystem /home/ubuntu/data/source/llvm-project/llvm/include -isystem /home/ubuntu/data/source/llvm-project/build/include -std=c++17 -faligned-new -O2 -Wall -fPIC  -fno-rtti -MD -MT CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o -MF CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o.d -o CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o -c /home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc: In function ‘tvm::runtime::Module tvm::codegen::BuildAMDGPU(tvm::IRModule, tvm::Target)’:
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:274:9: error: invalid use of incomplete type ‘class llvm::Module’
  274 |     mlib->setTargetTriple(llvm_target->GetTargetTriple());
      |         ^~
In file included from /home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Argument.h:18,
                 from /home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Function.h:25,
                 from /home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:29:
/home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Value.h:47:7: note: forward declaration of ‘class llvm::Module’
   47 | class Module;
      |       ^~~~~~
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:275:9: error: invalid use of incomplete type ‘class llvm::Module’
  275 |     mlib->setDataLayout(tm->createDataLayout());
      |         ^~
/home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Value.h:47:7: note: forward declaration of ‘class llvm::Module’
   47 | class Module;
      |       ^~~~~~
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:277:34: error: invalid use of incomplete type ‘class llvm::Module’
  277 |     for (llvm::Function& f : mlib->functions()) {
      |                                  ^~
/home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Value.h:47:7: note: forward declaration of ‘class llvm::Module’
   47 | class Module;
      |       ^~~~~~
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:289:9: error: invalid use of incomplete type ‘class llvm::Module’
  289 |   module->print(dest_ll, nullptr);
      |         ^~
/home/ubuntu/data/source/llvm-project/llvm/include/llvm/IR/Value.h:47:7: note: forward declaration of ‘class llvm::Module’
   47 | class Module;
      |       ^~~~~~
In file included from /usr/include/c++/13/memory:78,
                 from /home/ubuntu/data/source/llvm-project/llvm/include/llvm/ADT/SmallVector.h:28,
                 from /home/ubuntu/data/source/llvm-project/llvm/include/llvm/ADT/SmallString.h:17,
                 from /home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:26:
/usr/include/c++/13/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = llvm::Module]’:
/usr/include/c++/13/bits/unique_ptr.h:404:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = llvm::Module; _Dp = std::default_delete<llvm::Module>]’
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:273:62:   required from here
/usr/include/c++/13/bits/unique_ptr.h:97:23: error: invalid application of ‘sizeof’ to incomplete type ‘llvm::Module’
   97 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc: In member function ‘virtual llvm::Value* tvm::codegen::CodeGenAMDGPU::CreateStorageSync(const tvm::tir::CallNode*)’:
/home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:205:3: warning: control reaches end of non-void function [-Wreturn-type]
  205 |   }
      |   ^
In file included from /home/ubuntu/data/sandbox/_dep/tvm/include/tvm/tir/stmt_functor.h:31,
                 from /home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_llvm.h:61,
                 from /home/ubuntu/data/sandbox/_dep/tvm/src/target/llvm/codegen_amdgpu.cc:55:
/home/ubuntu/data/sandbox/_dep/tvm/include/tvm/tir/expr_functor.h: In member function ‘R tvm::tir::ExprFunctor<R(const tvm::PrimExpr&, Args ...)>::VisitExprDefault_(const tvm::runtime::Object*, Args ...) [with R = llvm::Value*; Args = {}]’:
/home/ubuntu/data/sandbox/_dep/tvm/include/tvm/tir/expr_functor.h:154:48: warning: control reaches end of non-void function [-Wreturn-type]
  154 |     LOG(FATAL) << "Do not have a default for " << op->GetTypeKey();
      |                                                ^
ninja: build stopped: subcommand failed.

Environment

  • TVM@0fc047c98b1ebf730b8c9aad8b94ddac28a7b34b
  • LLVM@4a9dabee73f79974c69a35af7668c7a7e52e2d7f

Steps to reproduce

Build TVM with LLVM.

Triage

  • backend: rocm
@mshr-h mshr-h added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant