[all-commits] [llvm/llvm-project] 442682: [BOLT] stale profile matching [part 1 out of 2]

spupyrev via All-commits all-commits at lists.llvm.org
Tue Jun 6 12:14:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 44268271f61e46636619623d52013c3be3e272c0
      https://github.com/llvm/llvm-project/commit/44268271f61e46636619623d52013c3be3e272c0
  Author: spupyrev <spupyrev at fb.com>
  Date:   2023-06-06 (Tue, 06 Jun 2023)

  Changed paths:
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Profile/YAMLProfileReader.h
    M bolt/lib/Passes/BinaryPasses.cpp
    M bolt/lib/Profile/CMakeLists.txt
    A bolt/lib/Profile/StaleProfileMatching.cpp
    M bolt/lib/Profile/YAMLProfileReader.cpp
    A bolt/test/X86/Inputs/blarge_profile_stale.yaml
    A bolt/test/X86/reader-stale-yaml.test

  Log Message:
  -----------
  [BOLT] stale profile matching [part 1 out of 2]

BOLT often has to deal with profiles collected on binaries built from several
revisions behind release. As a result, a certain percentage of functions is
considered stale and not optimized. This diff adds an ability to match profile
to functions that are not 100% binary identical, which increases the
optimization coverage and boosts the performance of applications.

The algorithm consists of two phases: matching and inference:
- At the matching phase, we try to "guess" as many block and jump counts from
  the stale profile as possible. To this end, the content of each basic block
  is hashed and stored in the (yaml) profile. When BOLT optimizes a binary,
  it computes block hashes and identifies the corresponding entries in the
  stale profile. It yields a partial profile for every CFG in the binary.
- At the inference phase, we employ a network flow-based algorithm (profi) to
  reconstruct "realistic" block and jump counts from the partial profile
  generated at the first stage. In practice, we don't always produce proper
  profile data but the majority (e.g., >90%) of CFGs get the correct counts.

This is a first part of the change; the next stacked diff extends the block hashing
and provides perf evaluation numbers.

Reviewed By: maksfb

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




More information about the All-commits mailing list