[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

2024-07-15 Thread Amir Ayupov via llvm-branch-commits
@@ -16,6 +16,37 @@ namespace llvm { namespace bolt { +/// A class for matching binary functions in functions in the YAML profile. +struct CallGraphMatcher { aaupov wrote: Let's make it a proper class https://github.com/llvm/llvm-project/pull/98125 __

[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

2024-07-15 Thread Amir Ayupov via llvm-branch-commits
@@ -446,6 +503,56 @@ size_t YAMLProfileReader::matchWithLTOCommonName() { return MatchedWithLTOCommonName; } +size_t YAMLProfileReader::matchWithCallGraph(BinaryContext &BC) { + if (!opts::MatchWithCallGraph) +return 0; + + size_t MatchedWithCallGraph = 0; + CGMatcher

[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

2024-07-17 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited https://github.com/llvm/llvm-project/pull/98125 ___ 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 functions with call graph (PR #98125)

2024-07-17 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov approved this pull request. LG with a couple of nits https://github.com/llvm/llvm-project/pull/98125 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-

[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

2024-07-17 Thread Amir Ayupov via llvm-branch-commits
@@ -43,6 +43,57 @@ class YAMLProfileReader : public ProfileReaderBase { using ProfileLookupMap = DenseMap; + /// A class for matching binary functions in functions in the YAML profile. + /// First, a call graph is constructed for both profiled and binary functions.

[llvm-branch-commits] [llvm] [BOLT] Match functions with call graph (PR #98125)

2024-07-17 Thread Amir Ayupov via llvm-branch-commits
@@ -43,6 +43,57 @@ class YAMLProfileReader : public ProfileReaderBase { using ProfileLookupMap = DenseMap; + /// A class for matching binary functions in functions in the YAML profile. + /// First, a call graph is constructed for both profiled and binary functions.

[llvm-branch-commits] [MC][NFC] Use std::map for AddressProbesMap (PR #99553)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/99553 AddressProbesMap is keyed by binary addresses, and it makes sense to treat them as ordered. This also enables slicing by binary function/ binary basic block, to be used in BOLT. Test Plan: NFC _

[llvm-branch-commits] [BOLT] Attach pseudo probes to blocks in YAML profile (PR #99554)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/99554 Read pseudo probes in regular and BAT YAML profile generation, and attach them to YAML profile basic blocks. This exposes GUID, probe id, and probe type in profile for future use in stale profile matching. Test Pl

[llvm-branch-commits] [MC][NFC] Use std::map for AddressProbesMap (PR #99553)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited 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

[llvm-branch-commits] [llvm] [BOLT] Attach pseudo probes to blocks in YAML profile (PR #99554)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99554 >From 9498f8f38cea050fd363d5d4591e8401e5de8bd5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Thu, 18 Jul 2024 12:49:23 -0700 Subject: [PATCH] Fix operator== Created using spr 1.3.4 --- bolt/include/bolt/Profi

[llvm-branch-commits] [llvm] [BOLT] Attach pseudo probes to blocks in YAML profile (PR #99554)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99554 >From 9498f8f38cea050fd363d5d4591e8401e5de8bd5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Thu, 18 Jul 2024 12:49:23 -0700 Subject: [PATCH 1/2] Fix operator== Created using spr 1.3.4 --- bolt/include/bolt/P

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/91667 >From dd4d0de42048c063d5e5095a0c2594c7cc578df5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Thu, 9 May 2024 19:35:26 -0700 Subject: [PATCH 1/5] Fix RISCVMCPlusBuilder Created using spr 1.3.4 --- bolt/lib/Tar

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
@@ -1876,6 +1876,13 @@ class X86MCPlusBuilder : public MCPlusBuilder { //add %r2, %r1 //jmp *%r1 // +// or a fixed indirect jump template: +// +//movslq En(%rip), {%r2|%r1} +//lea PIC_JUMP_TABLE(%rip), {%r1|%r2} <- MemLocInstr ---

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/91667 >From dd4d0de42048c063d5e5095a0c2594c7cc578df5 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Thu, 9 May 2024 19:35:26 -0700 Subject: [PATCH 1/6] Fix RISCVMCPlusBuilder Created using spr 1.3.4 --- bolt/lib/Tar

[llvm-branch-commits] [llvm] [BOLT] Support POSSIBLE_PIC_FIXED_BRANCH (PR #91667)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov closed https://github.com/llvm/llvm-project/pull/91667 ___ 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] [MC][NFC] Use std::map for AddressProbesMap (PR #99553)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [MC][NFC] Use std::map for AddressProbesMap (PR #99553)

2024-07-18 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [BOLT][NFC] Track fragment relationships using EquivalenceClasses (PR #99979)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/99979 Three-way splitting can create references between split fragments (warm to cold or vice versa) that are not handled by `isChildOf/isParentOf/isChildOrParentOf`. Generalize fragment relationships to allow checking i

[llvm-branch-commits] [BOLT] Support more than two jump table parents (PR #99988)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/99988 Multi-way splitting can cause multiple fragments to access the same jump table. Relax the assumption that a jump table can only have up to two parents. Test Plan: added bolt/test/X86/three-way-split-jt.s __

[llvm-branch-commits] [llvm] [BOLT][NFC] Track fragment relationships using EquivalenceClasses (PR #99979)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99979 >From f6478e36a962843329c519ba35ad2a132ffd8c9e Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 22 Jul 2024 16:34:02 -0700 Subject: [PATCH] fix getOrCreateJumpTable Created using spr 1.3.4 --- bolt/lib/Core

[llvm-branch-commits] [BOLT] Support more than two jump table parents (PR #99988)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99988 ___ 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] [BOLT] Support more than two jump table parents (PR #99988)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99988 ___ 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][NFC] Track fragment relationships using EquivalenceClasses (PR #99979)

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
@@ -241,6 +242,10 @@ class BinaryContext { /// Function fragments to skip. std::unordered_set FragmentsToSkip; + /// Fragment equivalence classes to query belonging to the same "family" in + /// presence of multiple fragments/multiple parents. + EquivalenceClasses Fragm

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

2024-07-22 Thread Amir Ayupov via llvm-branch-commits
@@ -266,6 +287,47 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + const std::vector &PseudoProbes) const { +// Searches for th

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

2024-07-23 Thread Amir Ayupov via llvm-branch-commits
@@ -266,6 +287,47 @@ class StaleMatcher { } return BestBlock; } + // Uses pseudo probe information to attach the profile to the appropriate + // block. + const FlowBlock *matchWithPseudoProbes( + const std::vector &PseudoProbes) const { +// Searches for th

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

2024-07-23 Thread Amir Ayupov via llvm-branch-commits
@@ -306,26 +310,41 @@ class StaleMatcher { BlockPseudoProbes.push_back(&PseudoProbe); } - // Returns nullptr if there is not a 1:1 mapping of the yaml block pseudo // probe and binary pseudo probe. -if (BlockPseudoProbes.size() == 0 || BlockPseudoProbes

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

2024-07-23 Thread Amir Ayupov via llvm-branch-commits
@@ -555,6 +574,10 @@ size_t matchWeightsByHashes( ProbeMap.lower_bound(FuncAddr + BlockRange.second)); for (const auto &[_, Probes] : BlockProbes) { for (const MCDecodedPseudoProbe &Probe : Probes) { + if (Probe.getInlineTreeNod

[llvm-branch-commits] [BOLT] Support more than two jump table parents (PR #99988)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99988 ___ 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] [BOLT] Support more than two jump table parents (PR #99988)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/99988 ___ 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] [BOLT] Add profile-use-pseudo-probes option (PR #100299)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov ready_for_review https://github.com/llvm/llvm-project/pull/100299 ___ 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] [BOLT] Add profile-use-pseudo-probes option (PR #100299)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/100299 ___ 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] [BOLT] Add profile-use-pseudo-probes option (PR #100299)

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/100299 ___ 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
@@ -206,13 +213,30 @@ class StaleMatcher { CallHashToBlocks[CallHashes[I]].push_back( std::make_pair(Hashes[I], Block)); } +this->IndexToBBPseudoProbes = IndexToBBPseudoProbes; +this->BBPseudoProbeToBlock = BBPseudoProbeToBlock; +this->YamlBF

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

2024-07-24 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov approved this pull request. LG but let's give some time for other reviewers 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

[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

[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 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 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 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] [MC][NFC] Store MCPseudoProbeFuncDesc::FuncName as StringRef (PR #100655)

2024-07-25 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/100655 Reduces peak RSS in `perf2bolt --profile-use-pseudo-probes` to 16.04GiB. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.or

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-07-29 Thread Amir Ayupov via llvm-branch-commits
@@ -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),

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-07-30 Thread Amir Ayupov via llvm-branch-commits
@@ -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),

[llvm-branch-commits] [BOLT][NFC] Print timers in perf2bolt invocation (PR #101270)

2024-07-30 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/101270 When BOLT is run in AggregateOnly mode (perf2bolt), it exits with code zero so destructors are not run thus TimerGroup never prints the timers. Add explicit printing just before the exit to honor options requesti

[llvm-branch-commits] [BOLT][NFC] Print timers in perf2bolt invocation (PR #101270)

2024-07-31 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101270 ___ 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] [BOLT][NFC] Print timers in perf2bolt invocation (PR #101270)

2024-07-31 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101270 ___ 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] [BOLT][NFC] Print timers in perf2bolt invocation (PR #101270)

2024-07-31 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101270 ___ 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] [BOLT][NFC] Print timers in perf2bolt invocation (PR #101270)

2024-07-31 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101270 ___ 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] [BOLT] Set RawBranchCount in DataAggregator (PR #101093)

2024-08-05 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov converted_to_draft https://github.com/llvm/llvm-project/pull/101093 ___ 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] [BOLT] Set RawBranchCount in DataAggregator (PR #101093)

2024-08-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov ready_for_review https://github.com/llvm/llvm-project/pull/101093 ___ 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] [MC][NFC] Store MCPseudoProbeFuncDesc::FuncName as StringRef (PR #100655)

2024-08-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov closed https://github.com/llvm/llvm-project/pull/100655 ___ 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] Add profile density computation (PR #101094)

2024-08-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101094 >From f598510001859a29f6f1ff6362fb9950ab6340cd Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 29 Jul 2024 16:14:08 -0700 Subject: [PATCH 1/2] Update test to check the option with llvm-bolt with fdata, YAM

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-08-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101094 >From f598510001859a29f6f1ff6362fb9950ab6340cd Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 29 Jul 2024 16:14:08 -0700 Subject: [PATCH 1/2] Update test to check the option with llvm-bolt with fdata, YAM

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-08-09 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101094 >From f598510001859a29f6f1ff6362fb9950ab6340cd Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 29 Jul 2024 16:14:08 -0700 Subject: [PATCH 1/3] Update test to check the option with llvm-bolt with fdata, YAM

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-08-09 Thread Amir Ayupov via 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

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-08-09 Thread Amir Ayupov via 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

[llvm-branch-commits] [profgen][NFC] Pass parameter as const_ref (PR #102787)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/102787 Pass `ProbeNode` parameter of `trackInlineesOptimizedAway` as const reference. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.l

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/102788 Expand autos in select places to trigger type casts. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/102789 Use #102774 to allocate storage for decoded probes (`PseudoProbeVec`) and function records (`InlineTreeVec`). Additionally, probes and inlined function records are allocated contiguously, which allows to keep trac

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov 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

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov 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

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
@@ -657,7 +657,7 @@ MCPseudoProbeDecoder::getCallProbeForAddr(uint64_t Address) const { const auto &Probes = It->second; const MCDecodedPseudoProbe *CallProbe = nullptr; - for (const auto &Probe : Probes) { aaupov wrote: In #102789, `Probes` become `st

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited 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

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov 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

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited 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

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
@@ -657,7 +657,7 @@ MCPseudoProbeDecoder::getCallProbeForAddr(uint64_t Address) const { const auto &Probes = It->second; const MCDecodedPseudoProbe *CallProbe = nullptr; - for (const auto &Probe : Probes) { aaupov wrote: > Ok, then this change should be

[llvm-branch-commits] [profgen][NFC] Pass parameter as const_ref (PR #102787)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102787 ___ 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] [profgen][NFC] Pass parameter as const_ref (PR #102787)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102787 ___ 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] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
@@ -657,7 +657,7 @@ MCPseudoProbeDecoder::getCallProbeForAddr(uint64_t Address) const { const auto &Probes = It->second; const MCDecodedPseudoProbe *CallProbe = nullptr; - for (const auto &Probe : Probes) { aaupov wrote: Thank you for clarifying. I'm us

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov edited 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

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [MC][profgen][NFC] Expand auto for MCDecodedPseudoProbe (PR #102788)

2024-08-10 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov 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

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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

[llvm-branch-commits] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/102904 Replace the map from addresses to list of probes with a flat vector containing probe references sorted by their addresses. Reduces pseudo probe parsing time from 9.56s to 8.59s and peak RSS from 9.66 GiB to 9.08

[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/102905 Replace unordered_map with a vector. Pre-parse the section to statically allocate storage. Use BumpPtrAllocator for FuncName strings, keep StringRef in FuncDesc. Reduces peak RSS of pseudo probe parsing from 9.08

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoProbe

[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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-commits

[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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-commits

[llvm-branch-commits] [llvm] [BOLT] Add profile density computation (PR #101094)

2024-08-12 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/101094 >From f598510001859a29f6f1ff6362fb9950ab6340cd Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 29 Jul 2024 16:14:08 -0700 Subject: [PATCH 1/4] Update test to check the option with llvm-bolt with fdata, YAM

[llvm-branch-commits] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-13 Thread Amir Ayupov via llvm-branch-commits
@@ -443,17 +446,24 @@ bool MCPseudoProbeDecoder::buildAddress2ProbeMap( // If the incoming node is null, all its children nodes should be disgarded. if (Cur) { // Switch/add to a new tree node(inlinee) -Cur = Cur->getOrAddNode(std::make_tuple(Guid, Index)); -Cur

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-13 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102789 >From ddcbb593f72ca47acaa82f9c14a7fd2c4e30903b Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 13 Aug 2024 03:51:31 -0700 Subject: [PATCH] Pass CurChildIndex by value Created using spr 1.3.4 --- llvm/incl

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
@@ -218,9 +220,7 @@ void PseudoProbeRewriter::updatePseudoProbes() { } while (CallOutputAddress != CallOutputAddresses.second) { - AP.second.push_back(*Probe); - AP.second.back().setAddress(CallOutputAddress->second); - Probe->getInli

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102789 >From ddcbb593f72ca47acaa82f9c14a7fd2c4e30903b Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 13 Aug 2024 03:51:31 -0700 Subject: [PATCH] Pass CurChildIndex by value Created using spr 1.3.4 --- llvm/incl

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102789 >From ddcbb593f72ca47acaa82f9c14a7fd2c4e30903b Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 13 Aug 2024 03:51:31 -0700 Subject: [PATCH] Pass CurChildIndex by value Created using spr 1.3.4 --- llvm/incl

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoProbe

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoProbe

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102789 >From ddcbb593f72ca47acaa82f9c14a7fd2c4e30903b Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 13 Aug 2024 03:51:31 -0700 Subject: [PATCH 1/2] Pass CurChildIndex by value Created using spr 1.3.4 --- llvm/

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-14 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov 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

[llvm-branch-commits] [llvm] [MC][NFC] Statically allocate storage for decoded pseudo probes and function records (PR #102789)

2024-08-15 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102789 >From ddcbb593f72ca47acaa82f9c14a7fd2c4e30903b Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Tue, 13 Aug 2024 03:51:31 -0700 Subject: [PATCH 1/3] Pass CurChildIndex by value Created using spr 1.3.4 --- llvm/

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-15 Thread Amir Ayupov via llvm-branch-commits
@@ -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

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-15 Thread Amir Ayupov via llvm-branch-commits
@@ -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

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoProbe

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoProbe

[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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-commits

[llvm-branch-commits] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated 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-commits

[llvm-branch-commits] [llvm] [MC][NFC] Use vector for GUIDProbeFunctionMap (PR #102905)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102905 >From 284c701cc57a613d11130a349aba522397946f12 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Fri, 16 Aug 2024 03:30:54 -0700 Subject: [PATCH] Assert func desc size Created using spr 1.3.4 --- llvm/lib/MC/MCP

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-16 Thread Amir Ayupov via llvm-branch-commits
https://github.com/aaupov updated https://github.com/llvm/llvm-project/pull/102904 >From 3ffb03f8e4bcb2fa235ae989320c466af4a3cda8 Mon Sep 17 00:00:00 2001 From: Amir Ayupov Date: Mon, 12 Aug 2024 14:40:57 -0700 Subject: [PATCH 1/2] stable_sort Created using spr 1.3.4 --- llvm/lib/MC/MCPseudoP

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-20 Thread Amir Ayupov via llvm-branch-commits
aaupov 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 once with it, exp

[llvm-branch-commits] [llvm] [MC][NFC] Reduce Address2ProbesMap size (PR #102904)

2024-08-20 Thread Amir Ayupov via llvm-branch-commits
aaupov wrote: > > For RSS, it's probably because in llvm-profgen, we decoded the pseudo-probe > > only for profiled function(https://reviews.llvm.org/D121643), so the > > baseline memory is decreased. > > > > @aaupov actually do we need to decode profile for functions without profile? > tha

<    1   2   3   4   5   6   7   8   9   10   >