[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-08 Thread Amir Ayupov via llvm-branch-commits
aaupov wrote: > > > Ping @wlei-llvm > > > > > > Sorry for the delay. The new version addressed my last comment (with just > > minor nits). However, I didn't fully follow the new features related to > > `ProbeMatchSpecs` stuffs. Could you add more descriptions to the diff > > summary? Or if i

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-06 Thread Lei Wang via llvm-branch-commits
@@ -447,12 +561,12 @@ createFlowFunction(const BinaryFunction::BasicBlockOrderType &BlockOrder) { /// of the basic blocks in the binary, the count is "matched" to the block. /// Similarly, if both the source and the target of a count in the profile are /// matched to a jump in

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-06 Thread Lei Wang via llvm-branch-commits
@@ -482,11 +596,68 @@ matchWeightsByHashes(BinaryContext &BC, << Twine::utohexstr(BB->getHash()) << "\n"); } StaleMatcher Matcher; + // Collects function pseudo probes for use in the StaleMatcher. + if (opts::StaleMatchingWithPseudoProbes) { +con

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-11-06 Thread Lei Wang via llvm-branch-commits
wlei-llvm wrote: > > Ping @wlei-llvm > > Sorry for the delay. The new version addressed my last comment (with just > minor nits). However, I didn't fully follow the new features related to > `ProbeMatchSpecs` stuffs. Could you add more descriptions to the diff > summary? Or if it’s not a lot

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-10-28 Thread Lei Wang via llvm-branch-commits
@@ -628,9 +618,75 @@ void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( } } } -if (Cur && Decoder.getFuncDescForGUID(GUID)->FuncHash == Hash) +// Don't match nodes if the profile is stale (mismatching binary FuncHash +// and YAML Hash)

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-10-28 Thread Lei Wang via llvm-branch-commits
@@ -722,12 +722,28 @@ class BinaryContext { /// Stats for stale profile matching: /// the total number of basic blocks in the profile uint32_t NumStaleBlocks{0}; -/// the number of matched basic blocks -uint32_t NumMatchedBlocks{0}; +/// the number

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-10-28 Thread Lei Wang via llvm-branch-commits
wlei-llvm wrote: > Ping @wlei-llvm Sorry for the delay. The new version addressed my last comment (with just minor nits). However, I didn't fully follow the new features related to `ProbeMatchSpecs` stuffs. Could you add more descriptions to the diff summary? Or if it’s not a lot of work, cou

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-10-28 Thread Amir Ayupov via llvm-branch-commits
aaupov wrote: Ping @wlei-llvm https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/3] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
@@ -0,0 +1,62 @@ +## Tests stale block matching with pseudo probes. + +# REQUIRES: system-linux +# RUN: split-file %s %t +# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib +# RUN: llvm-bolt %t.exe -

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
@@ -722,6 +770,15 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) { } } + if (opts::StaleMatchingWithPseudoProbes) { +const MCPseudoProbeDecoder *Decoder = BC.getPseudoProbeDecoder(); +assert(Decoder && + "If pseudo probes are in use, pseudo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-26 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Amir Ayupov via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Amir Ayupov via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Amir Ayupov via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { +DenseMap Map; + +void mapInlineTreeNode(uint32_t ProfileNo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { +DenseMap Map; + +void mapInlineTreeNode(uint32_t ProfileNo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { +DenseMap Map; wlei-llvm wrote: add comments

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -266,6 +305,69 @@ class StaleMatcher { } return BestBlock; } + + /// Matches a profile block with an binary block based on pseudo probes. wlei-llvm wrote: nit: `an` -> `a` https://github.com/llvm/llvm-project/pull/99891 _

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { +DenseMap Map; + +void mapInlineTreeNode(uint32_t ProfileNo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -96,6 +101,42 @@ class YAMLProfileReader : public ProfileReaderBase { YamlBFAdjacencyMap; }; + // A class for matching inline tree nodes between profile and binary. + class InlineTreeNodeMapTy { +DenseMap Map; + +void mapInlineTreeNode(uint32_t ProfileNo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -0,0 +1,62 @@ +## Tests stale block matching with pseudo probes. + +# REQUIRES: system-linux +# RUN: split-file %s %t +# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib +# RUN: llvm-bolt %t.exe -

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -722,12 +722,28 @@ class BinaryContext { /// Stats for stale profile matching: /// the total number of basic blocks in the profile uint32_t NumStaleBlocks{0}; -/// the number of matched basic blocks -uint32_t NumMatchedBlocks{0}; +/// the number

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -266,6 +305,69 @@ class StaleMatcher { } return BestBlock; } + + /// Matches a profile block with an binary block based on pseudo probes. + /// Returns the best matching block (or nullptr) and whether the match is + /// unambiguous. + std::pair matchWithPseudoP

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -722,6 +770,15 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) { } } + if (opts::StaleMatchingWithPseudoProbes) { +const MCPseudoProbeDecoder *Decoder = BC.getPseudoProbeDecoder(); +assert(Decoder && + "If pseudo probes are in use, pseudo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { return MatchedWithCallGraph; } +void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees( +const MCPseudoProbeDecoder &Decoder, +const yaml::bolt::PseudoProbeDesc &YamlPD, +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-18 Thread Lei Wang via llvm-branch-commits
@@ -482,6 +584,30 @@ matchWeightsByHashes(BinaryContext &BC, << Twine::utohexstr(BB->getHash()) << "\n"); } StaleMatcher Matcher; + // Collects function pseudo probes for use in the StaleMatcher. + if (opts::StaleMatchingWithPseudoProbes) { +cons

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-11 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-04 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-04 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH 1/2] Reworked block probe matching Use new probe ifaces Get all func

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-04 Thread via llvm-branch-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff bfa0afc8fd9a4cfb4c44146379ea2f6e231661cc 0f455d09f5d2bcd07278debd55e76dfbc1162472 --e

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-04 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH] Reworked block probe matching Use new probe ifaces Get all function

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-09-04 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99891 >From 36197b175681d07b4704e576fb008cec3cc1e05e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Wed, 28 Aug 2024 21:10:25 +0200 Subject: [PATCH] Reworked block probe matching Use new probe ifaces Get all function

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-30 Thread via llvm-branch-commits
@@ -223,10 +249,31 @@ class StaleMatcher { return Hash1.InstrHash == Hash2.InstrHash; } + /// Returns true if a profiled block was matched with its pseudo probe. + bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) { +return MatchedWithPseudoProbes.find(YamlBBHas

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-26 Thread Lei Wang via llvm-branch-commits
https://github.com/wlei-llvm deleted https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-26 Thread Shaw Young via llvm-branch-commits
@@ -478,10 +675,34 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -478,10 +675,34 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -266,6 +325,122 @@ class StaleMatcher { } return BestBlock; } + + /// A helper function for logging. + static bool LogErrIfExpr(bool Expr, StringRef Message) { +if (Expr) + errs() << Message; +return Expr; + } + + /// Matches an inlined profile blo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -266,6 +325,122 @@ class StaleMatcher { } return BestBlock; } + + /// A helper function for logging. + static bool LogErrIfExpr(bool Expr, StringRef Message) { +if (Expr) + errs() << Message; +return Expr; + } + + /// Matches an inlined profile blo

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
@@ -478,10 +605,31 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/25] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
@@ -478,10 +675,34 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; shawbyoung wrote: Added a flag for pseudo probe block matching. https://github.com/ll

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/24] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -266,6 +325,123 @@ class StaleMatcher { } return BestBlock; } + + /// A helper function for logging. + static bool LogErrIfExpr(bool Expr, std::string Message) { wlei-llvm wrote: Nit: `std::string` can this be `StringRef`? https://github.com/ll

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -116,6 +118,11 @@ cl::opt StaleMatchingCostJumpUnknownFTInc( "The cost of increasing an unknown fall-through jump count by one."), cl::init(3), cl::ReallyHidden, cl::cat(BoltOptCategory)); +cl::opt StaleMatchingWithBlockPseudoProbes( +"stale-matching-with-bl

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -0,0 +1,62 @@ +## Tests stale block matching with pseudo probes. + +# REQUIRES: system-linux +# RUN: split-file %s %t +# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o +# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib +# RUN: llvm-bolt %t.exe -

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Lei Wang via llvm-branch-commits
@@ -478,10 +675,34 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
@@ -478,10 +605,31 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/23] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-25 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/22] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
@@ -223,10 +249,31 @@ class StaleMatcher { return Hash1.InstrHash == Hash2.InstrHash; } + /// Returns true if a profiled block was matched with its pseudo probe. + bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) { +return MatchedWithPseudoProbes.find(YamlBBHas

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -223,10 +249,31 @@ class StaleMatcher { return Hash1.InstrHash == Hash2.InstrHash; } + /// Returns true if a profiled block was matched with its pseudo probe. + bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) { +return MatchedWithPseudoProbes.find(YamlBBHas

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; WenleiHe wrote: > There's no use of probes outside stale matching. True, but you do

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/21] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/20] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Shaw Young via llvm-branch-commits
https://github.com/shawbyoung updated https://github.com/llvm/llvm-project/pull/99891 >From 0274f697376264c2d77816190f9a434f64e79089 Mon Sep 17 00:00:00 2001 From: shawbyoung Date: Mon, 22 Jul 2024 11:56:23 -0700 Subject: [PATCH 01/19] Changed assignment of profiles with pseudo probe index Cre

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Shaw Young via llvm-branch-commits
@@ -223,10 +249,31 @@ class StaleMatcher { return Hash1.InstrHash == Hash2.InstrHash; } + /// Returns true if a profiled block was matched with its pseudo probe. + bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) { +return MatchedWithPseudoProbes.find(YamlBBHas

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; aaupov wrote: > The profile (not stale matching) is clearly using probe as probe exist

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; WenleiHe wrote: > If the profile contains probe information, but ProfileUsePseudoProbe

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; aaupov wrote: > Ok, I think we need a dedicated flag to control matching strategy, oth

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -208,11 +212,33 @@ class StaleMatcher { } } - /// Find the most similar block for a given hash. - const FlowBlock *matchBlock(BlendedBlockHash BlendedHash, - uint64_t CallHash) const { + /// Creates a mapping from a pseudo probe index t

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
@@ -208,11 +212,33 @@ class StaleMatcher { } } - /// Find the most similar block for a given hash. - const FlowBlock *matchBlock(BlendedBlockHash BlendedHash, - uint64_t CallHash) const { + /// Creates a mapping from a pseudo probe index t

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; WenleiHe wrote: Ok, I think we need a dedicated flag to control matching strategy, oth

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; aaupov wrote: No, I intended `ProfileUsePseudoProbes` to cover both generation and use

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -208,11 +212,33 @@ class StaleMatcher { } } - /// Find the most similar block for a given hash. - const FlowBlock *matchBlock(BlendedBlockHash BlendedHash, - uint64_t CallHash) const { + /// Creates a mapping from a pseudo probe index t

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -45,6 +45,8 @@ namespace opts { extern cl::opt TimeRewrite; extern cl::OptionCategory BoltOptCategory; +extern cl::opt Verbosity; +extern cl::opt ProfileUsePseudoProbes; WenleiHe wrote: IIUC `ProfileUsePseudoProbes` controls whether we extract probe from b

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -478,10 +605,31 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread via llvm-branch-commits
@@ -478,10 +605,31 @@ matchWeightsByHashes(BinaryContext &BC, Blocks.push_back(&Func.Blocks[I + 1]); BlendedBlockHash BlendedHash(BB->getHash()); BlendedHashes.push_back(BlendedHash); +// Collects pseudo probes attached to the BB for use in the StaleMatcher. +

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
@@ -266,6 +313,65 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + BlendedBlockHash BlendedHash, + const std::vector &PseudoPr

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
https://github.com/dcci commented: some comments. https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
@@ -223,10 +249,31 @@ class StaleMatcher { return Hash1.InstrHash == Hash2.InstrHash; } + /// Returns true if a profiled block was matched with its pseudo probe. + bool isPseudoProbeMatch(BlendedBlockHash YamlBBHash) { +return MatchedWithPseudoProbes.find(YamlBBHas

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
@@ -266,6 +313,65 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + BlendedBlockHash BlendedHash, + const std::vector &PseudoPr

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
@@ -266,6 +313,65 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + BlendedBlockHash BlendedHash, + const std::vector &PseudoPr

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Davide Italiano via llvm-branch-commits
https://github.com/dcci edited https://github.com/llvm/llvm-project/pull/99891 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

[llvm-branch-commits] [llvm] [BOLT] Match blocks with pseudo probes (PR #99891)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
@@ -266,6 +313,65 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + BlendedBlockHash BlendedHash, + const std::vector &PseudoPr

  1   2   >