add no decompose option

pull/822/head
Kristof Denolf 2022-05-03 12:57:33 -07:00 committed by Sean Silva
parent 9f7264a7a4
commit 5243638e33
2 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,11 @@ struct TorchLoweringPipelineOptions
// If this option is false, only do the bare minimum for correctness.
Option<bool> optimize{*this, "optimize", llvm::cl::desc("Do optimizations."),
llvm::cl::init(true)};
// If this option is false, decompose complex operations.
// If this option is true, skip decomposition of complex operations.
Option<bool> nodecompose{*this, "nodecompose", llvm::cl::desc("No decomposition."),
llvm::cl::init(false)};
};
/// Creates a pipeline that lowers the object graph IR that is produced by

View File

@ -154,7 +154,9 @@ void mlir::torch::Torch::createTorchFunctionToTorchBackendPipeline(
// only-used-in-training operations on `torch.global_slot`'s.
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
}
pm.addNestedPass<func::FuncOp>(Torch::createDecomposeComplexOpsPass());
if (!options.nodecompose)
pm.addNestedPass<func::FuncOp>(Torch::createDecomposeComplexOpsPass());
// TODO: VerifyTorchBackendContractPass.
}