-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
[CGData] Stable Function Map #112662
[CGData] Stable Function Map #112662
Conversation
e7272c3
to
060a23e
Compare
a61dd8e
to
d3c35a7
Compare
060a23e
to
7d9dc40
Compare
These define the main data structures to represent stable functions and group similar functions in a function map. Serialization is supported in a binary or yaml form.
7d9dc40
to
8e10ed3
Compare
cc. @nocchijiang |
void StableFunctionMap::finalize() { | ||
Finalized = true; | ||
|
||
for (auto It = HashToFuncs.begin(); It != HashToFuncs.end(); ++It) { |
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.
Just want to point out this this iterates over a DenseMap
, which is not deterministic. Hopefully the iteration order doesn't matter. But if they are truly independent, can we use llvm::parallelFor()
? I only see that used in lld
, so I'm not sure it makes sense here.
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.
As an entry can be deleted on the fly, we can't use a parallel loop.
Do you have any comment on this direction? |
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.
Overall approach, lgtm
}; | ||
|
||
/// An efficient form of StableFunction for fast look-up | ||
struct StableFunctionEntry { |
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.
Should this be an internal implementation within StableFunctionMap
? It doesn't seem like it could be defined without a StableFunctionMap calculating the Ids, right? We could always make this public again if there is a use case for it.
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 is a use case In the StableFunctionMapRecord
. However, I agree that the insert(FuncEntry)
method should remain private, as its usage should be restricted to within this context. So, I have utilized the friend keyword while keeping it private, and removed the inapplicable test case.
/// Insert a `StableFunctionEntry` into the function map directly. This | ||
/// method assumes that string names have already been uniqued and the | ||
/// `StableFunctionEntry` is ready for insertion. | ||
void insert(std::unique_ptr<StableFunctionEntry> FuncEntry) { |
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 StableFunctionEntry
is private, then this method can be private too.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/151/builds/3027 Here is the relevant piece of the build log for the reference
|
These define the main data structures to represent stable functions and group similar functions in a function map. Serialization is supported in a binary or yaml form. Depends on llvm#112638. This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.
These define the main data structures to represent stable functions and group similar functions in a function map. Serialization is supported in a binary or yaml form. Depends on llvm#112638. This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.
This introduces a new cgdata format for stable function maps. The raw data is embedded in the __llvm_merge section during compile time. This data can be read and merged using the llvm-cgdata tool, into an indexed cgdata file. Consequently, the tool is now capable of handling either outlined hash trees, stable function maps, or both, as they are orthogonal. Depends on #112662. This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.
This introduces a new cgdata format for stable function maps. The raw data is embedded in the __llvm_merge section during compile time. This data can be read and merged using the llvm-cgdata tool, into an indexed cgdata file. Consequently, the tool is now capable of handling either outlined hash trees, stable function maps, or both, as they are orthogonal. Depends on llvm#112662. This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.
These define the main data structures to represent stable functions and group similar functions in a function map.
Serialization is supported in a binary or yaml form.
Depends on #112638.
This is a patch for https://discourse.llvm.org/t/rfc-global-function-merging/82608.