Profile-Guided Optimization (PGO) support in D ecosystem
Alexander Zaitsev
zamazan4ik at tut.by
Fri Nov 10 12:47:56 UTC 2023
Hi!
I am investigating the Profile-Guided Optimization (PGO) state
across the ecosystem - all my current results (with a lot of
benchmarks, PGO-related information, and much more) are available
at https://github.com/zamazan4ik/awesome-pgo . I am interested in
PGO state in the D ecosystem too - that's why I am here.
I had been researching a little about PGO in D but compared to
C++ almost no information is available in the official
documentation (or I just don't know where to search it, hah). I
have the following questions (for each D compiler: DMD, GDC, LDC
- am interested in all of them):
1. What is the most up-to-date place for PGO documentation? Right
now I found only
[this](https://wiki.dlang.org/LDC_LLVM_profiling_instrumentation)
for LDC. What about DMD and GDC?
2. Does any D compiler support [Sampling
PGO](https://clang.llvm.org/docs/UsersManual.html#using-sampling-profilers) (also known as [AutoFDO](https://github.com/google/autofdo))? If Sampling PGO is not supported - do you plan to support it in the future? For us sampling PGO can be important since it's much easier to use for gathering the PGO profiles directly from the production environment without hurting the production performance a lot.
3. Do you support
[other](https://aaupov.github.io/blog/2023/07/09/pgo) PGO modes
like CSIR PGO in D compilers? If not, do you plan to support them
in the future?
4. What performance improvements did you get with enabling LTO +
PGO on D compilers? Could you please share the number for each
compiler? With this information it's much easier to consider
rebuilding a D compiler (due to strict security requirements)
locally with PGO since we can estimate benefits from PGO for the
D compiler based on the actual benchmarks from the compiler
developers.
5. Is there any documentation on how to build DMD and GDC with
LTO+PGO? I am looking for smth like it's
[done](https://clickhouse.com/docs/en/operations/optimizing-performance/profile-guided-optimization) in the ClickHouse documentation (or like it's done for Clang or Rustc).
6. Am I right that the officially released D compiler binaries
are already LTO + PGO optimized? According to the
[script](https://github.com/ldc-developers/ldc/blob/master/.github/workflows/main.yml) it's true at least for LDC. What about other compilers?
Similar questions about LDC in the upstream:
https://github.com/ldc-developers/ldc/discussions/4524
Thanks a lot for the help!
More information about the Digitalmars-d
mailing list