[all-commits] [llvm/llvm-project] 339b8a: [AutoFDO] Use flattened profiles for profile stale...
ictwanglei via All-commits
all-commits at lists.llvm.org
Thu Mar 30 11:05:39 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 339b8a0019658746217870215abca77291ad75b3
https://github.com/llvm/llvm-project/commit/339b8a0019658746217870215abca77291ad75b3
Author: wlei <wlei at fb.com>
Date: 2023-03-30 (Thu, 30 Mar 2023)
Changed paths:
M llvm/docs/CommandGuide/llvm-profdata.rst
M llvm/include/llvm/ProfileData/SampleProf.h
M llvm/lib/ProfileData/SampleProf.cpp
M llvm/lib/Transforms/IPO/SampleProfile.cpp
A llvm/test/Transforms/SampleProfile/Inputs/profile-mismatch-cs.prof
M llvm/test/Transforms/SampleProfile/Inputs/profile-mismatch.prof
M llvm/test/Transforms/SampleProfile/csspgo-inline.ll
M llvm/test/Transforms/SampleProfile/csspgo-use-preinliner.ll
A llvm/test/Transforms/SampleProfile/profile-mismatch-flattened-profile.ll
M llvm/test/Transforms/SampleProfile/profile-mismatch.ll
A llvm/test/tools/llvm-profdata/Inputs/sample-flatten-profile-cs.proftext
A llvm/test/tools/llvm-profdata/Inputs/sample-flatten-profile.proftext
M llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test
A llvm/test/tools/llvm-profdata/sample-flatten-profile.test
M llvm/tools/llvm-profdata/llvm-profdata.cpp
M llvm/tools/llvm-profgen/ProfileGenerator.cpp
Log Message:
-----------
[AutoFDO] Use flattened profiles for profile staleness metrics
For profile staleness report, before it only counts for the top-level function samples in the nested profile, the samples in the inlinees are ignored. This could affect the quality of the metrics when there are heavily inlined functions. This change adds a feature to flatten the nested profile and we're changing to use flatten profile as the input for stale profile detection and matching.
Example for profile flattening:
```
Original profile:
_Z3bazi:20301:1000
1: 1000
3: 2000
5: inline1:1600
1: 600
3: inline2:500
1: 500
Flattened profile:
_Z3bazi:18701:1000
1: 1000
3: 2000
5: 600 inline1:600
inline1:1100:600
1: 600
3: 500 inline2: 500
inline2:500:500
1: 500
```
This feature could be useful for offline analysis, like understanding the hotness of each individual function. So I'm adding the support to `llvm-profdata merge` under `--gen-flattened-profile`.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D146452
More information about the All-commits
mailing list