[llvm-branch-commits] [llvm] [BOLT] Match functions with pseudo probes (PR #100446)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 11 15:35:18 PDT 2024
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/100446
>From 56b45b104a2ab2dbc4ab8e9643c90092894b579e Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:29:22 -0700
Subject: [PATCH 1/4] Comment
Created using spr 1.3.4
---
bolt/include/bolt/Profile/YAMLProfileReader.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/include/bolt/Profile/YAMLProfileReader.h b/bolt/include/bolt/Profile/YAMLProfileReader.h
index 6c00f82302fb92..bc09751fcae75e 100644
--- a/bolt/include/bolt/Profile/YAMLProfileReader.h
+++ b/bolt/include/bolt/Profile/YAMLProfileReader.h
@@ -108,7 +108,7 @@ class YAMLProfileReader : public ProfileReaderBase {
std::vector<BinaryFunction *> YamlProfileToFunction;
using FunctionSet = std::unordered_set<const BinaryFunction *>;
- /// To keep track of functions that have a matched profile before the profilez
+ /// To keep track of functions that have a matched profile before the profile
/// is attributed.
FunctionSet ProfiledFunctions;
>From b851ca65c2bf2a9569315d62722b60a04c8102ee Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:39:48 -0700
Subject: [PATCH 2/4] Was accessing wrong YamlBF Hash, fixed
Created using spr 1.3.4
---
bolt/lib/Profile/YAMLProfileReader.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 68af95a1cd043e..f5ac0b8e2c56a2 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -614,7 +614,7 @@ size_t YAMLProfileReader::matchWithPseudoProbes(BinaryContext &BC) {
uint64_t MatchedWithPseudoProbes = 0;
for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
- auto It = PseudoProbeDescHashToBF.find(YamlBF.Hash);
+ auto It = PseudoProbeDescHashToBF.find(YamlBF.PseudoProbeDescHash);
if (It == PseudoProbeDescHashToBF.end())
continue;
BinaryFunction *BF = It->second;
>From 39ba7175c9224c3584db7f5f8ca8fbed14da41e5 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 11:49:54 -0700
Subject: [PATCH 3/4] Changed ordering of matching
Created using spr 1.3.4
---
bolt/lib/Profile/YAMLProfileReader.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index f5ac0b8e2c56a2..75ec4465856a15 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -770,8 +770,8 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
const size_t MatchedWithHash = matchWithHash(BC);
const size_t MatchedWithLTOCommonName = matchWithLTOCommonName();
const size_t MatchedWithCallGraph = matchWithCallGraph(BC);
- const size_t MatchedWithNameSimilarity = matchWithNameSimilarity(BC);
const size_t MatchedWithPseudoProbes = matchWithPseudoProbes(BC);
+ const size_t MatchedWithNameSimilarity = matchWithNameSimilarity(BC);
for (auto [YamlBF, BF] : llvm::zip_equal(YamlBP.Functions, ProfileBFs))
if (!YamlBF.Used && BF && !ProfiledFunctions.count(BF))
@@ -792,10 +792,10 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
<< " functions with matching LTO common names\n";
outs() << "BOLT-INFO: matched " << MatchedWithCallGraph
<< " functions with call graph\n";
- outs() << "BOLT-INFO: matched " << MatchedWithNameSimilarity
- << " functions with similar names\n";
outs() << "BOLT-INFO: matched " << MatchedWithPseudoProbes
<< " functions with pseudo probes\n";
+ outs() << "BOLT-INFO: matched " << MatchedWithNameSimilarity
+ << " functions with similar names\n";
}
// Set for parseFunctionProfile().
>From 11af7f19953da7c5ad4eb263be3d38a70b2518e0 Mon Sep 17 00:00:00 2001
From: shawbyoung <shawbyoung at gmail.com>
Date: Wed, 24 Jul 2024 12:56:56 -0700
Subject: [PATCH 4/4] Added check for YamlBF.Used in pseudo probe function
matching
Created using spr 1.3.4
---
bolt/lib/Profile/YAMLProfileReader.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 75ec4465856a15..8dfdf1fb30eb36 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -614,6 +614,8 @@ size_t YAMLProfileReader::matchWithPseudoProbes(BinaryContext &BC) {
uint64_t MatchedWithPseudoProbes = 0;
for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
+ if (YamlBF.Used)
+ continue;
auto It = PseudoProbeDescHashToBF.find(YamlBF.PseudoProbeDescHash);
if (It == PseudoProbeDescHashToBF.end())
continue;
More information about the llvm-branch-commits
mailing list