[all-commits] [llvm/llvm-project] 3f9701: [llvm-profgen] Decoding pseudo probe for profiled ...

Hongtao Yu via All-commits all-commits at lists.llvm.org
Wed Mar 23 14:15:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f97016857b0305294f3a55ea220884fb50ce033
      https://github.com/llvm/llvm-project/commit/3f97016857b0305294f3a55ea220884fb50ce033
  Author: Hongtao Yu <hoy at fb.com>
  Date:   2022-03-23 (Wed, 23 Mar 2022)

  Changed paths:
    M llvm/include/llvm/MC/MCPseudoProbe.h
    M llvm/lib/MC/MCPseudoProbe.cpp
    M llvm/test/tools/llvm-profgen/noinline-cs-pseudoprobe.test
    M llvm/test/tools/llvm-profgen/recursion-compression-pseudoprobe.test
    M llvm/tools/llvm-profgen/PerfReader.cpp
    M llvm/tools/llvm-profgen/PerfReader.h
    M llvm/tools/llvm-profgen/ProfileGenerator.cpp
    M llvm/tools/llvm-profgen/ProfileGenerator.h
    M llvm/tools/llvm-profgen/ProfiledBinary.cpp
    M llvm/tools/llvm-profgen/ProfiledBinary.h

  Log Message:
  -----------
  [llvm-profgen] Decoding pseudo probe for profiled function only.

Complete pseudo probes decoding can result in large memory usage. In practice only a small porting of the decoded probes are used in profile generation. I'm changing the full decoding mode to be decoding for profiled functions only, though we still do a full scan of the .pseudoprobe section due to a missing table-of-content but we don't have to build the in-memory data structure for functions not sampled.

To build the in-memory data structure for profiled functions only, I'm rewriting the previous non-recursive probe decoding logic to be recursive. This is easy to read and maintain.

I also have to change the previous representation of unsymbolized context from probe-based stack to address-based stack since the profiled functions are unknown yet by the time of virtual unwinding. The address-based stack will be converted to probe-based stack after virtual unwinding and on-demand probe decoding.

I'm seeing 20GB memory is saved for one of our internal large service.

Reviewed By: wenlei

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




More information about the All-commits mailing list