-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Populate the llvm::GlobalVariable ELF section, with the attribute from the ObjectAttrs #117246
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
@llvm/pr-subscribers-mlir-gpu @llvm/pr-subscribers-mlir Author: Renaud Kauffmann (Renaud-K) ChangesFull diff: https://github.com/llvm/llvm-project/pull/117246.diff 1 Files Affected:
diff --git a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
index b023c4c126da30..3aeadeb283ff69 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
@@ -121,6 +121,13 @@ LogicalResult SelectObjectAttrImpl::embedBinary(
new llvm::GlobalVariable(*module, binary->getType(), true,
llvm::GlobalValue::LinkageTypes::InternalLinkage,
binary, getBinaryIdentifier(op.getName()));
+
+ if (object.getProperties()) {
+ if (auto section = mlir::dyn_cast_or_null<mlir::StringAttr>(
+ object.getProperties().get("section"))) {
+ serializedObj->setSection(section.getValue());
+ }
+ }
serializedObj->setLinkage(llvm::GlobalValue::LinkageTypes::InternalLinkage);
serializedObj->setAlignment(llvm::MaybeAlign(8));
serializedObj->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::None);
|
Do we have a way to have a lit test for it? |
Populating it would only happen downstream, so I am not sure how we would write a test for it. |
Maybe you can add smth here |
I see. Nice. |
Thanks Renaud! This look good to me. |
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.
Approved, thanks!
#119440) This is a follow-up of #117246. I thought then it would be easy to edit a DictionaryAttr but it turns out that these attributes are immutable and need to be passed during the construction of the gpu.binary Op. The first commit was using the NVVMTargetAttr to pass the information. After feedback from @fabianmcg, this PR now passes the information through a new option of the gpu-module-to-binary pass. Please add reviewers, as you see fit.
No description provided.