[PATCH] D66374: [SampleFDO] Add symbol whitelist in the profile and use it when profile-sample-accurate is enabled

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 16:56:42 PDT 2019


wmi created this revision.
wmi added reviewers: davidxl, mtrofin.
Herald added a subscriber: mgrang.
Herald added a project: LLVM.

For sampleFDO, because the optimized build uses profile generated from previous release, we cannot tell a function without profile is truely cold or just newly created. Currently we treat them conservatively and put them in .text section instead of .text.unlikely. The result is when we persuing the best performance by locking .text.hot and .text in memory, and use huge pages for them, we waste a lot of memory and huge pages for functions actually being cold.

The patch add a new section to the profile. The section contains a list of function names showing up in the binary used to generate the current profile. During profile use compilation, when profile-sample-accurate is enabled, a function without profile will be regarded as cold only when it is contained in that list.

In order to add the symbol whitelist to the profile, I extend the profile format so it is easier to add a new section or extend an existing section in the future.


Repository:
  rL LLVM

https://reviews.llvm.org/D66374

Files:
  include/llvm/ProfileData/SampleProf.h
  include/llvm/ProfileData/SampleProfReader.h
  include/llvm/ProfileData/SampleProfWriter.h
  lib/ProfileData/SampleProf.cpp
  lib/ProfileData/SampleProfReader.cpp
  lib/ProfileData/SampleProfWriter.cpp
  lib/Transforms/IPO/SampleProfile.cpp
  test/Transforms/SampleProfile/Inputs/inline.extbinary.afdo
  test/Transforms/SampleProfile/compact-binary-profile.ll
  test/Transforms/SampleProfile/profile-format.ll
  test/Transforms/SampleProfile/symbol-white-list.ll
  tools/llvm-profdata/llvm-profdata.cpp
  unittests/ProfileData/SampleProfTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66374.215717.patch
Type: text/x-patch
Size: 54650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/9be979b8/attachment.bin>


More information about the llvm-commits mailing list