[PATCH] D110449: [llvm-profdata] Extend support of --topn to sample profiles

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 15:33:49 PDT 2021


wenlei added a comment.

In D110449#3021864 <https://reviews.llvm.org/D110449#3021864>, @modimo wrote:

> In D110449#3021837 <https://reviews.llvm.org/D110449#3021837>, @wenlei wrote:
>
>> `hot-func-list` of sample pgo is the equivalent of `topn` for instr pgo. Sample pgo diverged from instr pgo here in the sense we use `hot-func-list` to print a hot function list where "hot" is defined by the dyn-instr percentile based threshold. So simply adding topn might be confusing, as using topn alone for sample pgo won't print the hot function list, unlike instr pgo.
>>
>> if you want to grow or trim the hot function list, you could use the threshold cutoff switches. Ideally we should unify the switches for both instr pgo and sample pgo.
>
> My usage of `topn` was to be able to compare and analyze a fixed number of functions rather than defining different cut-off values to get similar effects across many different binaries. That being said, this was all running in a script so I could've also had the script do this pruning instead of llvm-profdata.
>
> Unifying switches was the main reason I added this to prof-data, since `topn` being documented but being a complete no-op in sample profile threw me off.

topn alone would still not do anything with your change. perhaps when topn is on, the hot func list should be printed. llvm-profdata has many switches that are only applicable to either instr. pgo or sample pgo (showcs for ipgo, show-prof-sym-list for spgo, etc..)



================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:2454
 
   if (ShowHotFuncList)
+    showHotFunctionList(Reader->getProfiles(), Reader->getSummary(), TopN, OS);
----------------
`ShowHotFuncList || TopN` would make it more consistent between instr pgo and sample pgo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110449/new/

https://reviews.llvm.org/D110449



More information about the llvm-commits mailing list