mirror of https://github.com/llvm/torch-mlir
Link necessary op interface implementations (#3364)
This patch adds two `memref` passes to `torch-mlir-opt`, which already occur in the pass pipeline `torch-backend-to-linalg-on-tensors-backend-pipeline`. Additionally, necessary op interface external models are included to address issue #3352.pull/3414/head
parent
0a6861b1e8
commit
56d21cba62
|
@ -18,6 +18,9 @@ namespace torch {
|
|||
// Registers all dialects that this project produces and any dependencies.
|
||||
void registerAllDialects(mlir::DialectRegistry ®istry);
|
||||
|
||||
// Registers all necessary dialect extensions for this project
|
||||
void registerAllExtensions(mlir::DialectRegistry ®istry);
|
||||
|
||||
// Registers dialects that may be needed to parse torch-mlir inputs and
|
||||
// test cases.
|
||||
void registerOptionalInputDialects(mlir::DialectRegistry ®istry);
|
||||
|
|
|
@ -13,6 +13,7 @@ set(LinkedLibs
|
|||
MLIRMemRefDialect
|
||||
MLIRSCFDialect
|
||||
MLIRTensorDialect
|
||||
MLIRTensorInferTypeOpInterfaceImpl
|
||||
MLIRTosaDialect
|
||||
MLIRSupport
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "mlir/Dialect/MemRef/IR/MemRef.h"
|
||||
#include "mlir/Dialect/SCF/IR/SCF.h"
|
||||
#include "mlir/Dialect/Tensor/IR/Tensor.h"
|
||||
#include "mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h"
|
||||
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
|
||||
#include "mlir/IR/Dialect.h"
|
||||
#include "torch-mlir-dialects/Dialect/TMTensor/IR/TMTensorDialect.h"
|
||||
|
@ -39,7 +40,11 @@ void mlir::torch::registerAllDialects(mlir::DialectRegistry ®istry) {
|
|||
registry.insert<mlir::torch::Torch::TorchDialect>();
|
||||
registry.insert<mlir::torch::TorchConversion::TorchConversionDialect>();
|
||||
registry.insert<mlir::torch::TMTensor::TMTensorDialect>();
|
||||
}
|
||||
|
||||
void mlir::torch::registerAllExtensions(mlir::DialectRegistry ®istry) {
|
||||
mlir::func::registerInlinerExtension(registry);
|
||||
tensor::registerInferTypeOpInterfaceExternalModels(registry);
|
||||
}
|
||||
|
||||
// TODO: Break this up when backends are separated.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/Dialect/MemRef/Transforms/Passes.h"
|
||||
#include "mlir/Dialect/SCF/IR/SCF.h"
|
||||
#include "mlir/Dialect/Tensor/IR/Tensor.h"
|
||||
#include "mlir/Tools/mlir-opt/MlirOptMain.h"
|
||||
|
@ -33,8 +34,13 @@ int main(int argc, char **argv) {
|
|||
registerStripDebugInfoPass();
|
||||
registerSymbolDCEPass();
|
||||
|
||||
// memref passes used in torch-backend-to-linalg-on-tensors-backend-pipeline
|
||||
memref::registerExpandOpsPass();
|
||||
memref::registerResolveShapedTypeResultDimsPass();
|
||||
|
||||
DialectRegistry registry;
|
||||
mlir::torch::registerAllDialects(registry);
|
||||
mlir::torch::registerAllExtensions(registry);
|
||||
mlir::torch::registerOptionalInputDialects(registry);
|
||||
|
||||
#ifdef TORCH_MLIR_ENABLE_STABLEHLO
|
||||
|
|
Loading…
Reference in New Issue