[PATCH] D139603: [llvm-profdata] Add option to cap profile output size

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 16:51:23 PST 2022


huangjd added inline comments.


================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:1089-1091
+      size_t NumToRemove = CalculateNumFunctionsToRemove(
+          OriginalFunctionCount, Functions->size(),
+          Writer->getOutputStream().tell(), OutputSizeLimit);
----------------
huangjd wrote:
> wenlei wrote:
> > This heuristic can be quite inaccurate. The number of body sample + call site sample entries can be much better proxy for actual profile size and yet still easily accessible. 
> > 
> > `functionSamples.getBodySamples().size() + functionSamples.getCallsiteSamples().size()`
> The new revision performs the iterations on a string buffer so the performance of the heuristic is not a big concern (and now it should not overshoot by reducing too many functions). Although  using a simple proportional heuristic is still too slow because it ends up reducing one function at the tail at a time
Better heuristics  can be added in a later patch. Need more real world profile data (industrial use) to confirm which model is the best


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139603



More information about the llvm-commits mailing list