-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[BOLT] Drop blocks without profile in BAT YAML #107970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BOLT] Drop blocks without profile in BAT YAML #107970
Conversation
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
@llvm/pr-subscribers-bolt Author: Amir Ayupov (aaupov) ChangesAlign BAT YAML (DataAggregator) to YAMLProfileWriter which drops blocks Test Plan: NFCI Full diff: https://github.com/llvm/llvm-project/pull/107970.diff 1 Files Affected:
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 10d745cc69824b..4aeeb1daab1b94 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2427,11 +2427,15 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
}
}
}
- // Drop blocks without a hash, won't be useful for stale matching.
- llvm::erase_if(YamlBF.Blocks,
- [](const yaml::bolt::BinaryBasicBlockProfile &YamlBB) {
- return YamlBB.Hash == (yaml::Hex64)0;
- });
+ // Skip printing if there's no profile data
+ llvm::erase_if(
+ YamlBF.Blocks, [](const yaml::bolt::BinaryBasicBlockProfile &YamlBB) {
+ auto HasCount = [](const auto &SI) { return SI.Count; };
+ bool HasAnyCount = YamlBB.ExecCount ||
+ llvm::any_of(YamlBB.Successors, HasCount) ||
+ llvm::any_of(YamlBB.CallSites, HasCount);
+ return !HasAnyCount;
+ });
BP.Functions.emplace_back(YamlBF);
}
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4 [skip ci]
Add probe inline tree information to YAML profile, at function level: - function GUID, - checksum, - parent node id, - call site in the parent. This information is used for pseudo probe block matching (#99891). The encoding adds/changes probe information in multiple levels of YAML profile: - BinaryProfile: add pseudo_probe_desc with GUIDs and Hashes, which permits deduplication of data: - many GUIDs are duplicate as the same callee is commonly inlined into multiple callers, - hashes are also very repetitive, especially for functions with low block counts. - FunctionProfile: add inline tree (see above). Top-level function is included as root of function inline tree, which makes guid and pseudo_probe_desc_hash fields redundant. - BlockProfile: densely-encoded block probe information: - probes reference their containing inline tree node, - separate lists for block, call, indirect call probes, - block probe encoding is specialized: ids are encoded as bitset in uint64_t. If only block probe with id=1 is present, it's encoded as implicit entry (id=0, omitted). - inline tree nodes with identical probes share probe description where node indices are combined into a list. On top of #107970, profile with new probe encoding has the following characteristics (profile for a large binary): - Profile without probe information: 33MB, 3.8MB compressed (baseline). - Profile with inline tree information: 92MB, 14MB compressed. Profile processing time (YAML parsing, inference, attaching steps): - profile without pseudo probes: 5s, - profile with pseudo probes, without pseudo probe matching: 11s, - with pseudo probe matching: 12.5s. Test Plan: updated pseudoprobe-decoding-inline.test Reviewers: wlei-llvm, ayermolo, rafaelauler, dcci, maksfb Reviewed By: wlei-llvm, rafaelauler Pull Request: #107137
Align BAT YAML (DataAggregator) to YAMLProfileWriter which drops blocks
without profile:
llvm-project/bolt/lib/Profile/YAMLProfileWriter.cpp
Lines 162 to 176 in 61372fc
Test Plan: NFCI