Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Conversation

zboszor
Copy link
Contributor

@zboszor zboszor commented Feb 25, 2021

Signed-off-by: Zoltán Böszörményi [email protected]

Signed-off-by: Zoltán Böszörményi <[email protected]>
Copy link
Contributor

@pszymich pszymich left a 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.

Comment on lines 1579 to 1583
#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
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Zoltán Böszörményi added 2 commits February 25, 2021 19:40
Signed-off-by: Zoltán Böszörményi <[email protected]>
Signed-off-by: Zoltán Böszörményi <[email protected]>
Comment on lines 304 to 307
if (DataType->isVectorTy())
{
Size *= DataType->getVectorNumElements();
Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
}
Copy link
Contributor

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.

Copy link
Contributor

@pszymich pszymich left a 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!

@pszymich
Copy link
Contributor

The commit is being delayed by problems with internal verification. I will update this PR with necessary changes when I get it resolved.

kraj pushed a commit to YoeDistro/meta-intel that referenced this pull request Apr 1, 2021
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]>
@lin7sh
Copy link

lin7sh commented Apr 16, 2021

LLVM 12 officially released yesterday, any progress on this?

@thiagomacieira
Copy link
Member

ping. What's taking time to even provide feedback?

@pszymich
Copy link
Contributor

pszymich commented Apr 22, 2021

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
As all pull-requests in this repository, they have to go through our internal workflow. This is why the PR is not merged directly.
If you have any questions or concerns regarding this commit please contact me.

Thank you for your contribution!

@pszymich pszymich closed this Apr 22, 2021
@foutrelis
Copy link

Shouldn't this be reopened since it was backed out by 32944e6?

@ArchangeGabriel
Copy link
Contributor

More generally, can we get insight on what is happening? The patch was commited and reverted twice…
4bc6b44
bcda9e4
1c28c74
32944e6

@zboszor zboszor deleted the llvm12-build-fixes branch September 7, 2021 14:36
daregit pushed a commit to daregit/yocto-combined that referenced this pull request May 22, 2024
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]>
daregit pushed a commit to daregit/yocto-combined that referenced this pull request May 22, 2024
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]>
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

Successfully merging this pull request may close these issues.

6 participants