Skip to content

Commit

Permalink
[mlir][Inliner] Keep the number of async pass managers constant
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
River707 committed Feb 24, 2021
1 parent af4451e commit 16a50c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mlir/lib/Transforms/Inliner.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 16a50c9

Please sign in to comment.