llvm.org GIT mirror llvm / b1f864a
Increase the import-threshold for crtical functions. Summary: For interative sample-pgo, if a hot call site is inlined in the profiling binary, we should inline it in before profile annotation in the backend. Before that, the compile phase first collects all GUIDs that needs to be imported and creates virtual "hot" call edge in the summary. However, "hot" is not good enough to guarantee the callsites get inlined. This patch introduces "critical" call edge, and assign much higher importing threshold for those edges. Reviewers: tejohnson Reviewed By: tejohnson Subscribers: sanjoy, mehdi_amini, llvm-commits, eraman Differential Revision: https://reviews.llvm.org/D35096 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307439 91177308-0d34-0410-b5e6-96231b3b80d8 Dehao Chen 3 years ago
5 changed file(s) with 18 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
4646
4747 /// \brief Class to accumulate and hold information about a callee.
4848 struct CalleeInfo {
49 enum class HotnessType : uint8_t { Unknown = 0, Cold = 1, None = 2, Hot = 3 };
49 enum class HotnessType : uint8_t {
50 Unknown = 0,
51 Cold = 1,
52 None = 2,
53 Hot = 3,
54 Critical = 4
55 };
5056 HotnessType Hotness = HotnessType::Unknown;
5157
5258 CalleeInfo() = default;
265265 // sample PGO, to enable the same inlines as the profiled optimized binary.
266266 for (auto &I : F.getImportGUIDs())
267267 CallGraphEdges[Index.getOrInsertValueInfo(I)].updateHotness(
268 CalleeInfo::HotnessType::Hot);
268 CalleeInfo::HotnessType::Critical);
269269
270270 bool NonRenamableLocal = isNonRenamableLocal(F);
271271 bool NotEligibleForImport =
6262 static cl::opt ImportHotMultiplier(
6363 "import-hot-multiplier", cl::init(3.0), cl::Hidden, cl::value_desc("x"),
6464 cl::desc("Multiply the `import-instr-limit` threshold for hot callsites"));
65
66 static cl::opt ImportCriticalMultiplier(
67 "import-critical-multiplier", cl::init(100.0), cl::Hidden,
68 cl::value_desc("x"),
69 cl::desc(
70 "Multiply the `import-instr-limit` threshold for critical callsites"));
6571
6672 // FIXME: This multiplier was not really tuned up.
6773 static cl::opt ImportColdMultiplier(
206212 return ImportHotMultiplier;
207213 if (Hotness == CalleeInfo::HotnessType::Cold)
208214 return ImportColdMultiplier;
215 if (Hotness == CalleeInfo::HotnessType::Critical)
216 return ImportCriticalMultiplier;
209217 return 1.0;
210218 };
211219
2828 ; CHECK-NEXT:
2929 ; CHECK-NEXT:
3030 ; op4=hot1 op6=cold op8=hot2 op10=hot4 op12=none1 op14=hot3 op16=none2 op18=none3 op20=123
31 ; CHECK-NEXT: 3/>
31 ; CHECK-NEXT: 4/>
3232 ; CHECK-NEXT:
3333
3434 ; CHECK:
2828 ; CHECK-NEXT:
2929 ; CHECK-NEXT:
3030 ; op4=hot1 op6=cold op8=hot2 op10=hot4 op12=none1 op14=hot3 op16=none2 op18=none3 op20=123
31 ; CHECK-NEXT: 3/>
31 ; CHECK-NEXT: 4/>
3232 ; CHECK-NEXT:
3333
3434 ; CHECK: