Add new passes related to Linalg and Affine dialects (#181)

* Reorganize main function.

* Follow review comments.

* Emit constants are globals in Krnl and LLVM dialects.

* Add more passes to onnx-mlir-opt.

* Clean-up.
This commit is contained in:
Gheorghe-Teodor Bercea 2020-06-25 13:36:39 -04:00 committed by GitHub
parent cc68f77d8d
commit f811718144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -146,6 +146,11 @@ find_mlir_lib(MLIRLLVMIR)
find_mlir_lib(MLIRLoopAnalysis) find_mlir_lib(MLIRLoopAnalysis)
find_mlir_lib(MLIRSCFToStandard) find_mlir_lib(MLIRSCFToStandard)
find_mlir_lib(MLIRLoopLikeInterface) find_mlir_lib(MLIRLoopLikeInterface)
find_mlir_lib(MLIRLinalgOps)
find_mlir_lib(MLIRLinalgEDSC)
find_mlir_lib(MLIRLinalgAnalysis)
find_mlir_lib(MLIRLinalgTransforms)
find_mlir_lib(MLIRLinalgUtils)
find_mlir_lib(MLIRSCF) find_mlir_lib(MLIRSCF)
find_mlir_lib(MLIRLLVMIRTransforms) find_mlir_lib(MLIRLLVMIRTransforms)
find_mlir_lib(MLIRMlirOptMain) find_mlir_lib(MLIRMlirOptMain)
@ -165,6 +170,10 @@ find_mlir_lib(MLIRTargetLLVMIR)
find_mlir_lib(MLIRTransformUtils) find_mlir_lib(MLIRTransformUtils)
find_mlir_lib(MLIRTranslation) find_mlir_lib(MLIRTranslation)
find_mlir_lib(MLIRVector) find_mlir_lib(MLIRVector)
find_mlir_lib(MLIRMlirOptMain)
find_mlir_lib(MLIRAffineEDSC)
find_mlir_lib(MLIRLinalgEDSC)
find_mlir_lib(MLIRViewLikeInterface)
find_mlir_lib(LLVMCore) find_mlir_lib(LLVMCore)
find_mlir_lib(LLVMSupport) find_mlir_lib(LLVMSupport)
@ -226,6 +235,14 @@ set(MLIRLibs
${MLIRStandardToLLVM} ${MLIRStandardToLLVM}
${MLIRSupport} ${MLIRSupport}
${MLIRTranslation} ${MLIRTranslation}
${MLIRLinalgOps}
${MLIRLinalgEDSC}
${MLIRLinalgAnalysis}
${MLIRLinalgTransforms}
${MLIRLinalgUtils}
${MLIRAffineEDSC}
${MLIRLinalgEDSC}
${MLIRViewLikeInterface}
# strict order verified # strict order verified
${LLVMBitWriter} ${LLVMBitWriter}
${LLVMObject} ${LLVMObject}

View File

@ -12,8 +12,11 @@
#include <llvm/Support/InitLLVM.h> #include <llvm/Support/InitLLVM.h>
#include <llvm/Support/ToolOutputFile.h> #include <llvm/Support/ToolOutputFile.h>
#include <mlir/IR/AsmState.h> #include <mlir/IR/AsmState.h>
#include <mlir/IR/Dialect.h>
#include <mlir/IR/MLIRContext.h>
#include <mlir/InitAllDialects.h> #include <mlir/InitAllDialects.h>
#include <mlir/InitAllPasses.h> #include <mlir/InitAllPasses.h>
#include <mlir/Interfaces/ViewLikeInterface.h>
#include <mlir/Pass/Pass.h> #include <mlir/Pass/Pass.h>
#include <mlir/Pass/PassManager.h> #include <mlir/Pass/PassManager.h>
#include <mlir/Support/FileUtilities.h> #include <mlir/Support/FileUtilities.h>
@ -56,6 +59,7 @@ static llvm::cl::opt<bool> allowUnregisteredDialects(
llvm::cl::init(false)); llvm::cl::init(false));
int main(int argc, char **argv) { int main(int argc, char **argv) {
mlir::registerDialect<mlir::linalg::LinalgDialect>();
mlir::registerDialect<mlir::AffineDialect>(); mlir::registerDialect<mlir::AffineDialect>();
mlir::registerDialect<mlir::LLVM::LLVMDialect>(); mlir::registerDialect<mlir::LLVM::LLVMDialect>();
mlir::registerDialect<mlir::scf::SCFDialect>(); mlir::registerDialect<mlir::scf::SCFDialect>();
@ -65,6 +69,12 @@ int main(int argc, char **argv) {
#define GEN_PASS_REGISTRATION #define GEN_PASS_REGISTRATION
#include "mlir/Transforms/Passes.h.inc" #include "mlir/Transforms/Passes.h.inc"
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Affine/Passes.h.inc"
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Linalg/Passes.h.inc"
llvm::InitLLVM y(argc, argv); llvm::InitLLVM y(argc, argv);
mlir::registerDialect<mlir::ONNXOpsDialect>(); mlir::registerDialect<mlir::ONNXOpsDialect>();