mirror of https://github.com/llvm/torch-mlir
[Stablehlo] legalize deprecated ops to stablehlo ops (#3543)
parent
e5d1677894
commit
714270a922
|
@ -166,5 +166,12 @@ void TorchConversion::createTorchBackendToStablehloBackendPipeline(
|
||||||
pm.addNestedPass<func::FuncOp>(
|
pm.addNestedPass<func::FuncOp>(
|
||||||
stablehlo::createStablehloCanonicalizeDynamismPass());
|
stablehlo::createStablehloCanonicalizeDynamismPass());
|
||||||
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
|
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
|
||||||
|
|
||||||
|
// Legalize deprecated ops to Stablehlo ops
|
||||||
|
stablehlo::StablehloLegalizeDeprecatedOpsPassOptions stablehloOptions;
|
||||||
|
stablehloOptions.failOnUnusedOps = false;
|
||||||
|
pm.addNestedPass<func::FuncOp>(
|
||||||
|
stablehlo::createStablehloLegalizeDeprecatedOpsPass(stablehloOptions));
|
||||||
|
pm.addPass(createCanonicalizerPass());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -67,6 +67,8 @@ void mlir::torch::registerAllPasses() {
|
||||||
mlir::stablehlo::registerStablehloAggressiveSimplificationPass();
|
mlir::stablehlo::registerStablehloAggressiveSimplificationPass();
|
||||||
mlir::stablehlo::registerStablehloRefineShapesPass();
|
mlir::stablehlo::registerStablehloRefineShapesPass();
|
||||||
mlir::stablehlo::registerStablehloConvertToSignlessPass();
|
mlir::stablehlo::registerStablehloConvertToSignlessPass();
|
||||||
|
mlir::stablehlo::registerShapeLegalizeToStablehloPass();
|
||||||
|
mlir::stablehlo::registerStablehloLegalizeDeprecatedOpsPass();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORCH_MLIR_ENABLE_REFBACKEND
|
#ifdef TORCH_MLIR_ENABLE_REFBACKEND
|
||||||
|
|
Loading…
Reference in New Issue