forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SampleFDO] Compute and report profile staleness metrics
When a profile is stale and profile mismatch could happen, the mismatched samples are discarded, so we'd like to compute the mismatch metrics to quantify how stale the profile is, which will suggest user to refresh the profile if the number is high. Two sets of metrics are introduced here: - (Num_of_mismatched_funchash/Total_profiled_funchash), (Samples_of_mismached_func_hash / Samples_of_profiled_function) : Here it leverages the FunctionSamples's checksums attribute which is a feature of pseudo probe. When the source code CFG changes, the function checksums will be different, later sample loader will discard the whole functions' samples, this metrics can show the percentage of samples are discarded due to this. - (Num_of_mismatched_callsite/Total_profiled_callsite), (Samples_of_mismached_callsite / Samples_of_profiled_callsite) : This shows how many mismatching for the callsite location as callsite location mismatch will affect the inlining which is highly correlated with the performance. It goes through all the callsite location in the IR and profile, use the call target name to match, report the num of samples in the profile that doesn't match a IR callsite. This is implemented in a new class(SampleProfileMatcher) and under a switch("--report-profile-staleness"), we plan to extend it with a fuzzy profile matching feature in the future. Reviewed By: hoy, wenlei, davidxl Differential Revision: https://reviews.llvm.org/D136627
- Loading branch information
Showing
6 changed files
with
619 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
llvm/test/Transforms/SampleProfile/Inputs/profile-mismatch.prof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
main:30:0 | ||
0: 0 | ||
1.1: 0 | ||
3: 10 matched:10 | ||
4: 10 | ||
5: 10 bar_mismatch:10 | ||
8: 0 | ||
7: foo:10 | ||
1: 5 | ||
2: 5 | ||
bar:10:10 | ||
1: 10 | ||
matched:10:10 | ||
1: 10 |
14 changes: 14 additions & 0 deletions
14
llvm/test/Transforms/SampleProfile/Inputs/pseudo-probe-profile-mismatch.prof
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
main:30:0 | ||
1: 0 | ||
12: 10 matched:10 | ||
20: 10 bar:10 | ||
13: foo_mismatch:10 | ||
1: 10 | ||
!CFGChecksum: 4294967295 | ||
!CFGChecksum: 844635331715433 | ||
bar:10:10 | ||
1: 10 | ||
!CFGChecksum: 42949671295 | ||
matched:10:10 | ||
1: 10 | ||
!CFGChecksum: 4294967295 |
Oops, something went wrong.