mirror of https://github.com/llvm/torch-mlir
Add skeleton of type inference pass.
parent
432e01fe8f
commit
3e58d8fe37
|
@ -1 +1,2 @@
|
|||
add_subdirectory(IR)
|
||||
add_subdirectory(Transforms)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
set(LLVM_TARGET_DEFINITIONS Passes.td)
|
||||
mlir_tablegen(Passes.h.inc -gen-pass-decls)
|
||||
add_public_tablegen_target(NPCOMPBasicpyPassIncGen)
|
||||
|
||||
add_mlir_doc(Passes -gen-pass-doc Transforms ./)
|
|
@ -0,0 +1,26 @@
|
|||
//===------------------------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, 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_DIALECT_BASICPY_TRANSFORMS_PASSES_H
|
||||
#define NPCOMP_DIALECT_BASICPY_TRANSFORMS_PASSES_H
|
||||
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace mlir {
|
||||
namespace NPCOMP {
|
||||
namespace Basicpy {
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>> createFunctionTypeInferencePass();
|
||||
|
||||
} // namespace Basicpy
|
||||
} // namespace NPCOMP
|
||||
} // namespace mlir
|
||||
|
||||
#endif // NPCOMP_DIALECT_BASICPY_TRANSFORMS_PASSES_H
|
|
@ -0,0 +1,23 @@
|
|||
//===-- Passes.td - Pass definition file -------------------*- tablegen -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, 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_BASICPY_PASSES
|
||||
#define NPCOMP_BASICPY_PASSES
|
||||
|
||||
include "mlir/Pass/PassBase.td"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TypeInference
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def FunctionTypeInference : Pass<"basicpy-type-inference", "FuncOp"> {
|
||||
let summary = "Performs function level type inference";
|
||||
let constructor = "mlir::NPCOMP::Basicpy::createFunctionTypeInferencePass()";
|
||||
}
|
||||
|
||||
#endif // NPCOMP_BASICPY_PASSES
|
|
@ -10,6 +10,7 @@
|
|||
#define NPCOMP_INITALL_H
|
||||
|
||||
#include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h"
|
||||
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h"
|
||||
#include "npcomp/Dialect/NpcompRt/IR/NpcompRtDialect.h"
|
||||
#include "npcomp/Dialect/Numpy/IR/NumpyDialect.h"
|
||||
#include "npcomp/Dialect/TCF/IR/TCFDialect.h"
|
||||
|
@ -47,6 +48,8 @@ inline void registerAllPasses() {
|
|||
mlir::NPCOMP::createLowerToHybridTensorMemRefPipeline);
|
||||
#define GEN_PASS_REGISTRATION
|
||||
#include "npcomp/Conversion/Passes.h.inc"
|
||||
#define GEN_PASS_REGISTRATION
|
||||
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h.inc"
|
||||
}
|
||||
} // namespace NPCOMP
|
||||
} // namespace mlir
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
add_subdirectory(IR)
|
||||
add_subdirectory(Transforms)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//===- BasicpyOps.cpp - Core numpy dialect ops --------------------*- C++
|
||||
//-*-===//
|
||||
//===- BasicpyOps.cpp - Core numpy dialect ops -------------------*- C++-*-===//
|
||||
//
|
||||
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
add_mlir_conversion_library(NPCOMPBasicpyPasses
|
||||
TypeInference.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${PROJECT_SOURCE_DIR}/include/npcomp/Dialect/Basicpy/Transforms
|
||||
|
||||
DEPENDS
|
||||
NPCOMPBasicpyPassIncGen
|
||||
|
||||
LINK_COMPONENTS
|
||||
Core
|
||||
|
||||
LINK_LIBS PUBLIC
|
||||
MLIRIR
|
||||
MLIRPass
|
||||
)
|
|
@ -0,0 +1,25 @@
|
|||
//===- PassDetail.h - Pass details ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, 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_DIALECT_BASICPY_TRANSFORMS_PASSDETAIL_H
|
||||
#define NPCOMP_DIALECT_BASICPY_TRANSFORMS_PASSDETAIL_H
|
||||
|
||||
#include "mlir/Pass/Pass.h"
|
||||
|
||||
namespace mlir {
|
||||
namespace NPCOMP {
|
||||
namespace Basicpy {
|
||||
|
||||
#define GEN_PASS_CLASSES
|
||||
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h.inc"
|
||||
|
||||
} // namespace Basicpy
|
||||
} // namespace NPCOMP
|
||||
} // end namespace mlir
|
||||
|
||||
#endif // NPCOMP_DIALECT_BASICPY_TRANSFORMS_PASSDETAIL_H
|
|
@ -0,0 +1,27 @@
|
|||
//===- TypeInference.cpp - Type inference passes -----------------*- 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "PassDetail.h"
|
||||
#include "npcomp/Dialect/Basicpy/Transforms/Passes.h"
|
||||
|
||||
using namespace mlir;
|
||||
using namespace mlir::NPCOMP::Basicpy;
|
||||
|
||||
namespace {
|
||||
|
||||
class FunctionTypeInferencePass
|
||||
: public FunctionTypeInferenceBase<FunctionTypeInferencePass> {
|
||||
void runOnOperation() override {}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<OperationPass<FuncOp>>
|
||||
mlir::NPCOMP::Basicpy::createFunctionTypeInferencePass() {
|
||||
return std::make_unique<FunctionTypeInferencePass>();
|
||||
}
|
|
@ -78,6 +78,7 @@ target_link_libraries(${extension_target}
|
|||
NPCOMPTCF
|
||||
NPCOMPNpcompRt
|
||||
NPCOMPBasicpyDialect
|
||||
NPCOMPBasicpyPasses
|
||||
NPCOMPNumpyDialect
|
||||
|
||||
# Core dialects
|
||||
|
|
Loading…
Reference in New Issue