Adding stablehlo dialects support for torch-mlir-opt tool (#1887)

* Adding stablehlo dialects support for torch-mlir-opt tool.

* Update torch-mlir-opt.cpp

Fixed the build error according to build configuration for macOS.
pull/1919/merge
Kan Chen 2023-03-08 00:48:49 +08:00 committed by GitHub
parent 6c06b9560d
commit 13533307ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,10 @@
#include "mlir/Tools/mlir-opt/MlirOptMain.h"
#include "torch-mlir/InitAll.h"
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
#include "stablehlo/dialect/Register.h"
#endif
using namespace mlir;
int main(int argc, char **argv) {
@ -22,6 +26,9 @@ int main(int argc, char **argv) {
registerAllDialects(registry);
mlir::torch::registerAllDialects(registry);
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
mlir::stablehlo::registerAllDialects(registry);
#endif
return mlir::asMainReturnCode(
mlir::MlirOptMain(argc, argv, "MLIR modular optimizer driver\n", registry,
/*preloadDialectsInContext=*/false));