[PATCH] D147545: [CSSPGO] Stale profile matching(part 2)

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 17:07:05 PDT 2023


wenlei added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:2334
+
+  if (IsFuncHashMismatch && SalvageStaleProfile) {
+    LLVM_DEBUG(dbgs() << "Run stale profile matching for " << F.getName()
----------------
wlei wrote:
> hoy wrote:
> > BTW, wondering if you've ever seen mismatched callsites when function hash matches. The hash counts number of callsites but not their orders.
> Good question. Yes, there are many mismatched callsites even hash is matched, current work only support when a checksum mismatch is detected. 
> 
> There is a general issue whether we can turn it on for all the functions. That is whether the matching algorithm can handle perfectly with the non-stale profile.  the current heuristic is "first come first match", but not all the functions are in the profile(supposing there are functions doesn't hit any samples), it could give inconsistent anchors for the non-stale profile then cause a mismatch.
> 
> In order to solve it, I think we can try:
> 
> - Use a more strict checksum, like also count the orders.
> - find a threshold from the mismatch metrics to control it.
> -  Use a different heuristic, like search the closest location which can handle well with non-stale profile, but need more measuring for the mismatched function.
> 
> This is also an issue blocking AutoFDO, since AutoFDO doesn't have the checksum.
> 
> 
> 
it might be useful to have a debug print, or `STATISTIC` so we know when and how often this happens. It's essentially hash collision. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147545/new/

https://reviews.llvm.org/D147545



More information about the llvm-commits mailing list