[llvm] 444d2e1 - [CSSPGO] Enable stale profile matching by default for CSSPGO

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 11:19:12 PDT 2023


Author: wlei
Date: 2023-06-29T11:18:51-07:00
New Revision: 444d2e1a54058cfa21d12ac369404a2923f7b932

URL: https://github.com/llvm/llvm-project/commit/444d2e1a54058cfa21d12ac369404a2923f7b932
DIFF: https://github.com/llvm/llvm-project/commit/444d2e1a54058cfa21d12ac369404a2923f7b932.diff

LOG: [CSSPGO] Enable stale profile matching by default for CSSPGO

We tested the stale profile matching on several Meta's internal services, all results are positive, for instance, in one service that refreshed its profile every one or two weeks, it consistently gave 1~2% performance improvement. We also observed an instance that a trivial refactoring caused a 2% regression and the matching can successfully recover the whole regression. Therefore, we'd like to turn it on by default for CSSPGO.

Reviewed By: hoy, wenlei

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

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/SampleProfile.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 44f0a7503007e..690044674151f 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2048,6 +2048,16 @@ bool SampleProfileLoader::doInitialization(Module &M,
         UsePreInlinerDecision = true;
     }
 
+    // Enable stale profile matching by default for probe-based profile.
+    // Currently the matching relies on if the checksum mismatch is detected,
+    // which is currently only available for pseudo-probe mode. Removing the
+    // checksum check could cause regressions for some cases, so further tuning
+    // might be needed if we want to enable it for all cases.
+    if (Reader->profileIsProbeBased() &&
+        !SalvageStaleProfile.getNumOccurrences()) {
+      SalvageStaleProfile = true;
+    }
+
     if (!Reader->profileIsCS()) {
       // Non-CS profile should be fine without a function size budget for the
       // inliner since the contexts in the profile are either all from inlining


        


More information about the llvm-commits mailing list