[PATCH] D152399: [CodeGen] Fine tune MachineFunctionSplitPass (MFS) for FSAFDO.

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 14:44:03 PDT 2023


shenhan created this revision.
shenhan added reviewers: xur, tmsriram.
shenhan added a project: LLVM.
Herald added subscribers: wlei, wenlei, pengfei, ormris, hiraditya.
Herald added a project: All.
shenhan requested review of this revision.
Herald added a subscriber: llvm-commits.

The original MFS work D85368 <https://reviews.llvm.org/D85368> shows good performance improvement with Instrumented FDO. However, AutoFDO or Flow-Sensitive AutoFDO (FSAFDO) does not show performance gain. This is mainly caused by a less accurate profile compared to the iFDO profile.

For the past few months, we have been working to improve FSAFDO quality, like in  D145171 <https://reviews.llvm.org/D145171>. Taking advantage of this improvement, MFS now shows performance improvements over FSAFDO profiles.

That being said, 2 minor changes need to be made, 1) An FS-AutoFDO profile generation pass needs to be added right before MFS pass and an FSAFDO profile load pass is needed when FS-AutoFDO is enabled and the MFS flag is present. 2) MFS only applies to hot functions, because we believe (and experiment also shows) FS-AutoFDO is more accurate about functions that have plenty of samples than those with no or very few samples.

With this patch, we see a 1.2% performance improvement in clang benchmark, 0.9% QPS improvement in our internal search benchmark, and 3%-5% improvement in internal storage benchmark.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152399

Files:
  llvm/include/llvm/CodeGen/Passes.h
  llvm/lib/CodeGen/MachineFunctionSplitter.cpp
  llvm/lib/CodeGen/TargetPassConfig.cpp
  llvm/test/CodeGen/X86/fsafdo_mfs_test.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152399.529439.patch
Type: text/x-patch
Size: 14122 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230607/3f2e67db/attachment.bin>


More information about the llvm-commits mailing list