[all-commits] [llvm/llvm-project] 148cce: [CSSPGO] Refactoring SampleProfileMatcher::runOnFu...
ictwanglei via All-commits
all-commits at lists.llvm.org
Wed Aug 30 18:01:44 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 148cceb0d6b5229fd57edd81a3c795da1a0cdbb1
https://github.com/llvm/llvm-project/commit/148cceb0d6b5229fd57edd81a3c795da1a0cdbb1
Author: wlei <wlei at fb.com>
Date: 2023-08-30 (Wed, 30 Aug 2023)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfile.cpp
M llvm/test/Transforms/SampleProfile/profile-mismatch.ll
Log Message:
-----------
[CSSPGO] Refactoring SampleProfileMatcher::runOnFunction
- rename `IRLocation` --> `IRAnchors`, `ProfileLocation` --> `ProfileAnchors`
- reorganize runOnFunction, fact out the finding IR anchors code into `findIRAnchors`
- introduce a new function `findProfileAnchors` to populate the profile related anchors, the result is saved into `ProfileAnchors`, it's later used for both mismatch report and matching, this can avoid to parse the `getBodySamples` and `getCallsiteSamples` for multiple times.
- move the `MatchedCallsiteLocs` stuffs from `findIRAnchors` to `countProfileMismatches` so that all the staleness metrics report are computed in one function.
- move all matching related into `runStaleProfileMatching`, and move all mismatching report into `countProfileMismatches`
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D158817
Commit: 062af2e76366ec1e4f3201f95c1a961a1861ba58
https://github.com/llvm/llvm-project/commit/062af2e76366ec1e4f3201f95c1a961a1861ba58
Author: wlei <wlei at fb.com>
Date: 2023-08-30 (Wed, 30 Aug 2023)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfile.cpp
A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-matching-lto.prof
A llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-matching-lto.ll
Log Message:
-----------
[CSSPGO] Support stale profile matching for LTO
As in per-link time, callsites could be optimized out by inlining, we don't have those original call targets in the IR in LTO time. Additionally, the inlined code doesn't actually belong to the original function, the IR locations or pseudo probe parsed from it are incorrect and could mislead the matching later.
This change adds the support to extract the original IR location info from the inlined code, specifically, it make sure to skip all the inlined code that doesn't belong the original function, but before that, it processes the inline frames of the debug info to extract the base frame and recover its callsite and callee target(name).
Measured on some stale profile instances, all showed some perf improvements.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D156722
Commit: 62a3f6c96eb3051fda0a84e2419fc80244c9aca2
https://github.com/llvm/llvm-project/commit/62a3f6c96eb3051fda0a84e2419fc80244c9aca2
Author: wlei <wlei at fb.com>
Date: 2023-08-30 (Wed, 30 Aug 2023)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfile.cpp
R llvm/test/Transforms/SampleProfile/profile-mismatch-flattened-profile.ll
M llvm/test/Transforms/SampleProfile/profile-mismatch.ll
Log Message:
-----------
[CSSPGO] Retire FlattenProfileForMatching
- Always use flattened profile to find the profile anchors. Since profile under different contexts may have different inlined callsites, to get more profile anchors, we use a merged profile from all the contexts(the flattened profile) to find callsite anchors.
- Compute the staleness metrics based on the original nested profile, as currently once a callsite is mismatched, all its children profile are dropped.(TODO: in future, we can improve to reuse the children valid profile)
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D158891
Commit: 3365cd4544072949e64f6745575be19346ff04a7
https://github.com/llvm/llvm-project/commit/3365cd4544072949e64f6745575be19346ff04a7
Author: wlei <wlei at fb.com>
Date: 2023-08-30 (Wed, 30 Aug 2023)
Changed paths:
M llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
M llvm/lib/Transforms/IPO/SampleProfile.cpp
A llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-mismatch-nested.prof
M llvm/test/Transforms/SampleProfile/pseudo-probe-profile-mismatch.ll
Log Message:
-----------
[CSSPGO] Compute checksum mismatch recursively on nested profile
Follow-up diff for https://reviews.llvm.org/D158891. Compute the checksum mismatch based on the original nested profile. Additionally, use a recursive way to compute the children mismatched samples in the nested tree even the top-level func checksum is matched.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D158900
Commit: 4bb6bbb9bf76b3314b91e146bcebd32cb0f7b567
https://github.com/llvm/llvm-project/commit/4bb6bbb9bf76b3314b91e146bcebd32cb0f7b567
Author: wlei <wlei at fb.com>
Date: 2023-08-30 (Wed, 30 Aug 2023)
Changed paths:
M llvm/lib/Transforms/IPO/SampleProfile.cpp
M llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-stale-profile-matching-lto.prof
A llvm/test/Transforms/SampleProfile/pseudo-probe-profile-mismatch-thinlto.ll
Log Message:
-----------
[CSSPGO] Skip reporting staleness metrics for imported functions
Accumulating the staleness metrics from per-link is less accurate than doing it from post-link time(assuming we use the offline profile mismatch as baseline), the reason is that there are some duplicated reports for the same functions, for example, one template function could be included in multiple TUs, but in post thin link time, only one function are kept(linkonce_odr) and others are marked as available-externally function. Hence, this change skips reporting the metrics for imported functions(available-externally).
I saw the post-link number is now very close to the offline number(dump the mismatched functions and count the metrics offline based on the entire profile), sightly smaller than offline number due to some missing inlined functions.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D156725
Compare: https://github.com/llvm/llvm-project/compare/394e52a0bb57...4bb6bbb9bf76
More information about the All-commits
mailing list