[all-commits] [llvm/llvm-project] cc6f44: [MemProf] Add basic summary section support (#141805)

Teresa Johnson via All-commits all-commits at lists.llvm.org
Wed May 28 13:13:02 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cc6f446d3865a5e3a6e50e16e670c307a479a110
      https://github.com/llvm/llvm-project/commit/cc6f446d3865a5e3a6e50e16e670c307a479a110
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2025-05-28 (Wed, 28 May 2025)

  Changed paths:
    M llvm/include/llvm/Analysis/MemoryProfileInfo.h
    M llvm/include/llvm/ProfileData/IndexedMemProfData.h
    M llvm/include/llvm/ProfileData/InstrProfReader.h
    M llvm/include/llvm/ProfileData/InstrProfWriter.h
    A llvm/include/llvm/ProfileData/MemProfSummary.h
    A llvm/include/llvm/ProfileData/MemProfSummaryBuilder.h
    M llvm/lib/Analysis/MemoryProfileInfo.cpp
    M llvm/lib/ProfileData/CMakeLists.txt
    M llvm/lib/ProfileData/IndexedMemProfData.cpp
    M llvm/lib/ProfileData/InstrProfWriter.cpp
    M llvm/lib/ProfileData/MemProfReader.cpp
    A llvm/lib/ProfileData/MemProfSummary.cpp
    A llvm/lib/ProfileData/MemProfSummaryBuilder.cpp
    M llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
    M llvm/test/Transforms/PGOProfile/memprof.ll
    M llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll
    M llvm/test/tools/llvm-profdata/memprof-yaml.test
    M llvm/tools/llvm-profdata/llvm-profdata.cpp
    M llvm/unittests/Analysis/MemoryProfileInfoTest.cpp
    M llvm/unittests/ProfileData/MemProfTest.cpp

  Log Message:
  -----------
  [MemProf] Add basic summary section support (#141805)

This patch adds support for a basic MemProf summary section, which is
built along with the indexed MemProf profile (e.g. when reading the raw
or YAML profiles), and serialized through the indexed profile just after
the header.

Currently only 6 fields are written, specifically the number of contexts
(total, cold, hot), and the max context size (cold, warm, hot).

To support forwards and backwards compatibility for added fields in the
indexed profile, the number of fields serialized first. The code is
written to support forwards compatibility (reading newer profiles with
additional summary fields), and comments indicate how to implement
backwards compatibility (reading older profiles with fewer summary
fields) as needed.

Support is added to print the summary as YAML comments when displaying
both the raw and indexed profiles via `llvm-profdata show`. Because they
are YAML comments, the YAML reader ignores these (the summary is always
recomputed when building the indexed profile as described above).

This necessitated moving some options and a couple of interfaces out of
Analysis/MemoryProfileInfo.cpp and into the new
ProfileData/MemProfSummary.cpp file, as we need to classify context
hotness earlier and also compute context ids to build the summary from
older indexed profiles.



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