Unverified Commit d28fac61 authored by Amy Zhuang's avatar Amy Zhuang Committed by GitHub

[MLIR] Add a flag to control ngraph dialect fusion pass. (#4362)

* [MLIR] Add a flag to control ngraph dialect fusion pass.

* Address PR feedback.
Co-authored-by: 's avatarScott Cyphers <diyessi@users.noreply.github.com>
parent a573dce2
......@@ -60,6 +60,11 @@
// Defines a new LLVM debug type for this file to be used by LLVM_DEBUG macro.
#define DEBUG_TYPE "mlir-compiler"
static llvm::cl::opt<bool> clEnableNgKernelLibFusion(
"ngraph-kernel-lib-fusion",
llvm::cl::init(false),
llvm::cl::desc("Enable the ngraph pass that fuses ops to use kernel library"));
using llvm::SmallVector;
using llvm::StringRef;
using llvm::ArrayRef;
......@@ -125,7 +130,10 @@ void MLIRCompiler::buildNgDialectModule()
void MLIRCompiler::optimizeNgDialect()
{
mlir::PassManager pm(&m_context);
pm.addPass(ngraph::pass::createNgDialectFusedOpsPass());
if (clEnableNgKernelLibFusion)
{
pm.addPass(ngraph::pass::createNgDialectFusedOpsPass());
}
// Apply any generic pass manager command line options.
mlir::applyPassManagerCLOptions(pm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment