[all-commits] [llvm/llvm-project] aa2ddf: [SampleFDO] For functions without profiles, provid...

wmi-11 via All-commits all-commits at lists.llvm.org
Fri May 8 11:30:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: aa2ddfc73d6e4a3369b7992aecaf107987c505b6
      https://github.com/llvm/llvm-project/commit/aa2ddfc73d6e4a3369b7992aecaf107987c505b6
  Author: Wei Mi <wmi at google.com>
  Date:   2020-05-08 (Fri, 08 May 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/ProfileSummaryInfo.h
    M llvm/lib/Analysis/ProfileSummaryInfo.cpp
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/test/Transforms/SampleProfile/section-accurate-samplepgo.ll

  Log Message:
  -----------
  [SampleFDO] For functions without profiles, provide an option to put
them in a special text section.

For sampleFDO, because the optimized build uses profile generated from
previous release, previously we couldn't tell a function without profile
was truely cold or just newly created so we had to treat them conservatively
and put them in .text section instead of .text.unlikely. The result was when
we persuing the best performance by locking .text.hot and .text in memory,
we wasted a lot of memory to keep cold functions inside.

In https://reviews.llvm.org/D66374, we introduced profile symbol list to
discriminate functions being cold versus functions being newly added.
This mechanism works quite well for regular use cases in AutoFDO. However,
in some case, we can only have a partial profile when optimizing a target.
The partial profile may be an aggregated profile collected from many targets.
The profile symbol list method used for regular sampleFDO profile is not
applicable to partial profile use case because it may be too large and
introduce many false positives.

To solve the problem for partial profile use case, we provide an option called
--profile-unknown-in-special-section. For functions without profile, we will
still treat them conservatively in compiler optimizations -- for example,
treat them as warm instead of cold in inliner. When we use profile info to
add section prefix for functions, we will discriminate functions known to be
not cold versus functions without profile (being unknown), and we will put
functions being unknown in a special text section called .text.unknown.
Runtime system will have the flexibility to decide where to put the special
section in order to achieve a balance between performance and memory saving.

Differential Revision: https://reviews.llvm.org/D62540




More information about the All-commits mailing list