-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[BOLT] Add writing support for Linux kernel ORC #80950
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
Depends on #80922 to work. |
Update ORC information based on the new code layout and emit corresponding ORC sections for the Linux kernel.
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.
Several comments but this looks fine after reading about ORC
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.
LGTM, no need to go through an additional round for me.
// Older kernels could contain unsorted tables in the file as the tables were | ||
// sorted during boot time. | ||
llvm::sort(ORCEntries); | ||
outs() << "BOLT-INFO: parsed " << NumORCEntries << " ORC entries\n"; |
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.
Sorry about late comment but we should be using BC.outs()
after #81524
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.
LinuxKernelRewriter
was still using old streams. #82195 includes the change.
Hi @maksfb Thanks for your great work! I'm newbie here and have a naive question: this is designed to work with the sampling mode, not instrumentation mode. Right? |
Hi @whentojump, in theory, it shouldn't matter how the profile for the kernel was collected. At the moment though, we don't have instrumentation support, so you have to use sampling. For now, not all patches are in the main branch. Originally, there will be a constraint on the kernel config and version than are supported by BOLT. Once I upstream the first set, I'll publish the instructions. |
Thanks for the explanations! I look forward to the more complete work :))
I suppose one reason is, on the kernel side we don't have a way of exporting the profile? If that's true, then we are in a similar stage as PGO. Both are actually something nice to have. |
The change in llvm#80950 exposed a memory leak in BinarySection. Let BinarySection manage memory passed via updateContents() unless a valid SectionID is set indicating that the contents are managed by JITLink.
The change in #80950 exposed a memory leak in BinarySection. Let BinarySection manage memory passed via updateContents() unless a valid SectionID is set indicating that the contents are managed by JITLink.
Update ORC information based on the new code layout and emit
corresponding ORC sections for the Linux kernel.
We rewrite ORC sections in place, which puts a limit on the size of new
section contents. Since ORC info changes for the new code layout and the
number of ORC entries can become larger, we free up space in the tables
by removing redundant ORC terminators. As a result, we effectively emit
fewer entries and have to add duplicate terminators at the end to match
the original section sizes. Ideally, we need to update ORC boundaries to
reflect the reduced size and optimize runtime lookup, but we will need
relocations for this, and the benefits will be marginal, if any.