mirror of https://github.com/llvm/torch-mlir
Move npcomp registration to helpers.
This adds: - mlir::NPCOMP::registerAllDialects() - mlir::NPCOMP::registerAllPasses()pull/1/head
parent
3a09455540
commit
927a831c1e
|
@ -0,0 +1,49 @@
|
||||||
|
//===------------------------------------------------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||||
|
// See https://llvm.org/LICENSE.txt for license information.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#ifndef NPCOMP_INITALL_H
|
||||||
|
#define NPCOMP_INITALL_H
|
||||||
|
|
||||||
|
#include "npcomp/Dialect/Basicpy/BasicpyDialect.h"
|
||||||
|
#include "npcomp/Dialect/Numpy/NumpyDialect.h"
|
||||||
|
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
|
||||||
|
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
|
||||||
|
|
||||||
|
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
|
||||||
|
#include "npcomp/Conversion/TCPToLinalg/TCPToLinalg.h"
|
||||||
|
#include "npcomp/E2E/E2E.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace mlir {
|
||||||
|
namespace NPCOMP {
|
||||||
|
|
||||||
|
inline void registerAllDialects() {
|
||||||
|
registerDialect<Basicpy::BasicpyDialect>();
|
||||||
|
registerDialect<Numpy::NumpyDialect>();
|
||||||
|
registerDialect<tcf::TCFDialect>();
|
||||||
|
registerDialect<tcp::TCPDialect>();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void registerAllPasses() {
|
||||||
|
using mlir::Pass; // The .inc files reference this unqualified.
|
||||||
|
#define GEN_PASS_REGISTRATION
|
||||||
|
#include "npcomp/E2E/Passes.h.inc"
|
||||||
|
mlir::PassPipelineRegistration<>("e2e-lowering-pipeline",
|
||||||
|
"E2E lowering pipeline.",
|
||||||
|
mlir::NPCOMP::createE2ELoweringPipeline);
|
||||||
|
mlir::PassPipelineRegistration<>(
|
||||||
|
"lower-to-hybrid-tensor-memref-pipeline",
|
||||||
|
"Pipeline lowering to hybrid tensor/memref.",
|
||||||
|
mlir::NPCOMP::createLowerToHybridTensorMemRefPipeline);
|
||||||
|
#define GEN_PASS_REGISTRATION
|
||||||
|
#include "npcomp/Conversion/Passes.h.inc"
|
||||||
|
}
|
||||||
|
} // namespace NPCOMP
|
||||||
|
} // namespace mlir
|
||||||
|
|
||||||
|
#endif // NPCOMP_INITALL_H
|
|
@ -20,14 +20,7 @@
|
||||||
#include "llvm/Support/SourceMgr.h"
|
#include "llvm/Support/SourceMgr.h"
|
||||||
#include "llvm/Support/ToolOutputFile.h"
|
#include "llvm/Support/ToolOutputFile.h"
|
||||||
|
|
||||||
#include "npcomp/Dialect/Basicpy/BasicpyDialect.h"
|
#include "npcomp/InitAll.h"
|
||||||
#include "npcomp/Dialect/Numpy/NumpyDialect.h"
|
|
||||||
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
|
|
||||||
#include "npcomp/Dialect/TCP/IR/TCPDialect.h"
|
|
||||||
|
|
||||||
#include "npcomp/Conversion/TCFToTCP/TCFToTCP.h"
|
|
||||||
#include "npcomp/Conversion/TCPToLinalg/TCPToLinalg.h"
|
|
||||||
#include "npcomp/E2E/E2E.h"
|
|
||||||
|
|
||||||
static llvm::cl::opt<std::string> inputFilename(llvm::cl::Positional,
|
static llvm::cl::opt<std::string> inputFilename(llvm::cl::Positional,
|
||||||
llvm::cl::desc("<input file>"),
|
llvm::cl::desc("<input file>"),
|
||||||
|
@ -67,26 +60,11 @@ static llvm::cl::opt<bool>
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
mlir::registerAsmPrinterCLOptions();
|
mlir::registerAsmPrinterCLOptions();
|
||||||
|
|
||||||
// TODO: Move all npcomp registration to a common helper.
|
|
||||||
mlir::registerAllDialects();
|
mlir::registerAllDialects();
|
||||||
mlir::registerAllPasses();
|
mlir::registerAllPasses();
|
||||||
|
|
||||||
mlir::registerDialect<mlir::NPCOMP::Basicpy::BasicpyDialect>();
|
mlir::NPCOMP::registerAllDialects();
|
||||||
mlir::registerDialect<mlir::NPCOMP::Numpy::NumpyDialect>();
|
mlir::NPCOMP::registerAllPasses();
|
||||||
mlir::registerDialect<mlir::NPCOMP::tcf::TCFDialect>();
|
|
||||||
mlir::registerDialect<mlir::NPCOMP::tcp::TCPDialect>();
|
|
||||||
|
|
||||||
using mlir::Pass; // The .inc files reference this unqualified.
|
|
||||||
#define GEN_PASS_REGISTRATION
|
|
||||||
#include "npcomp/E2E/Passes.h.inc"
|
|
||||||
mlir::PassPipelineRegistration<>("e2e-lowering-pipeline", "E2E lowering pipeline.",
|
|
||||||
mlir::NPCOMP::createE2ELoweringPipeline);
|
|
||||||
mlir::PassPipelineRegistration<>(
|
|
||||||
"lower-to-hybrid-tensor-memref-pipeline",
|
|
||||||
"Pipeline lowering to hybrid tensor/memref.",
|
|
||||||
mlir::NPCOMP::createLowerToHybridTensorMemRefPipeline);
|
|
||||||
#define GEN_PASS_REGISTRATION
|
|
||||||
#include "npcomp/Conversion/Passes.h.inc"
|
|
||||||
|
|
||||||
llvm::InitLLVM y(argc, argv);
|
llvm::InitLLVM y(argc, argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue