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

Evaluate using Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) for C++ part and LLVM #1526

Open
zamazan4ik opened this issue Dec 4, 2023 · 0 comments

Comments

@zamazan4ik
Copy link

Is your feature request related to a problem? Please describe.
Not a problem. It's an idea of how to improve Clasp performance.

Describe the solution you'd like

Recently I checked Profile-Guided Optimization (PGO) and Post-Link Optimization (PLO) improvements on multiple projects. The results are available here. According to the tests, these optimizations can help with achieving better performance in many compilers and compiler-like things: Clang, GCC, Rustc, CPython, etc. Since this, I think trying to optimize the Clasp compiler with PGO and PLO would be a good idea. It could work since LLVM itself and Clasp's C++ part are PGO-optimizable (C++ compilers support PGO very well).

I can suggest the following action points:

  • Perform PGO benchmarks on Clasp. If it shows improvements - add a note to the documentation about possible improvements in performance with PGO.
  • Providing an easier way (e.g. a build option) to build scripts with PGO can be helpful for the end-users and maintainers since they will be able to optimize the Clasp tooling according to their workloads.
  • Optimize pre-built Clasp binaries (if any)

Additional context

Testing Post-Link Optimization techniques (like LLVM BOLT) would be interesting too (Clang and Rustc already use BOLT as an addition to PGO) but I recommend starting from the usual PGO.

Examples of how PGO optimization is integrated into other projects:

I have some examples of how PGO information looks in the documentation:

Regarding LLVM BOLT integration, I have the following examples:

I hope these ideas could be interesting for someone from the Clasp community. Even if right now possibly investing resources into this would be too early for Clasp - it could be a good idea for future improvements.

By the way, if Clasp implements an Ahead-of-Time (AoT) compilation model for Common Lisp, maybe would be a good idea to integrate into the Clasp compiler building Common Lisp code with PGO? Since Clasp is a LLVM-based compiler, you can try to reuse the existing PGO infrastructure from LLVM. As a reference, you can use the Clang compiler and its IR PGO mode (-fprofile-generate/-fprofile-use flags). If you agree with an idea - we can create a separate issue for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant