[PATCH] D86332: [SampleFDO] Enhance profile remapping support for inline instance

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 23:06:45 PDT 2020


wmi created this revision.
wmi added reviewers: wenlei, rsmith, davidxl, hoyFB.
Herald added subscribers: kristina, hiraditya, mgorny.
Herald added a project: LLVM.
wmi requested review of this revision.

Profile remapping is a feature to match a function in the module with its profile in sample profile if the function name and the name in profile look different but are equivalent using given remapping rules. This is a useful feature to keep the performance stable by specifying some remapping rules when sampleFDO targets are going through some large scale function signature change.

However, currently profile remapping support is only valid for outline function profile in SampleFDO. It cannot match a callee with an inline instance profile if they have different but equivalent names. We found that without the support for inline instance profile, remapping is less effective for some large scale change.

To add that support, the patch introduces a temporary remapper in addition to the current remapper used for outline function profile. The temporary remapper will be populated with remapping rules at the same time as the regular remapper. At a callsite when compiler tries to find an inline instance profile to match with the callee, it will be populated with all the inline instance profiles at the same location as the callsite first, then check whether the callee name exists in the remapper. After the matching is done, the remapper should be cleared except that the remapping rules should be kept, that is why it is called temporary remapper. The clearing is necessary to prevent the callee name from being mistakenly matched with an inline instance profile at a different location or with an outline profile.

In a planned large scale change of int64 type (long long) to int64_t (long), we found the performance of a google internal benchmark degraded by 2% if nothing was done. That was very significant for us. If current profile remapping was enabled, the performance degradation dropped to 1.2%, and it was still significant. If the profile remapping with the current patch was enabled, the performance degradation further dropped to 0.14%, and that was small enough to be acceptable.


Repository:
  rL LLVM

https://reviews.llvm.org/D86332

Files:
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/ProfileData/SampleProf.h
  llvm/include/llvm/ProfileData/SampleProfReader.h
  llvm/include/llvm/Support/ItaniumManglingCanonicalizer.h
  llvm/include/llvm/Support/SymbolRemappingReader.h
  llvm/lib/ProfileData/SampleProf.cpp
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/lib/Support/ItaniumManglingCanonicalizer.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/unittests/ProfileData/SampleProfTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86332.286953.patch
Type: text/x-patch
Size: 16468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/6b330063/attachment.bin>


More information about the llvm-commits mailing list