Lines Matching full:nodes

78 void BalancedPartitioning::run(std::vector<BPFunctionNode> &Nodes) const {
81 "Partitioning %d nodes using depth %d and %d iterations per split\n",
82 Nodes.size(), Config.SplitDepth, Config.IterationsPerSplit));
91 for (unsigned I = 0; I < Nodes.size(); I++)
92 Nodes[I].InputOrderIndex = I;
94 auto NodesRange = llvm::make_range(Nodes.begin(), Nodes.end());
112 void BalancedPartitioning::bisect(const FunctionNodeRange Nodes,
116 unsigned NumNodes = std::distance(Nodes.begin(), Nodes.end());
120 llvm::sort(Nodes, [](const auto &L, const auto &R) {
123 for (auto &N : Nodes)
128 LLVM_DEBUG(dbgs() << format("Bisect with %d nodes and root bucket %d\n",
137 split(Nodes, LeftBucket);
139 runIterations(Nodes, LeftBucket, RightBucket, RNG);
141 // Split nodes wrt the resulting buckets
143 llvm::partition(Nodes, [&](auto &N) { return N.Bucket == LeftBucket; });
144 unsigned MidOffset = Offset + std::distance(Nodes.begin(), NodesMid);
146 auto LeftNodes = llvm::make_range(Nodes.begin(), NodesMid);
147 auto RightNodes = llvm::make_range(NodesMid, Nodes.end());
165 void BalancedPartitioning::runIterations(const FunctionNodeRange Nodes,
169 unsigned NumNodes = std::distance(Nodes.begin(), Nodes.end());
171 for (auto &N : Nodes)
174 // Remove utility nodes if they have just one edge or are connected to all
176 for (auto &N : Nodes)
181 // Renumber utility nodes so they can be used to index into Signatures
183 for (auto &N : Nodes)
189 for (auto &N : Nodes) {
202 runIteration(Nodes, LeftBucket, RightBucket, Signatures, RNG);
208 unsigned BalancedPartitioning::runIteration(const FunctionNodeRange Nodes,
233 for (auto &N : Nodes) {
259 // Try to exchange the nodes between buckets
301 void BalancedPartitioning::split(const FunctionNodeRange Nodes,
303 unsigned NumNodes = std::distance(Nodes.begin(), Nodes.end());
304 auto NodesMid = Nodes.begin() + (NumNodes + 1) / 2;
306 std::nth_element(Nodes.begin(), NodesMid, Nodes.end(), [](auto &L, auto &R) {
310 for (auto &N : llvm::make_range(Nodes.begin(), NodesMid))
312 for (auto &N : llvm::make_range(NodesMid, Nodes.end()))