intel / intel-graphics-compiler

Other
597 stars 155 forks source link

Fails to build with libc++ from LLVM 10 #184

Closed jbeich closed 3 years ago

jbeich commented 3 years ago

Steps to reproduce:

$ export CC=clang10 CXX=clang++10 CXXFLAGS="-stdlib=libc++"
$ cmake -B /tmp/igc_build
$ cmake --build /tmp/igc_build

From error log:

In file included from visa/iga/IGALibrary/IR/DUAnalysis.cpp:30:
In file included from visa/iga/IGALibrary/IR/DUAnalysis.hpp:12:
In file included from visa/iga/IGALibrary/IR/../IR/RegSet.hpp:17:
In file included from visa/iga/IGALibrary/IR/../IR/Kernel.hpp:19:
In file included from visa/iga/IGALibrary/IR/Block.hpp:21:
/usr/include/c++/v1/map:708:17: error: no viable overloaded '='
        __ref() = __v.__get_value();
        ~~~~~~~ ^ ~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__tree:1691:39: note: in instantiation of member function 'std::__1::__value_type<iga::Instruction *, LivePath>::operator=' requested here
            __cache.__get()->__value_ = *__first;
                                      ^
/usr/include/c++/v1/__tree:1648:9: note: in instantiation of function template specialization 'std::__1::__tree<std::__1::__value_type<iga::Instruction *, LivePath>, std::__1::__map_value_compare<iga::Instruction *, std::__1::__value_type<iga::Instruction *, LivePath>, std::__1::less<iga::Instruction *>, true>, std::__1::allocator<std::__1::__value_type<iga::Instruction *, LivePath> > >::__assign_multi<std::__1::__tree_const_iterator<std::__1::__value_type<iga::Instruction *, LivePath>, std::__1::__tree_node<std::__1::__value_type<iga::Instruction *, LivePath>, void *> *, long> >' requested here
        __assign_multi(__t.begin(), __t.end());
        ^
/usr/include/c++/v1/map:1014:21: note: in instantiation of member function 'std::__1::__tree<std::__1::__value_type<iga::Instruction *, LivePath>, std::__1::__map_value_compare<iga::Instruction *, std::__1::__value_type<iga::Instruction *, LivePath>, std::__1::less<iga::Instruction *>, true>, std::__1::allocator<std::__1::__value_type<iga::Instruction *, LivePath> > >::operator=' requested here
            __tree_ = __m.__tree_;
                    ^
visa/iga/IGALibrary/IR/DUAnalysis.cpp:1037:16: note: in instantiation of member function 'std::__1::map<iga::Instruction *, LivePath, std::__1::less<iga::Instruction *>, std::__1::allocator<std::__1::pair<iga::Instruction *const, LivePath> > >::operator=' requested here
            to = from;
               ^
/usr/include/c++/v1/utility:512:11: note: candidate function not viable: no known conversion from 'const std::__1::__value_type<iga::Instruction *, LivePath>::value_type' (aka 'const pair<iga::Instruction *const, LivePath>') to 'const typename conditional<is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value, pair<Instruction *&, LivePath &>, __nat>::type' (aka 'const std::__1::__nat') for 1st argument
    pair& operator=(typename conditional<
          ^
/usr/include/c++/v1/utility:525:11: note: candidate function not viable: no known conversion from 'const std::__1::__value_type<iga::Instruction *, LivePath>::value_type' (aka 'const pair<iga::Instruction *const, LivePath>') to 'typename conditional<is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, pair<Instruction *&, LivePath &>, __nat>::type' (aka 'std::__1::__nat') for 1st argument
    pair& operator=(typename conditional<
          ^
/usr/include/c++/v1/utility:334:62: note: candidate template ignored: disabled by 'enable_if' [with _Tuple = const std::__1::pair<iga::Instruction *const, LivePath> &]
    using _EnableB _LIBCPP_NODEBUG_TYPE = typename enable_if<_Val, bool>::type;
                                                             ^
/usr/include/c++/v1/utility:297:29: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'const pair<const std::__1::__value_type<iga::Instruction *, LivePath>::key_type, std::__1::__value_type<iga::Instruction *, LivePath>::mapped_type>' to 'const pair<iga::Instruction *&, LivePath &>' for 1st argument
struct _LIBCPP_TEMPLATE_VIS pair
                            ^
1 error generated.
In file included from IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:9:
IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:148:8: error: no template named 'unordered_map' in namespace 'std'; did you mean 'unordered_set'?
  std::unordered_map<llvm::Instruction *, llvm::Value *> Replacement;
  ~~~~~^~~~~~~~~~~~~
       unordered_set
/usr/include/c++/v1/unordered_set:382:28: note: 'unordered_set' declared here
class _LIBCPP_TEMPLATE_VIS unordered_set
                           ^
In file included from IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:9:
IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:173:47: error: no viable overloaded operator[] for type 'std::unordered_set<llvm::Instruction *, llvm::Value *>'
      Terminal->replaceAllUsesWith(Replacement[Terminal]);
                                   ~~~~~~~~~~~^~~~~~~~~
IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:222:32: error: no member named 'at' in 'std::__1::unordered_set<llvm::Instruction *, llvm::Value *, std::__1::equal_to<llvm::Instruction *>, std::__1::allocator<llvm::Instruction *> >'
      NewOperand = Replacement.at(llvm::cast<llvm::Instruction>(
                   ~~~~~~~~~~~ ^
IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:231:16: error: no viable overloaded operator[] for type 'std::unordered_set<llvm::Instruction *, llvm::Value *>'
    Replacement[OrigInst.User] = Replace;
    ~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:9:
In file included from IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:21:
In file included from /usr/include/c++/v1/unordered_set:364:
/usr/include/c++/v1/__hash_table:869:5: error: static_assert failed due to requirement 'integral_constant<bool, false>::value' "the specified hash does not meet the Hash requirements"
    static_assert(__check_hash_requirements<_Key, _Hash>::value,
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__hash_table:884:1: note: in instantiation of template class 'std::__1::__enforce_unordered_container_requirements<llvm::Instruction *, llvm::Value *, std::__1::equal_to<llvm::Instruction *> >' requested here
typename __enforce_unordered_container_requirements<_Key, _Hash, _Equal>::type
^
/usr/include/c++/v1/unordered_set:492:30: note: while substituting explicitly-specified template arguments into function template '__diagnose_unordered_container_requirements' 
        static_assert(sizeof(__diagnose_unordered_container_requirements<_Value, _Hash, _Pred>(0)), "");
                             ^
IGC/VectorCompiler/include/vc/Utils/General/InstRebuilder.h:142:7: note: in instantiation of member function 'std::__1::unordered_set<llvm::Instruction *, llvm::Value *, std::__1::equal_to<llvm::Instruction *>, std::__1::allocator<llvm::Instruction *> >::~unordered_set' requested here
class InstructionRebuilder {
      ^
5 errors generated.
In file included from IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:16:
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.h:94:8: error: no template named 'unordered_multimap' in namespace 'std'
  std::unordered_multimap<unsigned, std::pair<PHINode *, unsigned>>
  ~~~~~^
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.h:129:8: error: no template named 'unordered_map' in namespace 'std'
  std::unordered_map<PHINode *, unsigned>
  ~~~~~^
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:41:10: error: cannot initialize return object of type 'llvm::FunctionGroupPass *' with an rvalue of type 'llvm::GenXNumbering *'
  return new GenXNumbering();
         ^~~~~~~~~~~~~~~~~~~
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:46:22: error: cannot initialize object parameter of type 'const llvm::FunctionGroupPass' with an expression of type 'const llvm::GenXNumbering'
  FunctionGroupPass::getAnalysisUsage(AU);
                     ^~~~~~~~~~~~~~~~
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:58:13: error: no matching member function for call to 'getAnalysis'
  Baling = &getAnalysis<GenXGroupBaling>();
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/llvm10/include/lld/Common/../../llvm/PassAnalysisSupport.h:220:21: note: candidate function template not viable: no known conversion from 'llvm::GenXNumbering' to 'const llvm::Pass' for object argument
AnalysisType &Pass::getAnalysis() const {
                    ^
/usr/local/llvm10/include/lld/Common/../../llvm/PassAnalysisSupport.h:248:21: note: candidate function template not viable: requires single argument 'F', but no arguments were provided
AnalysisType &Pass::getAnalysis(Function &F) {
                    ^
In file included from IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:16:
In file included from IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.h:57:
In file included from IGC/VectorCompiler/lib/GenXCodeGen/FunctionGroup.h:33:
In file included from /usr/local/llvm10/include/lld/Common/../../llvm/Pass.h:316:
/usr/local/llvm10/include/lld/Common/../../llvm/PassSupport.h:76:63: error: cannot initialize return object of type 'llvm::Pass *' with an rvalue of type 'llvm::GenXNumbering *'
template <typename PassName> Pass *callDefaultCtor() { return new PassName(); }
                                                              ^~~~~~~~~~~~~~
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.cpp:36:1: note: in instantiation of function template specialization 'llvm::callDefaultCtor<llvm::GenXNumbering>' requested here
INITIALIZE_PASS_END(GenXNumbering, "GenXNumbering", "GenXNumbering", false, false)
^
/usr/local/llvm10/include/lld/Common/../../llvm/PassSupport.h:57:30: note: expanded from macro 'INITIALIZE_PASS_END'
      PassInfo::NormalCtor_t(callDefaultCtor<passName>), cfg, analysis);       \
                             ^
6 errors generated.
In file included from IGC/VectorCompiler/lib/GenXCodeGen/GenXPrinter.cpp:19:
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.h:94:8: error: no template named 'unordered_multimap' in namespace 'std'
  std::unordered_multimap<unsigned, std::pair<PHINode *, unsigned>>
  ~~~~~^
IGC/VectorCompiler/lib/GenXCodeGen/GenXNumbering.h:129:8: error: no template named 'unordered_map' in namespace 'std'
  std::unordered_map<PHINode *, unsigned>
  ~~~~~^
2 errors generated.
trilean commented 3 years ago

I'm running into exactly the same issue using LLVM/clang/libc++ 12.

Did you see https://cgit-beta.freebsd.org/ports/tree/devel/intel-graphics-compiler/files/patch-llvm11 ? It looks a lot like this is related. Haven't tried that patch yet though.

ArchangeGabriel commented 3 years ago

@trilean That’s a different issue, but you indeed need another patch for LLVM 11/12: https://github.com/archlinux/svntogit-community/blob/fc78567191acd6d23c2a46d8f5de331a820584b4/trunk/llvm12-porting.patch Also, see #190 and #191.

pszymich commented 3 years ago

Hello @jbeich,

The #189 PR was merged. Has this issue been resolved?

jbeich commented 3 years ago

I confirm, builds fine now.