Skip to content
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

Investigate post-link optimization via BOLT for improving compiler speed #55137

Closed
bstrie opened this issue Oct 17, 2018 · 2 comments
Closed
Labels
I-compiletime Issue: Problems and improvements with respect to compile times.

Comments

@bstrie
Copy link
Contributor

bstrie commented Oct 17, 2018

Facebook has written a post-link optimizer called BOLT. Its purpose is to analyze static binaries and reorder code segments in order to optimize icache utilization.

They have an experience report on using this tool to optimize binaries of the Clang compiler. For a benchmark of building Clang, BOLT'd Clang binaries were 25% faster, or 12% faster when the Clang binary had first been compiled with LTO and PGO.

They have a paper with more details here: https://arxiv.org/pdf/1807.06735.pdf

The question is whether or not we can apply this tool to rustc. I'm not sure if the compiler binaries we distribute are built with LTO or any form of PGO (how well do we even support that?), and if they aren't then we might hope see a disproportionate benefit from doing so.

According to a developer, there is reason to suspect that it may not take much (any?) work to get it to operate on Rust code: facebookarchive/BOLT#41 (comment) , as long as the code does not "rely on code layout properties, such as function pointer deltas" (I don't know if rustc generates any code that would violate that), and as long as binaries are linked with --emit-relocs.

@bstrie bstrie added the I-compiletime Issue: Problems and improvements with respect to compile times. label Oct 17, 2018
@ishitatsuyuki
Copy link
Contributor

Duplicate of #50655.

@Mark-Simulacrum
Copy link
Member

(Typed up a comment to this, reposting to that thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-compiletime Issue: Problems and improvements with respect to compile times.
Projects
None yet
Development

No branches or pull requests

3 participants