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 Profile-Guided Optimization (PGO) and LLVM BOLT #48

Closed
zamazan4ik opened this issue Oct 1, 2023 · 3 comments
Closed

Evaluate Profile-Guided Optimization (PGO) and LLVM BOLT #48

zamazan4ik opened this issue Oct 1, 2023 · 3 comments
Labels
wontfix This will not be worked on

Comments

@zamazan4ik
Copy link

Hi!

Recently I did many Profile-Guided Optimization (PGO) benchmarks on multiple projects (including static analysis tools and compilers like Rustc, Clang, Clangd, Clang Tidy, and many others) - the results are available here. So that's why I think it's worth trying to apply PGO to Uiua.

I can suggest the following things to do:

  • Evaluate PGO's applicability to Uiua tooling (like the compiler).
  • If PGO helps to achieve better performance - add a note to Uiua's documentation about that. In this case, users and maintainers will be aware of another optimization opportunity for Uiua.
  • Provide PGO integration into the build scripts. It can help users and maintainers easily apply PGO for their own workloads.
  • Optimize prebuilt binaries with PGO.

Here are some examples of how PGO is already integrated into other projects' build scripts:

After PGO, I can suggest evaluating LLVM BOLT as an additional optimization step after PGO.

For the Rust projects, I recommend starting with cargo-pgo.

@bhansconnect
Copy link
Contributor

I decided to do some testing, cause I have a ray tracer in uiua that theoretically should be a solid enough piece of code for pgo. I was unable to get any discernible improvements from pgo. I don't think that is very surprising. Tight hot loop code with minimal branches should get little to no gains from pgo.

I think this is the case for less useful for array languages than most other software. Still probably has a few percent gains to be had (more gains in poorly written array code that causes the intepreter to branch a lot).

I sadly have been unable to test bolt so far (hitting issues). Will report back if I get things working on my linux box and see anything interesting.

@bhansconnect
Copy link
Contributor

Managed to run my program with bolt as well. Sadly both bolt and pgo do about zero in my case. Not saying that will be the case for uiua as a whole, but I would guess overall there may not be that much impact to be had.

@zamazan4ik
Copy link
Author

zamazan4ik commented Oct 7, 2023

Thanks a lot for the tests! I suggest leaving the issue open. So maybe in the future, we will find more cases, where PGO could help more with the performance.

@kaikalii kaikalii added the wontfix This will not be worked on label Oct 8, 2023
@kaikalii kaikalii closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants