Closed frantisekz closed 1 year ago
There'll be probably some more errors down the road, I didn't have a chance to dig more into it. Reported what the initial attempt ended up with.
So, for the first batch of errors around getElementType, just changing to getPointerElementType should be enough (ref. https://github.com/intel/intel-graphics-compiler/commit/49f4d4e3e904179bf3a0b880732b92f8bfb2c64a ):
--- a/IGC/WrapperLLVM/include/llvmWrapper/IR/IRBuilder.h
+++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/IRBuilder.h
@@ -334,7 +334,7 @@ namespace IGCLLVM
Func, Args, Bundles, NameStr, InsertBefore);
#else
return llvm::IRBuilder<T, InserterTyDef()>::Create(llvm::cast<llvm::FunctionType>(
- llvm::cast<llvm::PointerType>(Func->getType())->getElementType()),
+ llvm::cast<llvm::PointerType>(Func->getType())->getPointerElementType()),
Func, Args, Bundles, NameStr, InsertBefore);
#endif
}
--
simplifyInstruction is a drop-in replacement for SimplifyInstruction, ref: https://github.com/llvm/llvm-project/commit/b8c2781ff60126b8c7c11ed0dab90d0640a17d4f
There are, of course bunch of more errors down the road:
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/DebugInfo.cpp:112:30: error: no member named 'DW_TAG_base_type' in namespace 'llvm::dwarf'
M.getContext(), dwarf::DW_TAG_base_type, ("ui" + Twine(SizeInBits)).str(),
~~~~~~~^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/DebugInfo.cpp:113:39: error: no member named 'DW_ATE_unsigned' in namespace 'llvm::dwarf'
SizeInBits, 0 /*Align*/, dwarf::DW_ATE_unsigned, DINode::FlagZero);
~~~~~~~^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/DebugInfo.cpp:139:19: error: no member named 'DW_TAG_array_type' in namespace 'llvm::dwarf'
Ctx, dwarf::DW_TAG_array_type, "" /*Name*/, nullptr /*File*/, 0 /*Line*/,
~~~~~~~^
3 errors generated.
In file included from /builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:13:
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/WrapperLLVM/include/llvmWrapper/Support/Alignment.h:86:32: error: no member named 'getAlignment' in 'llvm::LoadInst'
return llvm::Align(Val.getAlignment());
~~~ ^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:102:31: note: in instantiation of function template specialization 'IGCLLVM::getAlign<llvm::LoadInst, 0>' requested here
IGCLLVM::getAlign(OrigLoad),
^
In file included from /builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:13:
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/WrapperLLVM/include/llvmWrapper/Support/Alignment.h:86:32: error: no member named 'getAlignment' in 'llvm::StoreInst'
return llvm::Align(Val.getAlignment());
~~~ ^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp:111:60: note: in instantiation of function template specialization 'IGCLLVM::getAlign<llvm::StoreInst, 0>' requested here
OrigStore.isVolatile(), IGCLLVM::getAlign(OrigStore),
^
2 errors generated.
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:977:24: error: no member named 'getAlignment' in 'llvm::LoadInst'; did you mean 'getAlign'?
auto Align = LI->getAlignment();
^~~~~~~~~~~~
getAlign
/usr/include/llvm/IR/Instructions.h:217:9: note: 'getAlign' declared here
Align getAlign() const {
^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:978:49: error: no viable conversion from 'llvm::Align' to 'unsigned int'
pReplacedInst = B->MASKED_GATHER(pVecSrc, Align);
^~~~~
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/gen_builder.hpp:153:47: note: passing argument to parameter 'Align' here
CallInst* MASKED_GATHER(Value *Ptrs, unsigned Align, Value *Mask = nullptr, Value *PassThru = nullptr, const Twine& Name = "")
^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:992:44: error: no member named 'getAlignment' in 'llvm::StoreInst'; did you mean 'getAlign'?
auto Align = cast<StoreInst>(pInst)->getAlignment();
^~~~~~~~~~~~
getAlign
/usr/include/llvm/IR/Instructions.h:342:9: note: 'getAlign' declared here
Align getAlign() const {
^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:993:63: error: no viable conversion from 'llvm::Align' to 'unsigned int'
pReplacedInst = B->MASKED_SCATTER(pVecSrc, pVecDstPtrs, Align);
^~~~~
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/gen_builder.hpp:158:60: note: passing argument to parameter 'Align' here
CallInst* MASKED_SCATTER(Value *Val, Value *Ptrs, unsigned Align, Value *Mask = nullptr)
^
In file included from /builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:21:
In file included from /builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/PacketBuilder.h:20:
In file included from /builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/WrapperLLVM/include/llvmWrapper/IR/IRBuilder.h:15:
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/WrapperLLVM/include/llvmWrapper/Support/Alignment.h:86:32: error: no member named 'getAlignment' in 'llvm::LoadInst'
return llvm::Align(Val.getAlignment());
~~~ ^
/builddir/build/BUILD/intel-graphics-compiler-igc-1.0.12149.1/IGC/VectorCompiler/lib/GenXOpts/CMPacketize/GenXPacketize.cpp:980:57: note: in instantiation of function template specialization 'IGCLLVM::getAlign<llvm::LoadInst, 0>' requested here
pReplacedInst = B->ALIGNED_LOAD(pVecSrc, IGCLLVM::getAlign(*LI));
^
5 errors generated.
Thank you @frantisekz for you investigation. We have started work on integrating LLVM 15 support in parallel to driving LLVM 14 based IGC conformance up to production level. You should see patches with LLVM 15 oriented fixes appearing in the project in a short while.
@pszymich any updates on the issue?
@pszymich any updates on the issue?
Hi @abderraouf-adjal, there has been some progress over the last 3 weeks, namely commits ce43a7923cb960d3fce5130b0e8de481b5bbb7df and 75a6663f877618fd88d67c7c0ff9e21e6011a243. I'm currently chugging away at the errors related to Align
and dwarf::
enum values, with getPointerElementType
fixes right around the corner. More commits should be getting in over the next 2-3 weeks.
@AGindinson
I took bunch of your commits, applied them on top of the latest tag and tried to get a bit further, adding here my patches (take it with grain of salt, I am python programmer :) ), if it saves you some time:
--- a/IGC/Compiler/Optimizer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.cpp
+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.cpp
@@ -518,7 +518,11 @@ void AlignmentAnalysis::SetInstAlignment(MemSetInst& I)
{
// Set the align attribute of the memset according to the detected
// alignment of its operand.
-#if LLVM_VERSION_MAJOR >= 14
+#if LLVM_VERSION_MAJOR >= 15
+ uint64_t alignment_value = getAlignValue(I.getRawDest());
+ llvm::Align alignment = std::max(I.getDestAlign().valueOrOne(), llvm::Align(alignment_value));
+ I.setDestAlignment(alignment);
+#elif LLVM_VERSION_MAJOR >= 14
uint64_t alignment_value = getAlignValue(I.getRawDest());
llvm::Align alignment = llvm::max(I.getDestAlign(), llvm::Align(alignment_value));
I.setDestAlignment(alignment);
@@ -545,7 +549,11 @@ void AlignmentAnalysis::SetInstAlignment(MemCpyInst& I)
void AlignmentAnalysis::SetInstAlignment(MemMoveInst& I)
{
// Set the align attribute of the memmove based on the minimum alignment of its source and dest fields
-#if LLVM_VERSION_MAJOR >= 14
+#if LLVM_VERSION_MAJOR >= 15
+ uint64_t alignment_value = iSTD::Min(getAlignValue(I.getRawDest()), getAlignValue(I.getRawSource()));
+ llvm::Align alignment = std::max(I.getDestAlign().valueOrOne(), llvm::Align(alignment_value));
+ I.setDestAlignment(alignment);
+#elif LLVM_VERSION_MAJOR >= 14
uint64_t alignment_value = iSTD::Min(getAlignValue(I.getRawDest()), getAlignValue(I.getRawSource()));
llvm::Align alignment = llvm::max(I.getDestAlign(), llvm::Align(alignment_value));
I.setDestAlignment(alignment);
--
--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
@@ -26,7 +26,7 @@ namespace IGCLLVM
{
return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
}
-#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 14
+#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 15
inline static llvm::Pass * createLoopUnrollPass(
int OptLevel = 2, int Threshold = -1, int Count = -1,
int AllowPartial = -1, int Runtime = -1,
--
--- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.cpp
+++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.cpp
@@ -157,7 +157,7 @@ void initializeGenXPasses(PassRegistry ®istry) {
// WRITE HERE MORE PASSES IF IT'S NEEDED;
}
-TargetTransformInfo GenXTargetMachine::getTargetTransformInfo(const Function &F) {
+TargetTransformInfo GenXTargetMachine::getTargetTransformInfo(const Function &F) const {
GenXTTIImpl GTTI(F.getParent()->getDataLayout(), *BC);
return TargetTransformInfo(GTTI);
}
diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
index 8a6f71d..f8d87d3 100644
--- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
+++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
@@ -75,7 +75,7 @@ public:
const TargetSubtargetInfo *getSubtargetImpl(const Function &) const override {
return &Subtarget;
}
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
const GenXSubtarget &getGenXSubtarget() const { return Subtarget; }
};
--
--- a/IGC/VectorCompiler/lib/Driver/Driver.cpp
+++ b/IGC/VectorCompiler/lib/Driver/Driver.cpp
@@ -342,8 +342,6 @@ static void optimizeIR(const vc::CompileOptions &Opts,
PMBuilder.LoopVectorize = false;
PMBuilder.DisableUnrollLoops = false;
PMBuilder.MergeFunctions = false;
- PMBuilder.PrepareForThinLTO = false;
- PMBuilder.PrepareForLTO = false;
PMBuilder.RerollLoops = true;
TM.adjustPassManager(PMBuilder);
--
--- a/IGC/BiFModule/CMakeLists.txt
+++ b/IGC/BiFModule/CMakeLists.txt
@@ -251,7 +251,7 @@ function(igc_bif_build_bc)
add_custom_command(
OUTPUT "${_bcTempFilePath}"
COMMAND "${CMAKE_COMMAND}" -E compare_files ${BiFModule_PREBUILD_SHA_PATH} ${BiFModule_SRC_SHA_PATH} || "${CMAKE_COMMAND}" -E make_directory "${_outBcFileDir}"
- COMMAND "${CMAKE_COMMAND}" -E compare_files ${BiFModule_PREBUILD_SHA_PATH} ${BiFModule_SRC_SHA_PATH} || "$<TARGET_FILE:clang-tool>" -cc1 -x cl -fblocks -fpreserve-vec3-type -opencl-builtins "-triple=${_archTriple}" -w -emit-llvm-bc -o "${_bcTempFilePath}" ${_pchFlags} ${_incFileFlags} ${_includeDirsFlags} ${_defineFlags} ${_options_DEFAULT} ${_options_CL} "${_srcFilePath}"
+ COMMAND "${CMAKE_COMMAND}" -E compare_files ${BiFModule_PREBUILD_SHA_PATH} ${BiFModule_SRC_SHA_PATH} || "$<TARGET_FILE:clang-tool>" -cc1 -x cl -fblocks -fpreserve-vec3-type -opencl-builtins "-triple=${_archTriple}" -Wno-int-conversion -w -emit-llvm-bc -o "${_bcTempFilePath}" ${_pchFlags} ${_incFileFlags} ${_includeDirsFlags} ${_defineFlags} ${_options_DEFAULT} ${_options_CL} "${_srcFilePath}"
DEPENDS clang-tool ${_pchFilePath} ${_incFilePaths} "${_srcFilePath}" ${_dependencies}
COMMENT "BiF: \"${_outBcFileName}\": Compiling OpenCL source: \"${_srcFileName}\""
)
--
This got it to the point where elf_packager call around the half of the compilation crashes with SIGSEGV (tried with and without LTO).
Hi @frantisekz, many thanks for the help! Could you move your patches to a pull-request? We'll review them there. Thanks!
Hi @frantisekz,
Thank you! All patches but the last one seem to match my findings, and I have PRs underway for that (with minor edits to account for LLVM versioning). The BiFModule issue isn't something I've stumbled upon yet, so backing @pszymich's ask for a PR here - it would be all the more helpful.
Hi @frantisekz,
Thank you! All patches but the last one seem to match my findings, and I have PRs underway for that (with minor edits to account for LLVM versioning). The BiFModule issue isn't something I've stumbled upon yet, so backing @pszymich's ask for a PR here - it would be all the more helpful.
Here you go :) : https://github.com/intel/intel-graphics-compiler/pull/262
Hi, commit b86c1bf9124576473c96e05721a59c6470a19c7e solves the original problem. Thanks @AGindinson!
For other LLVM 15 related sightings please create new issue. Thanks!
Thanks @AGindinson and @pszymich , will create issues as I pget further with compilation, here is the current roadblock: https://github.com/intel/intel-graphics-compiler/issues/263
There are bunch of no member named 'getElementType' in 'llvm::PointerType' errors when compiling against LLVM 15:
and error: use of undeclared identifier 'SimplifyInstruction'; did you mean 'simplifyInstruction'?