Move most python sources to the include and lib tree.

pull/1/head
Stella Laurenzo 2020-06-18 18:02:39 -07:00
parent b21b5322f6
commit 213041449f
15 changed files with 66 additions and 44 deletions

View File

@ -6,6 +6,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef NPCOMP_PYTHON_MLIRINIT_H
#define NPCOMP_PYTHON_MLIRINIT_H
#include "mlir/Support/LogicalResult.h" #include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
@ -14,7 +17,6 @@
// here for parts of the code that are not RTTI-compatible. // here for parts of the code that are not RTTI-compatible.
namespace mlir { namespace mlir {
namespace npcomp { namespace npcomp {
namespace python { namespace python {
@ -24,3 +26,5 @@ bool npcompMlirInitialize();
} // namespace python } // namespace python
} // namespace npcomp } // namespace npcomp
} // namespace mlir } // namespace mlir
#endif // NPCOMP_PYTHON_MLIRINIT_H

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef NPCOMP_PYTHON_NATIVE_MLIR_IR_H #ifndef NPCOMP_PYTHON_MLIR_IR_H
#define NPCOMP_PYTHON_NATIVE_MLIR_IR_H #define NPCOMP_PYTHON_MLIR_IR_H
#include "PybindUtils.h" #include "PybindUtils.h"
@ -198,4 +198,4 @@ protected:
} // namespace mlir } // namespace mlir
#endif // NPCOMP_PYTHON_NATIVE_MLIR_IR_H #endif // NPCOMP_PYTHON_MLIR_IR_H

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef NPCOMP_PYTHON_NATIVE_MLIR_PASS_H #ifndef NPCOMP_PYTHON_MLIR_PASS_H
#define NPCOMP_PYTHON_NATIVE_MLIR_PASS_H #define NPCOMP_PYTHON_MLIR_PASS_H
#include "MlirIr.h" #include "MlirIr.h"
#include "PybindUtils.h" #include "PybindUtils.h"
@ -29,4 +29,4 @@ private:
} // namespace mlir } // namespace mlir
#endif // NPCOMP_PYTHON_NATIVE_MLIR_PASS_H #endif // NPCOMP_PYTHON_MLIR_PASS_H

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef NPCOMP_PYTHON_NATIVE_NPCOMP_MODULE_H #ifndef NPCOMP_PYTHON_NPCOMP_MODULE_H
#define NPCOMP_PYTHON_NATIVE_NPCOMP_MODULE_H #define NPCOMP_PYTHON_NPCOMP_MODULE_H
#include "PybindUtils.h" #include "PybindUtils.h"
@ -25,4 +25,4 @@ void defineNpcompDialect(py::module m);
} // namespace npcomp } // namespace npcomp
} // namespace mlir } // namespace mlir
#endif // NPCOMP_PYTHON_NATIVE_NPCOMP_MODULE_H #endif // NPCOMP_PYTHON_NPCOMP_MODULE_H

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifndef NPCOMP_PYTHON_NATIVE_PYBIND_UTILS_H #ifndef NPCOMP_PYTHON_PYBIND_UTILS_H
#define NPCOMP_PYTHON_NATIVE_PYBIND_UTILS_H #define NPCOMP_PYTHON_PYBIND_UTILS_H
#include <string> #include <string>
@ -52,4 +52,4 @@ inline pybind11::error_already_set raiseValueError(const std::string &message) {
} // namespace pybind11 } // namespace pybind11
#endif // NPCOMP_PYTHON_NATIVE_PYBIND_UTILS_H #endif // NPCOMP_PYTHON_PYBIND_UTILS_H

View File

@ -1,6 +1,7 @@
add_subdirectory(Conversion) add_subdirectory(Conversion)
add_subdirectory(Dialect) add_subdirectory(Dialect)
add_subdirectory(E2E) add_subdirectory(E2E)
add_subdirectory(Python)
################################################################################ ################################################################################
# Setup the initialization target. # Setup the initialization target.

View File

@ -0,0 +1,27 @@
add_library(NPCOMPPythonCommon
MlirInit.cpp
MlirIr.cpp
MlirPass.cpp
NpcompDialect.cpp
PybindUtils.cpp
CoreDialects.cpp
)
target_link_libraries(NPCOMPPythonCommon
pybind11::module
NPCOMPInitAll
# Core dialects
MLIRSCF
# Upstream depends
LLVMSupport
MLIRDialect
MLIREDSC
MLIREDSCInterface
MLIRIR
MLIRLLVMIR
MLIRPass
MLIRTransforms
)

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MlirIr.h" #include "npcomp/Python/MlirIr.h"
#include "NpcompModule.h" #include "npcomp/Python/NpcompModule.h"
#include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/SCF/SCF.h"

View File

@ -6,7 +6,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MlirInit.h" #include "npcomp/Python/MlirInit.h"
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"
#include "mlir/InitAllDialects.h" #include "mlir/InitAllDialects.h"

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MlirIr.h" #include "npcomp/Python/MlirIr.h"
#include "NpcompModule.h" #include "npcomp/Python/NpcompModule.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Attributes.h" #include "mlir/IR/Attributes.h"

View File

@ -6,9 +6,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MlirPass.h" #include "npcomp/Python/MlirPass.h"
#include "MlirInit.h" #include "npcomp/Python/MlirInit.h"
#include "NpcompModule.h" #include "npcomp/Python/NpcompModule.h"
#include "mlir/Pass/PassRegistry.h" #include "mlir/Pass/PassRegistry.h"

View File

@ -6,8 +6,8 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "MlirIr.h" #include "npcomp/Python/MlirIr.h"
#include "NpcompModule.h" #include "npcomp/Python/NpcompModule.h"
#include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h" #include "npcomp/Dialect/Basicpy/IR/BasicpyDialect.h"
#include "npcomp/Dialect/Basicpy/IR/BasicpyOps.h" #include "npcomp/Dialect/Basicpy/IR/BasicpyOps.h"

View File

@ -6,7 +6,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PybindUtils.h" #include "npcomp/Python/PybindUtils.h"
namespace pybind11 { namespace pybind11 {

View File

@ -25,15 +25,9 @@ set(NPCOMP_PYEXT_LIBADD ${PYTHON_LIBRARIES})
# compiled separately for now. # compiled separately for now.
set(extension_target NPCOMPNativePyExt) set(extension_target NPCOMPNativePyExt)
set(extension_llvm_sources set(extension_llvm_sources
MlirInit.cpp
) )
set(extension_pybind_sources set(extension_pybind_sources
MlirIr.cpp
MlirPass.cpp
NpcompDialect.cpp
NpcompModule.cpp NpcompModule.cpp
PybindUtils.cpp
CoreDialects.cpp
) )
set_source_files_properties( set_source_files_properties(
${extension_pybind_sources} ${extension_pybind_sources}
@ -69,12 +63,8 @@ target_link_libraries(${extension_target}
PRIVATE PRIVATE
${dialect_libs} ${dialect_libs}
${conversion_libs} ${conversion_libs}
pybind11::module
NPCOMPInitAll NPCOMPInitAll
NPCOMPPythonCommon
# Core dialects
MLIRSCF
# Upstream depends # Upstream depends
LLVMSupport LLVMSupport

View File

@ -9,9 +9,9 @@
#include <cstddef> #include <cstddef>
#include <unordered_map> #include <unordered_map>
#include "MlirInit.h" #include "npcomp/Python/MlirInit.h"
#include "NpcompModule.h" #include "npcomp/Python/NpcompModule.h"
#include "PybindUtils.h" #include "npcomp/Python/PybindUtils.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"