Commit ac8df2bb authored by Diego Caballero's avatar Diego Caballero Committed by nmostafa

[MLIR] Enable LLVM optimizations in execution engine. (#10)

This patch enables LLVM optimizations at -O3 level.
parent 978691b4
...@@ -364,11 +364,12 @@ namespace ngraph ...@@ -364,11 +364,12 @@ namespace ngraph
llvm::InitializeNativeTarget(); llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter(); llvm::InitializeNativeTargetAsmPrinter();
// Create an MLIR execution engine. Note that it takes a null pass manager // Create an MLIR execution engine. We use a null MLIR pass manager for now to make sure we
// to make sure it won't run "default" passes on the MLIR that would trigger // don't run MLIR passes that were already run. We also pass a default transformer to run
// a second conversion to LLVM IR. The execution engine eagerly JIT-compiles // LLVM optimizations at level 3.
// the module. mlir::PassManager* mlir_pm = nullptr;
auto maybeEngine = mlir::ExecutionEngine::create(m_module.get(), /*pm=*/nullptr); auto llvm_transformer = mlir::makeOptimizingTransformer(3 /*optLevel*/, 0 /*sizeLevel*/);
auto maybeEngine = mlir::ExecutionEngine::create(m_module.get(), mlir_pm, llvm_transformer);
NGRAPH_ASSERT(maybeEngine) << "failed to construct an execution engine"; NGRAPH_ASSERT(maybeEngine) << "failed to construct an execution engine";
m_engine = std::move(maybeEngine.get()); m_engine = std::move(maybeEngine.get());
......
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