-
Notifications
You must be signed in to change notification settings - Fork 1
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
[mlir][mlir-link] Initial skeleton for an MLIR-linker #10
Conversation
This version can link two files. Probably not any two files/functions, but at least two specific test functions with one decl.
return WalkResult::skip(); | ||
}); | ||
|
||
if (!anythingToLink) | ||
// TODO: Consider if there are combinations of Function/GlobalVariable where |
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.
yes no global values will cause the function to proceed even if we can terminate
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.
Is this good or badf?
DenseSet<Operation *> valuesToLink; | ||
std::vector<Operation *> worklist; | ||
// Replace-all-uses-with worklist | ||
std::vector<std::pair<Operation *, Operation *>> rauwWorklist; |
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.
std::vector<std::pair<Operation *, Operation *>> rauwWorklist; | |
std::vector<std::pair<Operation *, Value>> rauwWorklist; |
mlir/lib/Linker/IRMover.cpp
Outdated
} | ||
|
||
if (dst) { | ||
if (auto dstGVL = dyn_cast<GlobalValueLinkageOpInterface>(dst)) |
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.
if (auto dstGVL = dyn_cast<GlobalValueLinkageOpInterface>(dst)) | |
if (auto dgv = dyn_cast<GlobalValueLinkageOpInterface>(dst)) |
mlir/lib/Linker/IRMover.cpp
Outdated
|
||
if (dst) { | ||
if (auto dstGVL = dyn_cast<GlobalValueLinkageOpInterface>(dst)) | ||
if (!dstGVL.isDeclarationForLinkage()) |
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.
if (!dstGVL.isDeclarationForLinkage()) | |
if (!(dgv.isDeclaration() || dgv.hasAvailableExternallyLinkage()) |
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.
isDeclarationForLinkage
is not isDeclarationForLinker
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.
Could you please clarify? I don't follow.
return LazilyAdded; | ||
} | ||
|
||
Operation *MLIRLinker::copyGlobalVariableProto(Operation *src, |
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.
I think we will do this as dialect interface. Where dialect will specify how to copy globals function etc.
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.
In that case, I think we'll have to have two separate phases (at least that is how it is done in llvm-linker), one for creating a prototype/declaration and one for copying the body.
This version can link two files. Probably not any two files/functions, but at least two specific test functions with one decl.