HassanSajjad-302 wrote:

Hi. I have an example of some optimization that can not be done in
CMake and can be done in HMake however.

We do 4 steps to do PGO.

1) Compiling Clang
2) Using stage-1 clang, compiling again but with -fprofile-generate.
3) Using stage-2 clang, compiling again and merging the generated
.profraw to .profdata file.
4) Compiling again with stag-1 using this .profdata file.

For all these steps, we do CMake reconfiguration and then the build.

With HMake we will avoid the following.

1) cost of reconfiguration every-time. HMake configuration will take
<5s and is needed only once.
2) We avoid the cost of serial tasks of building `tblgen.exe` and
generating `.inc` include-files. As `.inc` files of all 4 steps should
be exactly the same, we can just use those generated in step1 for the
other 3 as-well. This makes steps 2,3,4 embarrassingly parallel.
3) We don't need to relink in the stage3.
4) step1 and step2 and step4 can be done with hu instead.

On a 32-thread machine, you get a PGO optimized installer build in
**20 minutes ( 1 + 1.5 + 16 + 1.5)**.

I believe a few more optimizations will become visible as we actually
make the switch.


https://github.com/llvm/llvm-project/pull/147682
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to