chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.76k stars 413 forks source link

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

Open zamazan4ik opened 8 months ago

zamazan4ik commented 8 months ago

Hi!

Recently I checked Profile-Guided Optimization (PGO) improvements on multiple projects. The results are here. E.g. PGO results for LLVM-related tooling are here. According to the tests, PGO usually helps with the compiler and compiler-like workloads (like static analysis). That's why I think trying to optimize Chapel tooling with PGO can be a good idea.

I can suggest the following action points:

Maybe testing Post-Link Optimization techniques (like LLVM BOLT) would be interesting too but I recommend starting from the usual PGO.

Here are some examples of how PGO optimization is integrated in other projects:

By the way, does Chapel compiler support compiling a program with PGO (like Clang, GCC, Rustc)? If Chapel has an Ahead-of-Time compilation model, it would be a nice feature to have.

mppf commented 8 months ago

By the way, does Chapel compiler support compiling a program with PGO (like Clang, GCC, Rustc)? If Chapel has an Ahead-of-Time compilation model, it would be a nice feature to have.

Sometimes, Chapel can work with flags passed to clang with --ccflags <clang flag> and these will work with the LLVM backend. You can also use Chapel with a C compiler of your choice.

With either of these modes, I think it'd need some experimentation to decide what does and doesn't work. I don't know of any experiences trying to use PGO with Chapel.

According to the tests, PGO usually helps with the compiler and compiler-like workloads (like static analysis). That's why I think trying to optimize Chapel tooling with PGO can be a good idea.

It's an interesting question. Today, the compiler itself is building from C++ code using cmake. I don't know of any experiments in this area so far, though.