intel / intel-graphics-compiler

Other
606 stars 158 forks source link

Build failure with some deprecated declarations #152

Closed ArchangeGabriel closed 4 years ago

ArchangeGabriel commented 4 years ago

I had to turn off -Werror to build, because:

/build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.cpp: In member function ‘void IGC::GenSpecificPattern::visitBinaryOperator(llvm::BinaryOperator&)’:
/build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.cpp:2323:74: warning: ‘static llvm::VectorType* llvm::VectorType::get(llvm::Type*, unsigned int)’ is deprecated [-Wdeprecated-declarations]
 2323 |                 VectorType* vec4 = VectorType::get(builder.getInt8Ty(), 4);
      |                                                                          ^
In file included from /usr/include/llvm/IR/Constants.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataTraits.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataApiUtils.h:29,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataApi.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataUtilsWrapper.h:28,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.hpp:29,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.cpp:78:
/usr/include/llvm/IR/DerivedTypes.h:552:20: note: declared here
  552 | inline VectorType *VectorType::get(Type *ElementType, unsigned NumElements) {
      |                    ^~~~~~~~~~
/build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.cpp:2375:71: warning: ‘static llvm::VectorType* llvm::VectorType::get(llvm::Type*, unsigned int)’ is deprecated [-Wdeprecated-declarations]
 2375 |             VectorType* vec2 = VectorType::get(builder.getInt16Ty(), 2);
      |                                                                       ^
In file included from /usr/include/llvm/IR/Constants.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataTraits.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataApiUtils.h:29,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataApi/MetaDataApi.h:31,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/MetaDataUtilsWrapper.h:28,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.hpp:29,
                 from /build/intel-graphics-compiler/src/intel-graphics-compiler-igc-1.0.5353/IGC/Compiler/CustomSafeOptPass.cpp:78:
/usr/include/llvm/IR/DerivedTypes.h:552:20: note: declared here
  552 | inline VectorType *VectorType::get(Type *ElementType, unsigned NumElements) {
      |                    ^~~~~~~~~~

I suppose this is new in LLVM 11.

lwesiers commented 4 years ago

Are you building IGC with LLVM11?

ArchangeGabriel commented 4 years ago

Yes, I implied so just above, sorry if it wasn’t clear.

pszymich commented 4 years ago

Hello Bruno,

We currently don't fully support building IGC with LLVM 11, it is still in the development stage. I can see that you try to build igc-1.0.5353 release, this will not build with LLVM 11.

If you wish to fix the errors you mention locally, you will have to change llvm::VectorType::get() method to IGCLLVM::FixedVectorType::get(). This function is declared in DerivedTypes.h header in our WrapperLLVM module, which provides backwards compatibility with previous LLVM versions. These changes are already committed to the repository on revision https://github.com/intel/intel-graphics-compiler/commit/2e257d4149901c73e6ede0552e07cee10d7a809b.

The latest IGC build that I've tested building with LLVM 11 is on commit https://github.com/intel/intel-graphics-compiler/commit/7d11ff43f42564fdfe2753b4d008abfd56ec9671. You can use this revision to build IGC with LLVM 11. Please note that we don't provide production quality on non-release builds.

ArchangeGabriel commented 4 years ago

@pszymich Thanks for pointing to this new commit, I’ll use it in my build. :)

As I’m building for a distro (Arch Linux), I have to try to stay on releases, while moving with our dependencies. We added LLVM 11 recently, for now it is in our [staging] area, but it will soon enter [testing] and I needed a LLVM 11 build before that, so I went ahead by removing -Werror but will now proceed with the patch. ;)