[PATCH] D115011: [CSSPGO] Turn on Profi by default

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 16:47:35 PST 2021


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

As titled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115011

Files:
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/SampleProfile/csspgo-import-list.ll
  llvm/test/Transforms/SampleProfile/csspgo-summary.ll
  llvm/test/Transforms/SampleProfile/profile-context-tracker.ll
  llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll


Index: llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll
+++ llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll
@@ -69,8 +69,8 @@
 ; CHECK: !llvm.pseudo_probe_desc = !{![[#DESC0:]], ![[#DESC1:]]}
 ; CHECK: ![[#DESC0]] = !{i64 [[#GUID1]], i64 [[#HASH1:]], !"foo"}
 ; CHECK: ![[#DESC1]] = !{i64 [[#GUID2]], i64 [[#HASH2:]], !"zen"}
-; CHECK: ![[PD1]] = !{!"branch_weights", i32 25, i32 1}
-; CHECK: ![[PD2]] = !{!"branch_weights", i32 382916, i32 25}
+; CHECK: ![[PD1]] = !{!"branch_weights", i32 5, i32 0}
+; CHECK: ![[PD2]] = !{!"branch_weights", i32 382915, i32 5}
 
 ; Checking to see if YAML file is generated and contains remarks
 ;YAML: --- !Passed
Index: llvm/test/Transforms/SampleProfile/profile-context-tracker.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/profile-context-tracker.ll
+++ llvm/test/Transforms/SampleProfile/profile-context-tracker.ll
@@ -110,15 +110,15 @@
   ret i32 %call, !dbg !53
 }
 
-; INLINE-ALL-DAG: [[MAIN_PROF]] = !{!"function_entry_count", i64 13}
+; INLINE-ALL-DAG: [[MAIN_PROF]] = !{!"function_entry_count", i64 1}
 ; INLINE-ALL-DAG: [[FUNCA_PROF]] = !{!"function_entry_count", i64 0}
 ; INLINE-ALL-DAG-SAME: [[LEAF_PROF]] = !{!"function_entry_count", i64 0}
-; INLINE-ALL-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 33}
+; INLINE-ALL-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 13}
 
-; INLINE-HOT-DAG: [[MAIN_PROF]] = !{!"function_entry_count", i64 13}
+; INLINE-HOT-DAG: [[MAIN_PROF]] = !{!"function_entry_count", i64 1}
 ; INLINE-HOT-DAG: [[FUNCA_PROF]] = !{!"function_entry_count", i64 12}
 ; INLINE-HOT-DAG-SAME: [[LEAF_PROF]] = !{!"function_entry_count", i64 0}
-; INLINE-HOT-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 33}
+; INLINE-HOT-DAG: [[FUNCB_PROF]] = !{!"function_entry_count", i64 13}
 
 declare i32 @_Z3fibi(i32)
 
Index: llvm/test/Transforms/SampleProfile/csspgo-summary.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/csspgo-summary.ll
+++ llvm/test/Transforms/SampleProfile/csspgo-summary.ll
@@ -1,7 +1,7 @@
 ; Test for CSSPGO's profile summary computation with and without pre-merging context profiles
 
-; RUN: opt < %s -passes=sample-profile,print-profile-summary -sample-profile-file=%S/Inputs/profile-context-tracker.prof -profile-summary-cutoff-hot=999900 -profile-sample-accurate -profile-summary-contextless=0 -S -o /dev/null 2>&1 | FileCheck %s --check-prefix=SUMMARY-UNMERGED
-; RUN: opt < %s -passes=sample-profile,print-profile-summary -sample-profile-file=%S/Inputs/profile-context-tracker.prof -profile-summary-cutoff-hot=999900 -profile-sample-accurate -profile-summary-contextless=1 -S -o /dev/null 2>&1 | FileCheck %s --check-prefix=SUMMARY-MERGED
+; RUN: opt < %s -passes=sample-profile,print-profile-summary -sample-profile-use-profi=0 -sample-profile-file=%S/Inputs/profile-context-tracker.prof -profile-summary-cutoff-hot=999900 -profile-sample-accurate -profile-summary-contextless=0 -S -o /dev/null 2>&1 | FileCheck %s --check-prefix=SUMMARY-UNMERGED
+; RUN: opt < %s -passes=sample-profile,print-profile-summary -sample-profile-use-profi=0 -sample-profile-file=%S/Inputs/profile-context-tracker.prof -profile-summary-cutoff-hot=999900 -profile-sample-accurate -profile-summary-contextless=1 -S -o /dev/null 2>&1 | FileCheck %s --check-prefix=SUMMARY-MERGED
 
 ; SUMMARY-UNMERGED: main :hot entry
 ; SUMMARY-MERGED-NOT: main :hot entry
Index: llvm/test/Transforms/SampleProfile/csspgo-import-list.ll
===================================================================
--- llvm/test/Transforms/SampleProfile/csspgo-import-list.ll
+++ llvm/test/Transforms/SampleProfile/csspgo-import-list.ll
@@ -48,13 +48,13 @@
 ; _Z3fibi:-2016976694713209516
 
 ; CHECK: distinct !DISubprogram(name: "main"
-; CHECK: !{!"function_entry_count", i64 3, i64 446061515086924981, i64 3815895320998406042, i64 7102633082150537521, i64 -2862076748587597320}
+; CHECK: !{!"function_entry_count", i64 1, i64 446061515086924981, i64 3815895320998406042, i64 7102633082150537521, i64 -2862076748587597320}
 
 ; CHECK-ORDERED: FuncOffsetTableSection {{.*}} {ordered}
 
-; THRESHOLD: !{!"function_entry_count", i64 3}
-; THRESHOLD-REPLAY: !{!"function_entry_count", i64 3, i64 446061515086924981, i64 3815895320998406042, i64 6309742469962978389, i64 7102633082150537521, i64 -2862076748587597320, i64 -2016976694713209516}
-; THRESHOLD-REPLAY-NO-FUNCA: !{!"function_entry_count", i64 3, i64 446061515086924981, i64 3815895320998406042, i64 6309742469962978389, i64 7102633082150537521, i64 -2862076748587597320}
+; THRESHOLD: !{!"function_entry_count", i64 1}
+; THRESHOLD-REPLAY: !{!"function_entry_count", i64 1, i64 446061515086924981, i64 3815895320998406042, i64 6309742469962978389, i64 7102633082150537521, i64 -2862076748587597320, i64 -2016976694713209516}
+; THRESHOLD-REPLAY-NO-FUNCA: !{!"function_entry_count", i64 1, i64 446061515086924981, i64 3815895320998406042, i64 6309742469962978389, i64 7102633082150537521, i64 -2862076748587597320}
 
 attributes #0 = { nofree noinline norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" "use-sample-profile" }
 
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1982,6 +1982,9 @@
     // Enable iterative-BFI by default for CSSPGO.
     if (!UseIterativeBFIInference.getNumOccurrences())
       UseIterativeBFIInference = true;
+    // Enable Profi by default for CSSPGO.
+    if (!SampleProfileUseProfi.getNumOccurrences())
+      SampleProfileUseProfi = true;
 
     // Tracker for profiles under different context
     ContextTracker = std::make_unique<SampleContextTracker>(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115011.391496.patch
Type: text/x-patch
Size: 6378 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211203/b2b36845/attachment.bin>


More information about the llvm-commits mailing list