[all-commits] [llvm/llvm-project] 24f025: [llvm-profgen] Filter out ambiguous cold profiles ...

Lei Wang via All-commits all-commits at lists.llvm.org
Fri Feb 16 14:29:36 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 24f025175d8adc5cafa277777c2361b55610eab3
      https://github.com/llvm/llvm-project/commit/24f025175d8adc5cafa277777c2361b55610eab3
  Author: Lei Wang <wlei at fb.com>
  Date:   2024-02-16 (Fri, 16 Feb 2024)

  Changed paths:
    A llvm/test/tools/llvm-profgen/Inputs/filter-ambiguous-profile.prof
    A llvm/test/tools/llvm-profgen/filter-ambiguous-profile.test
    M llvm/tools/llvm-profgen/ProfileGenerator.cpp
    M llvm/tools/llvm-profgen/ProfileGenerator.h

  Log Message:
  -----------
  [llvm-profgen] Filter out ambiguous cold profiles during profile generation (#81803)

For the built-in local initialization function(`__cxx_global_var_init`,
`__tls_init` prefix), there could be multiple versions of the functions
in the final binary, e.g. `__cxx_global_var_init`, which is a wrapper of
global variable ctors, the compiler could assign suffixes like
`__cxx_global_var_init.N` for different ctors.
However, in the profile generation, we call `getCanonicalFnName` to
canonicalize the names which strip the suffixes. Therefore, samples from
different functions queries the same profile(only
`__cxx_global_var_init`) and the counts are merged. As the functions are
essentially different, entries of the merged profile are ambiguous. In
sample loading, for each version of this function, the IR from one
version would be attributed towards a merged entries, which is
inaccurate, especially for fuzzy profile matching, it gets multiple
callsites(from different function) but using to match one callsite,
which mislead the matching and report a lot of false positives.
Hence, we want to filter them out from the profile map during the
profile generation time. The profiles are all cold functions, it won't
have perf impact.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list