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

Build and test LLVM/MLIR Failed #7984

Open
quanchenliu opened this issue Dec 13, 2024 · 1 comment
Open

Build and test LLVM/MLIR Failed #7984

quanchenliu opened this issue Dec 13, 2024 · 1 comment

Comments

@quanchenliu
Copy link

What I did before:

$ git clone [email protected]:llvm/circt.git
$ cd circt
$ git submodule init
$ git submodule update
$ mkdir llvm/build
$ cd llvm/build
$ cmake -G Ninja ../llvm \
    -DLLVM_ENABLE_PROJECTS="mlir" \
    -DLLVM_TARGETS_TO_BUILD="host" \
    -DLLVM_ENABLE_ASSERTIONS=ON \
    -DCMAKE_BUILD_TYPE=DEBUG \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
$ ninja
[1415/4773] Building CXX object lib/Transforms/Vectoriz...iles/LLVMVectorize.dir/SandboxVectorizer/Legality.cpp.o
In file included from /home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Legality.cpp:9:
/home/lqc/circt/llvm/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h:115:33: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  115 |   [[maybe_unused]] ResultReason Reason;
      |                                 ^~~~~~
[1417/4773] Building CXX object lib/Transforms/Vectoriz...ectorize.dir/SandboxVectorizer/Passes/BottomUpVec.cpp.o
In file included from /home/lqc/circt/llvm/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h:21,
                 from /home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp:9:
/home/lqc/circt/llvm/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h:115:33: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  115 |   [[maybe_unused]] ResultReason Reason;
      |                                 ^~~~~~
[1418/4773] Building CXX object lib/Transforms/Vectoriz...ir/SandboxVectorizer/SandboxVectorizerPassBuilder.cpp.o
In file included from /home/lqc/circt/llvm/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h:21,
                 from /home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.cpp:3:
/home/lqc/circt/llvm/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Legality.h:115:33: warning: ‘maybe_unused’ attribute ignored [-Wattributes]
  115 |   [[maybe_unused]] ResultReason Reason;
      |                                 ^~~~~~
[1433/4773] Building CXX object lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanUtils.cpp.o
In file included from /home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:10:
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h: In instantiation of ‘bool llvm::VPlanPatternMatch::detail::CheckTupleElements(const TupleTy&, Fn, std::index_sequence<_Idx ...>) [with TupleTy = std::tuple<>; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>; long unsigned int ...Is = {}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int>]’:
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:161:28:   required from ‘bool llvm::VPlanPatternMatch::detail::all_of_tuple_elements(const TupleTy&, Fn) [with TupleTy = std::tuple<>; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:197:38:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPRecipeBase*) const [with Ops_t = std::tuple<>; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPCanonicalIVPHIRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:184:25:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPValue*) const [with Ops_t = std::tuple<>; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPCanonicalIVPHIRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:198:45:   required from ‘llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)> [with auto:28 = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:155:12:   required from ‘bool llvm::VPlanPatternMatch::detail::CheckTupleElements(const TupleTy&, Fn, std::index_sequence<_Idx ...>) [with TupleTy = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>; long unsigned int ...Is = {0, 1}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0, 1>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:161:28:   required from ‘bool llvm::VPlanPatternMatch::detail::all_of_tuple_elements(const TupleTy&, Fn) [with TupleTy = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:197:38:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPRecipeBase*) const [with Ops_t = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPScalarIVStepsRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:184:25:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPValue*) const [with Ops_t = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPScalarIVStepsRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:29:17:   required from ‘bool llvm::VPlanPatternMatch::match(Val*, const Pattern&) [with Val = llvm::VPValue; Pattern = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:58:18:   required from here
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:154:48: warning: parameter ‘P’ set but not used [-Wunused-but-set-parameter]
  154 | bool CheckTupleElements(const TupleTy &Ops, Fn P, std::index_sequence<Is...>) {
      |                                             ~~~^
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h: In instantiation of ‘bool llvm::VPlanPatternMatch::detail::CheckTupleElements(const TupleTy&, Fn, std::index_sequence<_Idx ...>) [with TupleTy = std::tuple<>; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:29, unsigned int)>; long unsigned int ...Is = {}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int>]’:
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:161:28:   required from ‘bool llvm::VPlanPatternMatch::detail::all_of_tuple_elements(const TupleTy&, Fn) [with TupleTy = std::tuple<>; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:29, unsigned int)>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:203:41:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPRecipeBase*) const [with Ops_t = std::tuple<>; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPCanonicalIVPHIRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:184:25:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPValue*) const [with Ops_t = std::tuple<>; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPCanonicalIVPHIRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:198:45:   required from ‘llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)> [with auto:28 = llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:155:12:   required from ‘bool llvm::VPlanPatternMatch::detail::CheckTupleElements(const TupleTy&, Fn, std::index_sequence<_Idx ...>) [with TupleTy = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>; long unsigned int ...Is = {0, 1}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0, 1>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:161:28:   required from ‘bool llvm::VPlanPatternMatch::detail::all_of_tuple_elements(const TupleTy&, Fn) [with TupleTy = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; Fn = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>::match(const llvm::VPRecipeBase*) const::<lambda(auto:28, unsigned int)>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:197:38:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPRecipeBase*) const [with Ops_t = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPScalarIVStepsRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:184:25:   required from ‘bool llvm::VPlanPatternMatch::Recipe_match<Ops_t, Opcode, Commutative, RecipeTys>::match(const llvm::VPValue*) const [with Ops_t = std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >; unsigned int Opcode = 0; bool Commutative = false; RecipeTys = {llvm::VPScalarIVStepsRecipe}]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:29:17:   required from ‘bool llvm::VPlanPatternMatch::match(Val*, const Pattern&) [with Val = llvm::VPValue; Pattern = llvm::VPlanPatternMatch::Recipe_match<std::tuple<llvm::VPlanPatternMatch::Recipe_match<std::tuple<>, 0, false, llvm::VPCanonicalIVPHIRecipe>, llvm::VPlanPatternMatch::specific_intval<0> >, 0, false, llvm::VPScalarIVStepsRecipe>]’
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp:58:18:   required from here
/home/lqc/circt/llvm/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h:154:48: warning: parameter ‘P’ set but not used [-Wunused-but-set-parameter]
[3145/4773] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
FAILED: lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/lqc/circt/llvm/build/lib/Passes -I/home/lqc/circt/llvm/llvm/lib/Passes -I/home/lqc/circt/llvm/build/include -I/home/lqc/circt/llvm/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g  -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -MF lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o.d -o lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o -c /home/lqc/circt/llvm/llvm/lib/Passes/PassBuilder.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[3164/4773] Building CXX object lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86ISelLowering.cpp.o
ninja: build stopped: subcommand failed.

My Configuration:

Operation System:Ubuntu-22.04(WSL2)
cmake version 3.22.1
Python 3.10.12
zlib 1.3.1
GNU Make 4.3
PyYAML 6.0.2

My Question
First, I would like to know if the content in the "Setting this up" section of the README needs to be executed in order. Specifically, does the LLVM/MLIR build and test need to be completed first before successfully building CIRCT?
Additionally, I would like to ask how to resolve issues encountered when executing the ninja command.

@maerhart
Copy link
Member

First, I would like to know if the content in the "Setting this up" section of the README needs to be executed in order. Specifically, does the LLVM/MLIR build and test need to be completed first before successfully building CIRCT?

Yes, the steps need to be followed in order. CIRCT links against LLVM/MLIR and thus the libraries must be in the llvm build folder at the time you compile CIRCT.

The kind of failure you're getting is often the result of running out of memory (Linux just kills apps if you use too much memory). If you're using ld as linker that might be the problem. I'd suggest to use lld or any other linker.
You can also try adding the -j 1 flag to ninja to only compile on one thread, thus reducing peak memory consumption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants