[llvm] 23191a4 - [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested.

Hongtao Yu via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 09:29:32 PDT 2022


Author: Hongtao Yu
Date: 2022-05-12T09:29:25-07:00
New Revision: 23191a4ffee999f764215daf4efc9e18eca291bb

URL: https://github.com/llvm/llvm-project/commit/23191a4ffee999f764215daf4efc9e18eca291bb
DIFF: https://github.com/llvm/llvm-project/commit/23191a4ffee999f764215daf4efc9e18eca291bb.diff

LOG: [CSSPGO][llvm-profgen] Do not duplicate context profiles into base profile when converting CS flat profile to nested.

Recent experiments with our two large internal services showed that duplicating context profiles into base profile caused code size inflation and didn't deliver good performance compared to no such duplication. It was a trick we made to catch up with the CS flat profile and I'm now turning it off by default.

The code size inflation mainly comes from the enriched based profiles. A base profile for a function represents the uninlined (or outlined) portion of the whole function running time. Such portion could be very small if a function is inlined into most of its hot callsites. Duplicating context profiles of the function into its base profiles could cause the outlined body to be hot enough and in turn get many of its callees inlined, thus increases the code size. The size inflation could further cause perf regression.

Reviewed By: wenlei

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

Added: 
    

Modified: 
    llvm/lib/ProfileData/SampleProf.cpp
    llvm/test/tools/llvm-profgen/cs-preinline.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index 0243e5f9d32b..9862605eed87 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -34,7 +34,7 @@ static cl::opt<uint64_t> ProfileSymbolListCutOff(
              "will be used. This is very useful for performance debugging"));
 
 cl::opt<bool> GenerateMergedBaseProfiles(
-    "generate-merged-base-profiles", cl::init(true), cl::ZeroOrMore,
+    "generate-merged-base-profiles", cl::init(false), cl::ZeroOrMore,
     cl::desc("When generating nested context-sensitive profiles, always "
              "generate extra base profile for function with all its context "
              "profiles merged into it."));

diff  --git a/llvm/test/tools/llvm-profgen/cs-preinline.test b/llvm/test/tools/llvm-profgen/cs-preinline.test
index f9556b104317..1844c6533f0e 100644
--- a/llvm/test/tools/llvm-profgen/cs-preinline.test
+++ b/llvm/test/tools/llvm-profgen/cs-preinline.test
@@ -78,7 +78,7 @@
 ; CHECK-PREINL-NEST-NEXT: 65526: 14
 ; CHECK-PREINL-NEST-NEXT: 3.1: bar:84
 ; CHECK-PREINL-NEST-NEXT:  1: 14
-; CHECK-PREINL-NEST-NEXT:  !Attributes: 7
+; CHECK-PREINL-NEST-NEXT:  !Attributes: 3
 
 
 ; CHECK-PREINL-FLAG: ProfileSummarySection {{.*}} Flags: {{{.*}}preInlined}


        


More information about the llvm-commits mailing list