[Mlir-commits] [mlir] 16a50c9 - [mlir][Inliner] Keep the number of async pass managers constant
River Riddle
llvmlistbot at llvm.org
Tue Feb 23 16:45:29 PST 2021
Author: River Riddle
Date: 2021-02-23T16:40:24-08:00
New Revision: 16a50c9e642fd085e5ceb68c403b71b5b2e0607c
URL: https://github.com/llvm/llvm-project/commit/16a50c9e642fd085e5ceb68c403b71b5b2e0607c
DIFF: https://github.com/llvm/llvm-project/commit/16a50c9e642fd085e5ceb68c403b71b5b2e0607c.diff
LOG: [mlir][Inliner] Keep the number of async pass managers constant
This prevents a bug in the pass instrumentation implementation where the main thread would end up with a different pass manager in different runs of the pass.
Added:
Modified:
mlir/lib/Transforms/Inliner.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp
index ad89e4771508..0a2cc7eb4c98 100644
--- a/mlir/lib/Transforms/Inliner.cpp
+++ b/mlir/lib/Transforms/Inliner.cpp
@@ -687,10 +687,10 @@ LogicalResult
InlinerPass::optimizeSCCAsync(MutableArrayRef<CallGraphNode *> nodesToVisit,
MLIRContext *context) {
// Ensure that there are enough pipeline maps for the optimizer to run in
- // parallel.
- size_t numThreads =
- std::min((size_t)llvm::hardware_concurrency().compute_thread_count(),
- nodesToVisit.size());
+ // parallel. Note: The number of pass managers here needs to remain constant
+ // to prevent issues with pass instrumentations that rely on having the same
+ // pass manager for the main thread.
+ size_t numThreads = llvm::hardware_concurrency().compute_thread_count();
if (opPipelines.size() < numThreads) {
// Reserve before resizing so that we can use a reference to the first
// element.
More information about the Mlir-commits
mailing list