[PATCH] D153318: [llvm] Refactor BalancedPartitioning for fixing build failure with MSVC
kamlesh kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 20 21:10:17 PDT 2023
kamleshbhalui updated this revision to Diff 533124.
kamleshbhalui added a comment.
clang-formatted
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153318/new/
https://reviews.llvm.org/D153318
Files:
llvm/include/llvm/Support/BalancedPartitioning.h
llvm/lib/Support/BalancedPartitioning.cpp
Index: llvm/lib/Support/BalancedPartitioning.cpp
===================================================================
--- llvm/lib/Support/BalancedPartitioning.cpp
+++ llvm/lib/Support/BalancedPartitioning.cpp
@@ -16,6 +16,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormatVariadic.h"
+#include "llvm/Support/ThreadPool.h"
using namespace llvm;
#define DEBUG_TYPE "balanced-partitioning"
@@ -80,10 +81,11 @@
dbgs() << format(
"Partitioning %d nodes using depth %d and %d iterations per split\n",
Nodes.size(), Config.SplitDepth, Config.IterationsPerSplit));
+ ThreadPool TheThreadPool;
std::optional<BPThreadPool> TP;
#if LLVM_ENABLE_THREADS
if (Config.TaskSplitDepth > 1)
- TP.emplace();
+ TP.emplace(TheThreadPool);
#endif
// Record the input order
Index: llvm/include/llvm/Support/BalancedPartitioning.h
===================================================================
--- llvm/include/llvm/Support/BalancedPartitioning.h
+++ llvm/include/llvm/Support/BalancedPartitioning.h
@@ -40,13 +40,17 @@
#define LLVM_SUPPORT_BALANCED_PARTITIONING_H
#include "raw_ostream.h"
-#include "llvm/Support/ThreadPool.h"
+#include "llvm/ADT/ArrayRef.h"
+#include <atomic>
+#include <condition_variable>
+#include <mutex>
#include <random>
#include <vector>
namespace llvm {
+class ThreadPool;
/// A function with a set of utility nodes where it is beneficial to order two
/// functions close together if they have similar utility nodes
class BPFunctionNode {
@@ -111,7 +115,7 @@
/// threads, so we need to track how many active threads that could spawn more
/// threads.
struct BPThreadPool {
- ThreadPool TheThreadPool;
+ ThreadPool &TheThreadPool;
std::mutex mtx;
std::condition_variable cv;
/// The number of threads that could spawn more threads
@@ -124,6 +128,7 @@
/// acceptable for other threads to add more tasks while blocking on this
/// call.
void wait();
+ BPThreadPool(ThreadPool &TheThreadPool) : TheThreadPool(TheThreadPool) {}
};
/// Run a recursive bisection of a given list of FunctionNodes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153318.533124.patch
Type: text/x-patch
Size: 2173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230621/7f593fd4/attachment.bin>
More information about the llvm-commits
mailing list