Comments (4)
That's an interesting idea. I don't think that it's possible with Cargo today, but even if it was, there are at least two large problems that I see with it:
- PGO profiles are not portable between targets (Linux/Windows/macOS/...), nor between different rustc versions. This means that you would have to upload pre-generated profiles for many target/compiler combinations, or devise some new, platform/rustc/LLVM independent format. This is a big technical challenge.
- PGO profiles are specifically tuned to selected workloads. It could be challenging to generate profiles that are general enough that they would improve performance for most users. If the profiles do not fit your workload, your PGO optimized program can actually be slower!
from cargo-pgo.
Hmmm, that sounds practically intractable.Maybe a better idea is to make the flow for installing cargo binaries more amenable to pgo?
Currently you'd have to git clone, checkout the latest tag (assuming there even is one), do pgo, and finally cargo pgo install --path (is that a thing?). And you're also left out from any updates, having to manually repeat this whole process each time. It makes more sense to keep around the profiles across updates since probably not all code has changed, and therefore the quality of the profiles will decay rather become useless immediately (I think).
The ideal flow is probably something like: you cargo install as usual, but you can optionally run a separate command at any time to gather profiles for the binary and re-install. These profiles stick around and get reused across updates. Running the optional pgo-this-binary command would wipe the profiles if they came from an old version but append if it's the same crate version letting you build better profiles over time.
That would definitely require an RFC though, so maybe too much of a pain.
from cargo-pgo.
This would basically mean that cargo-pgo
would need to be integrated as part of cargo
, and on top of that a lot of other functionality would have to be added to cargo install
. Based on the current maintainer shortage and feature freeze/slowdown of cargo
, I don't think that this is going to happen anytime soon.
And I'm not really sure that it's worth all this effort. If you want the fastest possible binary for a specific use-case, you'll want to do more things than just PGO/BOLT (LTO=thin, CGU=1, -C target-cpu=native
etc.). cargo install
is a tool to provide a reasonably optimized binary with wide platform/CPU support, using PGO and other, more targeted optimizations, is usually done in some custom way and is hard to generalize.
from cargo-pgo.
Yeah, it's be quite an effort for sure. Agreed that it's probably not worth it for now.
from cargo-pgo.
Related Issues (20)
- A couple PGO+BOLT limitations worth documenting? HOT 5
- PGO for non-terminating programs HOT 2
- Reason for stdin(stdio::null)? HOT 4
- Evaluate PGO coverage HOT 4
- Bolt can be installed starting with LLVM 15 - README potentially needs an update HOT 6
- LLVM ERROR: Broken module found, compilation aborted HOT 4
- Add support for more PGO modes HOT 6
- Github action HOT 2
- options for older OS HOT 20
- cargo pgo does not run (nothing happens after cargo pgo build or run) HOT 1
- Overwriting profile is not possible HOT 4
- PGO optimization for non-Rust dependencies in Rust projects HOT 4
- can't find crate for `profiler_builtins` HOT 1
- Does not allow for optimizations for WASM targets HOT 2
- Difference between "cargo bench" and "cargo pgo bench" HOT 4
- cargo-pgo ignores all rustflags defined in config.toml file, how to pass custom rustflags to pgo build? HOT 12
- Shall we have a Docker image for convenience? HOT 3
- v0.2.7 `cargo pgo run` adds '--config' argument wrongly HOT 7
- No profiles generated HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-pgo.