[llvm-branch-commits] [llvm] [BOLT] Drop high discrepancy profiles in matching (PR #95156)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 12 17:20:10 PDT 2024


================
@@ -592,10 +599,15 @@ void preprocessUnreachableBlocks(FlowFunction &Func) {
 /// Decide if stale profile matching can be applied for a given function.
 /// Currently we skip inference for (very) large instances and for instances
 /// having "unexpected" control flow (e.g., having no sink basic blocks).
-bool canApplyInference(const FlowFunction &Func) {
+bool canApplyInference(const FlowFunction &Func,
+                       const yaml::bolt::BinaryFunctionProfile &YamlBF) {
   if (Func.Blocks.size() > opts::StaleMatchingMaxFuncSize)
     return false;
 
+  if ((double)Func.MatchedExecCount / YamlBF.ExecCount >=
+      opts::MatchedProfileThreshold / 100.0)
+    return false;
----------------
WenleiHe wrote:

> For block-based matching, the threshold should be higher than 5%, perhaps closer to a half?

Yes. Threshold of course need to be tuned based on the heuristic chosen. I just feel that block count based threshold could be a better proxy of how confident we are about the graph match and whether stale profile matching should proceed.. But I don't have very strong opinion.

https://github.com/llvm/llvm-project/pull/95156


More information about the llvm-branch-commits mailing list