[PATCH] D104516: [mlir] Add a ThreadPool to MLIRContext and refactor MLIR threading usage

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 19 18:14:30 PDT 2021


rriddle marked an inline comment as done.
rriddle added inline comments.


================
Comment at: llvm/lib/Support/ThreadPool.cpp:77
+  std::thread::id CurrentThreadId = std::this_thread::get_id();
+  for (const std::thread &Thread : Threads)
+    if (CurrentThreadId == Thread.get_id())
----------------
lattner wrote:
> Yuck but ok.  This is obviously your way of trying to force me to rewrite this stuff ;-)
Yes, please! I don't have any time to devote to it for the next month or so, but I would really love a ThreadPool that supported the things that we need. This function is a gross band-aid over the current implementation that allows for us to use it as-is for now.


================
Comment at: mlir/lib/Pass/Pass.cpp:591-593
+  std::vector<std::atomic<bool>> activePMs(asyncExecutors.size());
+  for (std::atomic<bool> &isActive : activePMs)
+    isActive = false;
----------------
lattner wrote:
> bondhugula wrote:
> > std::vector<std::atomic<bool>> activePMs(asyncExecutors.size(), 
> >                                                                          std::atomic<bool>{false});
> > 
> Right, atomic needs to be explicitly initialized to work correctly
Thanks Uday! My 4am brain couldn't remember how to initialize it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104516/new/

https://reviews.llvm.org/D104516



More information about the llvm-commits mailing list