[all-commits] [llvm/llvm-project] 775c50: [ctx_prof] Flattened profile lowering pass (#107329)

Mircea Trofin via All-commits all-commits at lists.llvm.org
Fri Sep 6 13:47:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 775c50709c2d18acc085c089392847c5968457b9
      https://github.com/llvm/llvm-project/commit/775c50709c2d18acc085c089392847c5968457b9
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2024-09-06 (Fri, 06 Sep 2024)

  Changed paths:
    M llvm/include/llvm/ProfileData/ProfileCommon.h
    A llvm/include/llvm/Transforms/Instrumentation/PGOCtxProfFlattening.h
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassBuilderPipelines.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Transforms/Instrumentation/CMakeLists.txt
    A llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
    A llvm/test/Analysis/CtxProfAnalysis/flatten-always-removes-instrumentation.ll
    A llvm/test/Analysis/CtxProfAnalysis/flatten-and-annotate.ll

  Log Message:
  -----------
  [ctx_prof] Flattened profile lowering pass (#107329)

Pass to flatten and lower the contextual profile to profile (i.e. `MD_prof`) metadata. This is expected to be used after all IPO transformations have happened.

Prior to lowering, the instrumentation is maintained during IPO and the contextual profile is kept in sync (see PRs #105469, #106154). Flattening (#104539) sums up all the counters belonging to all a function's context nodes.

We first propagate counter values (from the flattened profile) using the same propagation algorithm as `PGOUseFunc::populateCounters`, then map the edge values to `branch_weights`. Functions. in the module that don't have an entry in the flattened profile are deemed cold, and any `MD_prof` metadata they may have is reset. The profile summary is also reset at this point.

Issue [#89287](https://github.com/llvm/llvm-project/issues/89287)



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