[llvm] [CSSPGO] Compute and report profile matching recovered callsites and samples (PR #79090)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 18:30:19 PST 2024
================
@@ -444,15 +444,36 @@ class SampleProfileMatcher {
// the profile.
StringMap<LocToLocMap> FuncMappings;
- // Profile mismatching statstics.
+ // Match state for an anchor/callsite.
+ enum class MatchState {
+ Matched = 0,
+ Mismatched = 1,
+ // Stay Matched after profile matching.
+ StayMatched = 2,
+ // Recovered from Mismatched after profile matching.
+ Recovered = 3,
+ Unknown = 32,
+ };
+
+ // For each function, store every callsite and its matching state into this
+ // map, of which each entry is a pair of callsite location and MatchState.
+ // This is used for profile staleness computation and report.
+ StringMap<std::unordered_map<LineLocation, MatchState, LineLocationHash>>
----------------
wlei-llvm wrote:
I see. If we have the memory pressure, another option is to consolidate the two StringMap
```
StringMap<LocToLocMap> FuncMappings;
StringMap<std::unordered_map<LineLocation, MatchState, LineLocationHash>> FuncCallsiteMatchStates;
```
Into one map, like
```
StringMap<std::pair<LocToLocMap, std::unordered_map<LineLocation, MatchState, LineLocationHash>>> FuncXXX...
```
the Key of `LocToLocMap` is also a LineLocation, I was thinking to further merge them
```
StringMap<std::unordered_map<LineLocation, std::pair<LineLocation, MatchState>, LineLocationHash>>> FuncXXX...
```
but unfortunately the key of `LocToLocMap` is `IRlocation` but the latter's key is the `ProfileLocation`, so merging them might be too hacky and confusing.
https://github.com/llvm/llvm-project/pull/79090
More information about the llvm-commits
mailing list