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

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 12:33:47 PDT 2022


hoy created this revision.
Herald added subscribers: modimo, wenlei, hiraditya.
Herald added a project: All.
hoy requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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. So I'm 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 funciton 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124796

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


Index: llvm/test/tools/llvm-profgen/cs-preinline.test
===================================================================
--- llvm/test/tools/llvm-profgen/cs-preinline.test
+++ 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}
Index: llvm/lib/ProfileData/SampleProf.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProf.cpp
+++ llvm/lib/ProfileData/SampleProf.cpp
@@ -34,7 +34,7 @@
              "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."));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124796.426487.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220502/a4ff399c/attachment.bin>


More information about the llvm-commits mailing list