forked from OSchip/llvm-project
Enable multi-threading in the pass manager by default.
-- PiperOrigin-RevId: 245458081
This commit is contained in:
parent
24d0f60d31
commit
40ab8e0fb3
|
@ -32,10 +32,10 @@
|
|||
using namespace mlir;
|
||||
using namespace mlir::detail;
|
||||
|
||||
static llvm::cl::opt<bool> enableThreads(
|
||||
"experimental-mt-pm",
|
||||
llvm::cl::desc("Enable experimental multithreading in the pass manager"),
|
||||
llvm::cl::init(false));
|
||||
static llvm::cl::opt<bool>
|
||||
disableThreads("disable-pass-threading",
|
||||
llvm::cl::desc("Disable multithreading in the pass manager"),
|
||||
llvm::cl::init(false));
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Pass
|
||||
|
@ -430,13 +430,13 @@ void PassManager::addPass(FunctionPassBase *pass) {
|
|||
detail::FunctionPassExecutor *fpe;
|
||||
if (nestedExecutorStack.empty()) {
|
||||
/// Create an executor adaptor for this pass.
|
||||
if (enableThreads && llvm::llvm_is_multithreaded()) {
|
||||
// If multi-threading is enabled, then create an asynchronous adaptor.
|
||||
auto *adaptor = new ModuleToFunctionPassAdaptorParallel();
|
||||
if (disableThreads || !llvm::llvm_is_multithreaded()) {
|
||||
// If multi-threading is disabled, then create a synchronous adaptor.
|
||||
auto *adaptor = new ModuleToFunctionPassAdaptor();
|
||||
addPass(adaptor);
|
||||
fpe = &adaptor->getFunctionExecutor();
|
||||
} else {
|
||||
auto *adaptor = new ModuleToFunctionPassAdaptor();
|
||||
auto *adaptor = new ModuleToFunctionPassAdaptorParallel();
|
||||
addPass(adaptor);
|
||||
fpe = &adaptor->getFunctionExecutor();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: mlir-opt %s -cse -canonicalize -print-ir-before=cse -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE %s
|
||||
// RUN: mlir-opt %s -cse -canonicalize -print-ir-before-all -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_ALL %s
|
||||
// RUN: mlir-opt %s -cse -canonicalize -print-ir-after=cse -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER %s
|
||||
// RUN: mlir-opt %s -cse -canonicalize -print-ir-after-all -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL %s
|
||||
// RUN: mlir-opt %s -cse -canonicalize -print-ir-before=cse -print-ir-module-scope -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_MODULE %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -cse -canonicalize -print-ir-before=cse -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -cse -canonicalize -print-ir-before-all -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_ALL %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -cse -canonicalize -print-ir-after=cse -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -cse -canonicalize -print-ir-after-all -o /dev/null 2>&1 | FileCheck -check-prefix=AFTER_ALL %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -cse -canonicalize -print-ir-before=cse -print-ir-module-scope -o /dev/null 2>&1 | FileCheck -check-prefix=BEFORE_MODULE %s
|
||||
|
||||
func @foo() {
|
||||
return
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: mlir-opt %s -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=list 2>&1 | FileCheck -check-prefix=LIST %s
|
||||
// RUN: mlir-opt %s -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=pipeline 2>&1 | FileCheck -check-prefix=PIPELINE %s
|
||||
// RUN: mlir-opt %s -experimental-mt-pm=true -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=list 2>&1 | FileCheck -check-prefix=MT_LIST %s
|
||||
// RUN: mlir-opt %s -experimental-mt-pm=true -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=pipeline 2>&1 | FileCheck -check-prefix=MT_PIPELINE %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=list 2>&1 | FileCheck -check-prefix=LIST %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=true -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=pipeline 2>&1 | FileCheck -check-prefix=PIPELINE %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=false -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=list 2>&1 | FileCheck -check-prefix=MT_LIST %s
|
||||
// RUN: mlir-opt %s -disable-pass-threading=false -verify-each=true -cse -canonicalize -cse -pass-timing -pass-timing-display=pipeline 2>&1 | FileCheck -check-prefix=MT_PIPELINE %s
|
||||
|
||||
// LIST: Pass execution timing report
|
||||
// LIST: Total Execution Time:
|
||||
|
|
Loading…
Reference in New Issue