[all-commits] [llvm/llvm-project] 74799f: [memprof] Add call stack IDs to IndexedAllocationI...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sat Mar 23 19:50:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 74799f424063a2d751e0f9ea698db1f4efd0d8b2
      https://github.com/llvm/llvm-project/commit/74799f424063a2d751e0f9ea698db1f4efd0d8b2
  Author: Kazu Hirata <kazu at google.com>
  Date:   2024-03-23 (Sat, 23 Mar 2024)

  Changed paths:
    M llvm/include/llvm/ProfileData/MemProf.h
    M llvm/lib/ProfileData/MemProf.cpp
    M llvm/lib/ProfileData/RawMemProfReader.cpp
    M llvm/unittests/ProfileData/InstrProfTest.cpp
    M llvm/unittests/ProfileData/MemProfTest.cpp

  Log Message:
  -----------
  [memprof] Add call stack IDs to IndexedAllocationInfo (#85888)

The indexed MemProf file has a huge amount of redundancy.  In a large
internal application, 82% of call stacks, stored in
IndexedAllocationInfo::CallStack, are duplicates.

We should work toward deduplicating call stacks by referring to them
with unique IDs with actual call stacks stored in a separate data
structure, much like we refer to memprof::Frame with memprof::FrameId.

At the same time, we need to facilitate a graceful transition from the
current version of the MemProf format to the next.  We should be able
to read (but not write) the current version of the MemProf file even
after we move onto the next one.

With those goals in mind, I propose to have an integer ID next to
CallStack in IndexedAllocationInfo to refer to a call stack in a
succinct manner.  We'll gradually increase the areas of the compiler
where IDs and call stacks have one-to-one correspondence and
eventually remove the existing CallStack field.

This patch adds call stack ID, named CSId, to IndexedAllocationInfo
and teaches the raw profile reader to compute unique call stack IDs
and store them in the new field.  It does not introduce any user of
the call stack IDs yet, except in verifyFunctionProfileData.



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