Kobzol / cargo-pgo

Cargo subcommand for optimizing Rust binaries/libraries with PGO and BOLT.
MIT License
563 stars 11 forks source link

A couple PGO+BOLT limitations worth documenting? #26

Closed mcronce closed 1 year ago

mcronce commented 2 years ago

In order to get PGO+BOLT working, I needed to

Is it worth documenting those, and/or is there a way to make those settings work in RUSTFLAGS when you build the PGO-optimized binary that you're going to pass to llvm-bolt --instrument? The errors come from cc, which makes them super cryptic and unhelpful; I found the workarounds by just throwing possible fixes at the wall until something stuck :joy:

I can retrigger the errors tonight if having a copy of them would be helpful

mcronce commented 2 years ago

PS - thanks for the hard work on this! Your code in this repo and in the BOLT PRs for rustlang/rust are literally the only documentation I can find on using BOLT with Rust

mcronce commented 2 years ago

Never mind the LTO bit; fat LTO is now not (even close to) worth the compile time hit to this project with the addition of BOLT, but it looks like it wasn't an actual blocking issue, only the strip piece and LLVM version were.

Kobzol commented 2 years ago

Hi! Thanks for the useful information. In theory, cargo-pgo could detect symbol stripping/fat LTO and warn the user about it. With LLVM version, it's a bit more difficult, because it's probably impossible for the plugin to detect whether a specific LLVM version will work or not :sweat_smile:

Kobzol commented 1 year ago

I added a warning about stripping symbols when using BOLT to the README. Let me know if you think that I should document more things.

mcronce commented 1 year ago

I think that gets the job done. Hopefully it saves somebody some time :)