-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
What is your question?
Hi!
I investigate PGO and PLO effects on different kinds of software - all my current results are available at https://github.com/zamazan4ik/awesome-pgo. According to the results, enabling PGO and PLO can help with achieving better overall performance in many cases. I think expanding PGO and PLO usage for the Conan packages would be a good idea since it could help to achieve better software performance for Conan users.
Profile-Guided Optimization (PGO)
PGO is already a well-known technique. All currently known PGO effects on performance can be found at https://github.com/zamazan4ik/awesome-pgo#pgo-showcases . Several OS distros and package manager already enabled PGO for packages like GCC, Clang, Rustc, and many others (it depends on each package manager, of course). For some projects PGO is already enabled in Conan recipes - like CPython.
I think we can start by enabling PGO at least for the following projects (these packages are already PGO-optimized in many OS distros):
- Compilers like GCC, glslang, etc.
- Static analysis like CppCheck
- Databases like SQLite (PGO bench results)
Probably there are more PGO-suitable packages in the Conan repository. All found right now PGO results (with performance numbers) can be checked here - https://github.com/zamazan4ik/awesome-pgo#pgo-showcases
Post Link Optimization (PLO)
Regarding Post Link Optimization (PLO), right now there are two main tools - LLVM BOLT and Google Propeller.
According to the Facebook Research Paper (https://research.facebook.com/publications/bolt-a-practical-binary-optimizer-for-data-centers-and-beyond/), LLVM BOLT (https://github.com/llvm/llvm-project/blob/main/bolt/README.md) helps with achieving better performance for various packages like compilers and interpreters. I think it would be a good idea to enable LLVM BOLT for some packages to deliver faster binaries for users (since Propeller is less stable right now in my opinion).
Here I got some examples of how LLVM BOLT is already integrated into other projects:
- CPython: gh-90536: Add support for the BOLT post-link binary optimizer python/cpython#95908
- Clang: https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/BOLT.cmake
So at least for the projects above LLVM BOLT effects are tested and some preparations are already done in the upstream projects. In this case, it should be easier to enable BOLT for these packages.
For some projects right now there is ongoing work on integrating LLVM BOLT into the build scripts:
- Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1163978
- Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1789087
- The same for Propeller (a LLVM BOLT alternative): https://bugzilla.mozilla.org/show_bug.cgi?id=1509314
- NodeJS: Integrate LLVM BOLT into the build scripts nodejs/node#50379
- LDC: Add a build target for bolt-optimized ldc? ldc-developers/ldc#4228
- GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112492
More about LLVM BOLT performance results for other projects can be found in:
- Rustc:
- CPython: gh-90536: Add support for the BOLT post-link binary optimizer python/cpython#95908
- YDB: Consider using LTO + PGO + Bolt ydb-platform/ydb#140
- Clang:
- LDC: Add a build target for bolt-optimized ldc? ldc-developers/ldc#4228 (comment)
- NodeJS: https://aaupov.github.io/blog/2020/10/08/bolt-nodejs
- Chromium: https://aaupov.github.io/blog/2022/11/12/bolt-chromium
- MySQL, MongoDB, memcached, Verilator: https://people.ucsc.edu/~hlitz/papers/ocolos.pdf
Some OS already using LLVM BOLT in their build scripts - check Clang recipe in Solus.
Usually, PGO and PLO are mostly used for executable packages, not for libraries. However, PGO and PLO can be used for distributed libraries too - e.g. check pydantic-core
case. We can think about PGO and PLO integration approaches into Conan as well. Imagine the case when a user uses libraries from Conan and wants to optimize them all according to their profile with PGO. How can we implement this case right now with Conan? Do we need an additional integration in Conan like it's done in Bazel?
First, I want to discuss these optimization approaches with Conan maintainers. What do you think about the ideas? If these ideas would be valuable for Conan, then we can think about what to do next: create per-package corresponding PGO/PLO issues, create meta-tracking issues, etc.
Thank you for your attention.