Git Product home page Git Product logo

Comments (4)

Kobzol avatar Kobzol commented on May 20, 2024

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.

SUPERCILEX avatar SUPERCILEX commented on May 20, 2024

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.

Kobzol avatar Kobzol commented on May 20, 2024

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.

SUPERCILEX avatar SUPERCILEX commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.