-
Notifications
You must be signed in to change notification settings - Fork 173
Fix build with LLVM 12 #171
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
Conversation
2ae1f13
to
7ac1f3c
Compare
Signed-off-by: Zoltán Böszörményi <[email protected]>
7ac1f3c
to
869cdb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We avoid adding multiple #if LLVM_VERSION_MAJOR
blocks by moving them to methods in LLVMWrapper
in IGCLLVM
scope, I've posted some comments on this as well as other minor changes.
IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
Outdated
Show resolved
Hide resolved
IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
Outdated
#if LLVM_VERSION_MAJOR >= 12 | ||
I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(), | ||
#else | ||
I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(), | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple DILocation::get()
and DebugLoc::get()
uses in your commit. Each one is wrapped with the #if LLVM_VERSION...
guard; we would like to avoid these.
This is a candidate for a new IGCLLVM::getDILocation()
wrapper method in WrapperLLVM
module.
Have you verified that DILocation::get()
works only since LLVM 12? If it is a case where DebugLoc::get()
is deprecated since LLVM 12, but DILocation::get()
have worked previously we would like to minimize the LLVM version in the #if
guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the earliest version of LLVM that IGC supports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind. I reviewed git changes back to about LLVM 6 or 7 and no substantial changes went into class DILocation
or class MDNode
, so DILocation::get()
should work for those versions. I couldn't confirm it by actually building IGC because I don't have any machine using such an old LLVM version.
@@ -589,12 +589,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi | |||
{ | |||
mpm.add(createPruneUnusedArgumentsPass()); | |||
|
|||
#if LLVM_VERSION_MAJOR < 12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these passes cut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were removed from LLVM 12.
See the removal commits 599955eb56ebad50c12422cb6194a2da770902a0 and 486ed885339d70cd71ee55567282a43cce28d763 in LLVM.
IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Zoltán Böszörményi <[email protected]>
Signed-off-by: Zoltán Böszörményi <[email protected]>
if (DataType->isVectorTy()) | ||
{ | ||
Size *= DataType->getVectorNumElements(); | ||
Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be further simplified as such:
if (auto DataVT = dyn_cast<IGCLLVM::FixedVectorType>(DataType))
{
Size *= DataVT->getNumElements();
}
but a case can be made it's less readable, so let's leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes LGTM.
We don't support merging pull-request directly from our public repository. I will mirror your pull-request internally for it to go through our verification processes and get back to you with results.
Thank you for your contribution Zoltán!
The commit is being delayed by problems with internal verification. I will update this PR with necessary changes when I get it resolved. |
Patches applied from Open PR#171, in order to build with llvm-12. intel/intel-graphics-compiler#171 Error logs: (1) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp:83:56: error: 'unsigned int llvm::VectorType::getNumElements() const' is deprecated: Calling this function via a base VectorType is deprecated. Either call getElementCount() and handle the case where Scalable is true or cast to FixedVectorType. [-Werror=deprecated-declarations] | 83 | NumElts = VTy ? (short)VTy->getNumElements() : 1; Ref:llvm/llvm-project@867de15 (2) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/common/igc_resourceDimTypes.h:69:23: error: 'const class llvm::Module' has no member named 'getTypeByName' | 69 | return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]); Ref: llvm/llvm-project@fe43168 Update copyright year in headers in IGC Compiler and some format updates. Signed-off-by: Naveen Saini <[email protected]> Signed-off-by: Anuj Mittal <[email protected]>
LLVM 12 officially released yesterday, any progress on this? |
ping. What's taking time to even provide feedback? |
Hello, @thiagomacieira, the delay with handling this PR was unfortunately caused by dropping LLVM11/12 upgrade priority internally, which I'm back to working on. @zboszor, your pull-request is now merged, although I had to tweak a couple things, mainly the removed passes and merge conflicts, as well as some small additions like explicit casts to avoid error-on-warning buildbreaks. You can find the commit here: 4bc6b44 Thank you for your contribution! |
Shouldn't this be reopened since it was backed out by 32944e6? |
Patches applied from Open PR#171, in order to build with llvm-12. intel/intel-graphics-compiler#171 Error logs: (1) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp:83:56: error: 'unsigned int llvm::VectorType::getNumElements() const' is deprecated: Calling this function via a base VectorType is deprecated. Either call getElementCount() and handle the case where Scalable is true or cast to FixedVectorType. [-Werror=deprecated-declarations] | 83 | NumElts = VTy ? (short)VTy->getNumElements() : 1; Ref:llvm/llvm-project@867de15 (2) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/common/igc_resourceDimTypes.h:69:23: error: 'const class llvm::Module' has no member named 'getTypeByName' | 69 | return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]); Ref: llvm/llvm-project@fe43168 Update copyright year in headers in IGC Compiler and some format updates. Signed-off-by: Naveen Saini <[email protected]> Signed-off-by: Anuj Mittal <[email protected]>
Patches applied from Open PR#171, in order to build with llvm-12. intel/intel-graphics-compiler#171 Error logs: (1) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp:83:56: error: 'unsigned int llvm::VectorType::getNumElements() const' is deprecated: Calling this function via a base VectorType is deprecated. Either call getElementCount() and handle the case where Scalable is true or cast to FixedVectorType. [-Werror=deprecated-declarations] | 83 | NumElts = VTy ? (short)VTy->getNumElements() : 1; Ref:llvm/llvm-project@867de15 (2) | /build/tmp/work/corei7-64-poky-linux/intel-graphics-compiler/1.0.6410-r0/git/IGC/common/igc_resourceDimTypes.h:69:23: error: 'const class llvm::Module' has no member named 'getTypeByName' | 69 | return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]); Ref: llvm/llvm-project@fe43168 Update copyright year in headers in IGC Compiler and some format updates. Signed-off-by: Naveen Saini <[email protected]> Signed-off-by: Anuj Mittal <[email protected]>
Signed-off-by: Zoltán Böszörményi [email protected]