https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124333
>From 0f1f43a5f19d4055c1896a70e050965b4d309790 Mon Sep 17 00:00:00 2001
From: wlei
Date: Wed, 12 Feb 2025 22:03:21 -0800
Subject: [PATCH] remove irrelevant code
Created using spr 1.3.6-beta.1
---
llvm/tools/
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124333
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124333
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm edited
https://github.com/llvm/llvm-project/pull/125649
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm created
https://github.com/llvm/llvm-project/pull/125649
Test Plan: llvm/test/CodeGen/X86/function-address-map-function-sections.ll
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm edited
https://github.com/llvm/llvm-project/pull/124334
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124333
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm updated
https://github.com/llvm/llvm-project/pull/124333
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm edited
https://github.com/llvm/llvm-project/pull/124333
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm created
https://github.com/llvm/llvm-project/pull/124334
Test Plan: llvm/test/CodeGen/X86/function-address-map-function-sections.ll
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.
https://github.com/wlei-llvm created
https://github.com/llvm/llvm-project/pull/124333
Test Plan: llvm/test/tools/llvm-readobj/ELF/func-map.test
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/
https://github.com/wlei-llvm approved this pull request.
Sorry for the delay, LGTM.
https://github.com/llvm/llvm-project/pull/112996
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo
@@ -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
@@ -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
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
@@ -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)
@@ -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
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
https://github.com/wlei-llvm approved this pull request.
LGTM, thanks!
https://github.com/llvm/llvm-project/pull/101094
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext
&BC) {
return MatchedWithCallGraph;
}
+void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees(
+const MCPseudoProbeDecoder &Decoder,
+const yaml::bolt::PseudoProbeDesc &YamlPD,
+
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext
&BC) {
return MatchedWithCallGraph;
}
+void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees(
+const MCPseudoProbeDecoder &Decoder,
+const yaml::bolt::PseudoProbeDesc &YamlPD,
+
@@ -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
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext
&BC) {
return MatchedWithCallGraph;
}
+void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees(
+const MCPseudoProbeDecoder &Decoder,
+const yaml::bolt::PseudoProbeDesc &YamlPD,
+
@@ -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
@@ -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
@@ -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
_
@@ -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
@@ -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
@@ -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 -
@@ -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
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext
&BC) {
return MatchedWithCallGraph;
}
+void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees(
+const MCPseudoProbeDecoder &Decoder,
+const yaml::bolt::PseudoProbeDesc &YamlPD,
+
@@ -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
@@ -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
@@ -587,6 +590,51 @@ size_t YAMLProfileReader::matchWithCallGraph(BinaryContext
&BC) {
return MatchedWithCallGraph;
}
+void YAMLProfileReader::InlineTreeNodeMapTy::matchInlineTrees(
+const MCPseudoProbeDecoder &Decoder,
+const yaml::bolt::PseudoProbeDesc &YamlPD,
+
@@ -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
https://github.com/wlei-llvm approved this pull request.
LGTM, thanks!
https://github.com/llvm/llvm-project/pull/107137
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-
@@ -2421,11 +2433,14 @@ std::error_code
DataAggregator::writeBATYAML(BinaryContext &BC,
const uint32_t InputOffset = BAT->translate(
FuncAddr, OutputAddress - FuncAddr, /*IsBranchSrc=*/true);
const unsigned BlockIndex = getBlock(InputOff
@@ -14,29 +14,31 @@
# RUN: FileCheck --input-file %t.yaml2 %s --check-prefix CHECK-YAML
# CHECK-YAML: name: bar
# CHECK-YAML: - bid: 0
-# CHECK-YAML: pseudo_probes: [ { guid: 0xE413754A191DB537, id: 1, type: 0 },
{ guid: 0xE413754A191DB537, id: 4, type: 0 } ]
-# CHECK-YAML:
@@ -58,8 +59,158 @@ const BinaryFunction *YAMLProfileWriter::setCSIDestination(
return nullptr;
}
+std::vector
+YAMLProfileWriter::collectInlineTree(
+const MCPseudoProbeDecoder &Decoder,
+const MCDecodedPseudoProbeInlineTree &Root) {
+ auto getHash = [&](const MCDe
@@ -158,15 +164,35 @@ template <> struct
MappingTraits {
std::vector());
YamlIO.mapOptional("succ", BBP.Successors,
std::vector());
-YamlIO.mapOptional("pseudo_probes", BBP.PseudoProbes,
+YamlIO.mapOptional("probes", BB
@@ -158,15 +164,35 @@ template <> struct
MappingTraits {
std::vector());
YamlIO.mapOptional("succ", BBP.Successors,
std::vector());
-YamlIO.mapOptional("pseudo_probes", BBP.PseudoProbes,
+YamlIO.mapOptional("probes", BB
@@ -95,24 +95,30 @@ template <> struct MappingTraits {
namespace bolt {
struct PseudoProbeInfo {
- llvm::yaml::Hex64 GUID;
- uint64_t Index;
- uint8_t Type;
+ uint32_t InlineTreeIndex = 0;
+ uint64_t BlockMask = 0; // bitset with probe indices
+ // Assume BlockMask == 1
@@ -95,24 +95,30 @@ template <> struct MappingTraits {
namespace bolt {
struct PseudoProbeInfo {
- llvm::yaml::Hex64 GUID;
- uint64_t Index;
- uint8_t Type;
+ uint32_t InlineTreeIndex = 0;
+ uint64_t BlockMask = 0; // bitset with probe indices
wlei-llvm w
@@ -58,8 +60,164 @@ const BinaryFunction *YAMLProfileWriter::setCSIDestination(
return nullptr;
}
+std::vector
+YAMLProfileWriter::getInlineTree(const MCPseudoProbeDecoder &Decoder,
wlei-llvm wrote:
Is it possible to give a more explicit name? when I saw th
@@ -58,8 +60,164 @@ const BinaryFunction *YAMLProfileWriter::setCSIDestination(
return nullptr;
}
+std::vector
+YAMLProfileWriter::getInlineTree(const MCPseudoProbeDecoder &Decoder,
+ const MCDecodedPseudoProbeInlineTree *Root) {
+ auto getHa
@@ -95,24 +95,30 @@ template <> struct MappingTraits {
namespace bolt {
struct PseudoProbeInfo {
- llvm::yaml::Hex64 GUID;
- uint64_t Index;
- uint8_t Type;
+ uint32_t InlineTreeIndex = 0;
+ uint64_t BlockMask = 0; // bitset with probe indices
+ // Assume BlockMask == 1
@@ -58,8 +60,164 @@ const BinaryFunction *YAMLProfileWriter::setCSIDestination(
return nullptr;
}
+std::vector
+YAMLProfileWriter::getInlineTree(const MCPseudoProbeDecoder &Decoder,
+ const MCDecodedPseudoProbeInlineTree *Root) {
+ auto getHa
@@ -2421,11 +2433,14 @@ std::error_code
DataAggregator::writeBATYAML(BinaryContext &BC,
const uint32_t InputOffset = BAT->translate(
FuncAddr, OutputAddress - FuncAddr, /*IsBranchSrc=*/true);
const unsigned BlockIndex = getBlock(InputOff
@@ -246,10 +270,32 @@ template <> struct
MappingTraits {
}
};
+namespace bolt {
+struct PseudoProbeDesc {
+ std::vector GUID;
+ std::vector Hash;
+ std::vector GUIDHash; // Index of hash for that GUID in Hash
wlei-llvm wrote:
Give another name? IIUC, it
@@ -58,8 +60,164 @@ const BinaryFunction *YAMLProfileWriter::setCSIDestination(
return nullptr;
}
+std::vector
+YAMLProfileWriter::getInlineTree(const MCPseudoProbeDecoder &Decoder,
+ const MCDecodedPseudoProbeInlineTree *Root) {
+ auto getHa
https://github.com/wlei-llvm approved this pull request.
LGTM, thanks.
https://github.com/llvm/llvm-project/pull/106365
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-
https://github.com/wlei-llvm approved this pull request.
https://github.com/llvm/llvm-project/pull/102904
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm approved this pull request.
LGTM, thanks.
https://github.com/llvm/llvm-project/pull/102905
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-
https://github.com/wlei-llvm approved this pull request.
LGTM, thanks.
https://github.com/llvm/llvm-project/pull/102789
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-
wlei-llvm wrote:
> > To double-check: did you test with or without dwarf-correlation? I tested
> > once with it, expectedly pseudo probe parsing wasn't engaged, so there was
> > no effect.
>
> Yes, I double-checked it's a pseudo-probed binary not dwarf-correlation. Note
> that for end to end
wlei-llvm wrote:
> > Tested End-to-End on llvm-profgen on a heavy workload(ported all the
> > stacked PR) : The running time is neutral, the maximum RSS is reduced by
> > 3GB (from 70GB to 67GB) cc @WenleiHe
>
> To double-check: did you test with or without dwarf-correlation? I tested
> onc
https://github.com/wlei-llvm commented:
Tested End-to-End on llvm-profgen on a heavy workload(ported all the stacked
PR) : The running time is neutral, the maximum RSS is reduced by 3GB (from 70GB
to 67GB) cc @WenleiHe
https://github.com/llvm/llvm-project/pull/102904
__
@@ -213,6 +208,33 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
bool ShowName) const;
};
+// Address to pseudo probes map.
+class AddressProbesMap
+: public std::vector> {
+ auto getIt(uint64_t Addr) const {
+auto CompareProbe = [](const MCDe
https://github.com/wlei-llvm edited
https://github.com/llvm/llvm-project/pull/102904
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -213,6 +208,31 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
bool ShowName) const;
};
+// Address to pseudo probes map.
+class AddressProbesMap
+: public std::vector> {
+ auto getIt(uint64_t Addr) const {
+auto CompareProbe = [](const MCDe
@@ -100,8 +101,15 @@ class MCDecodedPseudoProbe;
using InlineSite = std::tuple;
using MCPseudoProbeInlineStack = SmallVector;
// GUID to PseudoProbeFuncDesc map
-using GUIDProbeFunctionMap =
-std::unordered_map;
+class GUIDProbeFunctionMap : public std::vector {
+public:
+
@@ -390,32 +390,41 @@ bool MCPseudoProbeDecoder::buildGUID2FuncDescMap(const
uint8_t *Start,
Data = Start;
End = Data + Size;
+ uint32_t FuncDescCount = 0;
while (Data < End) {
-auto ErrorOrGUID = readUnencodedNumber();
-if (!ErrorOrGUID)
+if (!readUnencod
@@ -390,32 +390,41 @@ bool MCPseudoProbeDecoder::buildGUID2FuncDescMap(const
uint8_t *Start,
Data = Start;
End = Data + Size;
+ uint32_t FuncDescCount = 0;
while (Data < End) {
-auto ErrorOrGUID = readUnencodedNumber();
-if (!ErrorOrGUID)
+if (!readUnencod
@@ -213,6 +208,25 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
bool ShowName) const;
};
+// Address to pseudo probes map.
+class AddressProbesMap
+: public std::vector> {
+ auto getIt(uint64_t Addr) const {
+auto CompareProbe = [](const MCDe
@@ -1183,11 +1183,9 @@ void ProfileGeneratorBase::extractProbesFromRange(
do {
const AddressProbesMap &Address2ProbesMap =
Binary->getAddress2ProbesMap();
- auto It = Address2ProbesMap.find(IP.Address);
- if (It != Address2ProbesMap.end()) {
-
@@ -213,6 +208,25 @@ class MCDecodedPseudoProbe : public MCPseudoProbeBase {
bool ShowName) const;
};
+// Address to pseudo probes map.
+class AddressProbesMap
+: public std::vector> {
+ auto getIt(uint64_t Addr) const {
+auto CompareProbe = [](const MCDe
@@ -1293,9 +1293,9 @@ void CSProfileGenerator::populateBodySamplesWithProbes(
// and will be inferred by the compiler.
for (auto &I : FrameSamples) {
for (auto *FunctionProfile : I.second) {
- for (auto *Probe : I.first->getProbes()) {
-FunctionProfile->add
@@ -240,12 +235,11 @@ class MCPseudoProbeInlineTreeBase {
bool isRoot() const { return Guid == 0; }
InlinedProbeTreeMap &getChildren() { return Children; }
const InlinedProbeTreeMap &getChildren() const { return Children; }
- std::vector &getProbes() { return Probes; }
-
@@ -605,13 +616,20 @@ bool MCPseudoProbeDecoder::buildAddress2ProbeMap(
TopLevelFuncs += !Discard;
}
assert(Data == End && "Have unprocessed data in pseudo_probe section");
+ PseudoProbeVec.reserve(ProbeCount);
+ InlineTreeVec.reserve(InlinedCount);
w
wlei-llvm wrote:
Measured `decode_pseudo_probe(llvm-profgen)` on a large binary with 1.7GB
`.pseudo_probe` section
Ported and used all the improvements in a whole.
Before those changes:
```
Time: 190s , RSS: 57.4GB
```
After those changes:
```
Time: 55s , RSS: 26.3GB
```
Awesome!
https://git
https://github.com/wlei-llvm commented:
Thanks for the improvement, I will try it on llvm-profgen to get some numbers.
https://github.com/llvm/llvm-project/pull/102789
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://list
@@ -276,17 +278,35 @@ class MCPseudoProbeInlineTree
};
// inline tree node for the decoded pseudo probe
-class MCDecodedPseudoProbeInlineTree
-: public MCPseudoProbeInlineTreeBase {
+class MCDecodedPseudoProbeInlineTree {
wlei-llvm wrote:
Now that this cl
@@ -218,9 +220,7 @@ void PseudoProbeRewriter::updatePseudoProbes() {
}
while (CallOutputAddress != CallOutputAddresses.second) {
- AP.second.push_back(*Probe);
- AP.second.back().setAddress(CallOutputAddress->second);
- Probe->getInli
https://github.com/wlei-llvm edited
https://github.com/llvm/llvm-project/pull/102789
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
https://github.com/wlei-llvm approved this pull request.
https://github.com/llvm/llvm-project/pull/102788
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
@@ -1441,6 +1458,22 @@ Error PrintProgramStats::runOnFunctions(BinaryContext
&BC) {
StaleSampleCount += SampleCount;
++NumAllStaleFunctions;
}
+
+if (opts::ShowDensity) {
+ uint64_t Size = Function.getSize();
+ // In case of BOLT split functions r
@@ -1441,6 +1458,22 @@ Error PrintProgramStats::runOnFunctions(BinaryContext
&BC) {
StaleSampleCount += SampleCount;
++NumAllStaleFunctions;
}
+
+if (opts::ShowDensity) {
+ uint64_t Size = Function.getSize();
+ // In case of BOLT split functions r
@@ -223,6 +223,22 @@ static cl::opt TopCalledLimit(
"functions section"),
cl::init(100), cl::Hidden, cl::cat(BoltCategory));
+// Profile density options, synced with llvm-profgen/ProfileGenerator.cpp
+static cl::opt ShowDensity("show-density", cl::init(false),
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
@@ -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.
+
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 -
@@ -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.
+
https://github.com/wlei-llvm approved this pull request.
LGTM.
https://github.com/llvm/llvm-project/pull/99553
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
93 matches
Mail list logo