diff options
author | spupyrev <spupyrev@users.noreply.github.com> | 2024-01-19 13:36:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 13:36:59 -0800 |
commit | 5954b9dca21bb0c69b9e991b2ddb84c8b05ecba3 (patch) | |
tree | 47cb04cc7905a615096a5ede066ad659e4e5ca9b /llvm/lib/ProfileData | |
parent | 9175dd9cbcad01a47acea9f1b99a0c96bf1a9a29 (diff) | |
download | llvm-5954b9dca21bb0c69b9e991b2ddb84c8b05ecba3.zip llvm-5954b9dca21bb0c69b9e991b2ddb84c8b05ecba3.tar.gz llvm-5954b9dca21bb0c69b9e991b2ddb84c8b05ecba3.tar.bz2 |
[InstrProf] Adding utility weights to BalancedPartitioning (#72717)
Adding weights to utility nodes in BP so that we can give more
importance to
certain utilities. This is useful when we optimize several objectives
jointly.
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r-- | llvm/lib/ProfileData/InstrProf.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 2640027..ba4fb22 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -923,15 +923,15 @@ std::vector<BPFunctionNode> TemporalProfTraceTy::createBPFunctionNodes( const int N = Log2_64(LargestTraceSize) + 1; - // TODO: We need to use the Trace.Weight field to give more weight to more + // TODO: We may use the Trace.Weight field to give more weight to more // important utilities DenseMap<IDT, SmallVector<UtilityNodeT, 4>> FuncGroups; - for (size_t TraceIdx = 0; TraceIdx < Traces.size(); TraceIdx++) { + for (uint32_t TraceIdx = 0; TraceIdx < Traces.size(); TraceIdx++) { auto &Trace = Traces[TraceIdx].FunctionNameRefs; for (size_t Timestamp = 0; Timestamp < Trace.size(); Timestamp++) { for (int I = Log2_64(Timestamp + 1); I < N; I++) { auto FunctionId = Trace[Timestamp]; - UtilityNodeT GroupId = TraceIdx * N + I; + UtilityNodeT GroupId(TraceIdx * N + I); FuncGroups[FunctionId].push_back(GroupId); } } @@ -940,8 +940,7 @@ std::vector<BPFunctionNode> TemporalProfTraceTy::createBPFunctionNodes( std::vector<BPFunctionNode> Nodes; for (auto Id : FunctionIds) { auto &UNs = FuncGroups[Id]; - llvm::sort(UNs); - UNs.erase(std::unique(UNs.begin(), UNs.end()), UNs.end()); + UtilityNodeT::sortAndDeduplicate(UNs); Nodes.emplace_back(Id, UNs); } return Nodes; |