diff --git a/midend/include/buddy-mlir-c/Registration.h b/midend/include/buddy-mlir-c/RegisterEverything.h similarity index 56% rename from midend/include/buddy-mlir-c/Registration.h rename to midend/include/buddy-mlir-c/RegisterEverything.h index b1261a4bd..982b55c7e 100644 --- a/midend/include/buddy-mlir-c/Registration.h +++ b/midend/include/buddy-mlir-c/RegisterEverything.h @@ -1,4 +1,4 @@ -//===----------- Registration.h - Register all dialects and passes --------===// +//===------- RegisterEverything.h - Register all dialects and passes ------===// // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#ifndef BUDDYMLIR_C_REGISTRATION_H -#define BUDDYMLIR_C_REGISTRATION_H +#ifndef BUDDYMLIR_C_REGISTEREVERYTHING_H +#define BUDDYMLIR_C_REGISTEREVERYTHING_H #include "mlir-c/IR.h" #include "mlir-c/Support.h" @@ -24,16 +24,17 @@ extern "C" { #endif -/** Registers all dialects with a context. - * This is needed before creating IR for these Dialects. - */ -MLIR_CAPI_EXPORTED void buddyMlirRegisterAllDialects(MlirContext context); +// Registers all dialects with a context. +MLIR_CAPI_EXPORTED void buddyRegisterAllDialects(MlirDialectRegistry registry); -/** Registers all passes for symbolic access with the global registry. */ -MLIR_CAPI_EXPORTED void buddyMlirRegisterAllPasses(); +// Register all translations to LLVM IR for dialects that can support it. +MLIR_CAPI_EXPORTED void buddyRegisterAllTranslations(MlirContext context); + +// Registers all passes for symbolic access with the global registry. +MLIR_CAPI_EXPORTED void buddyRegisterAllPasses(); #ifdef __cplusplus } #endif -#endif // BUDDYMLIR_C_REGISTRATION_H +#endif // BUDDYMLIR_C_REGISTEREVERYTHING_H diff --git a/midend/lib/CAPI/Registration.cpp b/midend/lib/Bindings/Python/RegisterEverything.cpp similarity index 51% rename from midend/lib/CAPI/Registration.cpp rename to midend/lib/Bindings/Python/RegisterEverything.cpp index e1252a249..cae505006 100644 --- a/midend/lib/CAPI/Registration.cpp +++ b/midend/lib/Bindings/Python/RegisterEverything.cpp @@ -1,4 +1,4 @@ -//===------ Registration.cpp - C Interface for MLIR Registration ----------===// +//===- RegisterEverything.cpp - API to register all dialects/passes -------===// // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,20 +14,18 @@ // //===----------------------------------------------------------------------===// -#include "buddy-mlir-c/Registration.h" +#include "buddy-mlir-c/RegisterEverything.h" +#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "mlir/CAPI/IR.h" -#include "mlir/Conversion/Passes.h" -#include "mlir/Dialect/Linalg/Passes.h" -#include "mlir/Transforms/Passes.h" -#include "buddy-mlir-c/InitAll.h" +PYBIND11_MODULE(_mlirRegisterEverything, m) { + m.doc() = "Buddy MLIR All Dialects, Translations and Passes Registration"; -void buddyMlirRegisterAllDialects(MlirContext context) { - mlir::DialectRegistry registry; - mlir::buddy::registerAllDialects(registry); + m.def("register_dialects", [](MlirDialectRegistry registry) { + buddyRegisterAllDialects(registry); + }); + m.def("register_llvm_translations", + [](MlirContext context) { buddyRegisterAllTranslations(context); }); - unwrap(context)->appendDialectRegistry(registry); - unwrap(context)->loadAllAvailableDialects(); -} - -void buddyMlirRegisterAllPasses() { mlir::buddy::registerAllPasses(); } + // Register all passes on load. + buddyRegisterAllPasses(); +} \ No newline at end of file diff --git a/midend/lib/CAPI/CMakeLists.txt b/midend/lib/CAPI/CMakeLists.txt index 6dcfae7d1..fc4cb6cc0 100644 --- a/midend/lib/CAPI/CMakeLists.txt +++ b/midend/lib/CAPI/CMakeLists.txt @@ -1,13 +1,24 @@ +get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) +get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) +get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS) +get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS) + add_mlir_public_c_api_library(BuddyMLIRCAPI Dialects.cpp - Registration.cpp + RegisterEverything.cpp ADDITIONAL_HEADER_DIRS ${PROJECT_SOURCE_DIR}/midend/include/buddy-mlir-c LINK_LIBS PUBLIC - MLIRIR - MLIRSupport + ${dialect_libs} + ${translation_libs} + ${conversion_libs} + ${extension_libs} + MLIRBuiltinToLLVMIRTranslation + MLIRCAPIIR + MLIRLLVMToLLVMIRTranslation + MLIRCAPITransforms BuddyBud BuddyDAP BuddyDIP @@ -18,4 +29,5 @@ add_mlir_public_c_api_library(BuddyMLIRCAPI BuddySche VectorExp BuddyMLIRInitAll + BuddyToLLVMIRTranslationRegistration ) diff --git a/midend/lib/CAPI/RegisterEverything.cpp b/midend/lib/CAPI/RegisterEverything.cpp new file mode 100644 index 000000000..b89b89b78 --- /dev/null +++ b/midend/lib/CAPI/RegisterEverything.cpp @@ -0,0 +1,69 @@ +//===------- RegisterEverything.cpp - Register all MLIR entities ----------===// +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//===----------------------------------------------------------------------===// + +#include "buddy-mlir-c/InitAll.h" +#include "buddy-mlir-c/RegisterEverything.h" +#include "mlir-c/RegisterEverything.h" + +#include "mlir/CAPI/IR.h" +#include "mlir/Dialect/DLTI/DLTI.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/InitAllDialects.h" +#include "mlir/InitAllExtensions.h" +#include "mlir/InitAllPasses.h" +#include "mlir/Target/LLVMIR/Dialect/All.h" +#include "mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h" +#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" +#include "Target/LLVMIR/Dialect/Gemmini/GemminiToLLVMIRTranslation.h" +#include "Target/LLVMIR/Dialect/RVV/RVVToLLVMIRTranslation.h" + +using namespace buddy; +using namespace mlir; + +namespace buddy { +void registerBuddyToLLVMIRTranslation(); +} + +void buddyRegisterAllDialects(MlirDialectRegistry registry) { + // Register all Dialects from UPSTREAM MLIR + mlir::registerAllDialects(*unwrap(registry)); + + // Register all Dialects from BUDDY MLIR + mlir::buddy::registerAllDialects(*unwrap(registry)); +} + +void buddyRegisterAllTranslations(MlirContext context) { + auto &ctx = *unwrap(context); + mlir::DialectRegistry registry; + // Register all Translations from UPSTREAM MLIR + registry.insert(); + mlir::registerAllToLLVMIRTranslations(registry); + + // Register all Translations from BUDDY MLIR + registerRVVDialectTranslation(registry); + registerGemminiDialectTranslation(registry); + + ctx.appendDialectRegistry(registry); +} + +void buddyRegisterAllPasses() { + // Register all Passes from UPSTREAM MLIR + mlir::registerAllPasses(); + + // Register all Passes from BUDDY MLIR + mlir::buddy::registerAllPasses(); +} diff --git a/midend/python/Bindings/DialectBud.cpp b/midend/python/Bindings/DialectBud.cpp deleted file mode 100644 index c0f6de6b1..000000000 --- a/midend/python/Bindings/DialectBud.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===---- DialectBud.cpp - Pybind module for Bud dialect API support ------===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_budDialects, m) { - - auto budM = m.def_submodule("bud"); - - buddyMlirRegisterAllPasses(); - - budM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__bud__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectDAP.cpp b/midend/python/Bindings/DialectDAP.cpp deleted file mode 100644 index 943b7cf02..000000000 --- a/midend/python/Bindings/DialectDAP.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===---- DialectDAP.cpp - Pybind module for DAP dialect API support ------===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_dapDialects, m) { - - auto dapM = m.def_submodule("dap"); - - buddyMlirRegisterAllPasses(); - - dapM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__dap__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectDIP.cpp b/midend/python/Bindings/DialectDIP.cpp deleted file mode 100644 index f1d53302d..000000000 --- a/midend/python/Bindings/DialectDIP.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===---- DialectDIP.cpp - Pybind module for DIP dialect API support ------===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_dipDialects, m) { - - auto dipM = m.def_submodule("dip"); - - buddyMlirRegisterAllPasses(); - - dipM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__dip__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectGemmini.cpp b/midend/python/Bindings/DialectGemmini.cpp deleted file mode 100644 index 29e9d48a9..000000000 --- a/midend/python/Bindings/DialectGemmini.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===- DialectGemmini.cpp - Pybind module for Gemmini dialect API support -===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_gemminiDialects, m) { - - auto gemminiM = m.def_submodule("gemmini"); - - buddyMlirRegisterAllPasses(); - - gemminiM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__gemmini__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectRVV.cpp b/midend/python/Bindings/DialectRVV.cpp deleted file mode 100644 index d560ea1e3..000000000 --- a/midend/python/Bindings/DialectRVV.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===---- DialectRVV.cpp - Pybind module for RVV dialect API support ------===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_rvvDialects, m) { - - auto rvvM = m.def_submodule("rvv"); - - buddyMlirRegisterAllPasses(); - - rvvM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__rvv__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectSche.cpp b/midend/python/Bindings/DialectSche.cpp deleted file mode 100644 index 1b9dcd5e7..000000000 --- a/midend/python/Bindings/DialectSche.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===--- DialectSche.cpp - Pybind module for Sche dialect API support -----===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_scheDialects, m) { - - auto scheM = m.def_submodule("sche"); - - buddyMlirRegisterAllPasses(); - - scheM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__sche__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/Bindings/DialectVectorExp.cpp b/midend/python/Bindings/DialectVectorExp.cpp deleted file mode 100644 index 46947deba..000000000 --- a/midend/python/Bindings/DialectVectorExp.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===DialectVectorExp.cpp - Pybind module for VectorExp dialect API support===// -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//===----------------------------------------------------------------------===// - -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include "buddy-mlir-c/Dialects.h" -#include "buddy-mlir-c/Registration.h" - -namespace py = pybind11; -using namespace mlir::python::adaptors; - -PYBIND11_MODULE(_vector_expDialects, m) { - - auto vector_expM = m.def_submodule("vector_exp"); - - buddyMlirRegisterAllPasses(); - - vector_expM.def( - "register_dialect", - [](MlirContext context, bool load) { - MlirDialectHandle handle = mlirGetDialectHandle__vector_exp__(); - mlirDialectHandleRegisterDialect(handle, context); - if (load) { - mlirDialectHandleLoadDialect(handle, context); - } - }, - py::arg("context") = py::none(), py::arg("load") = true); -} diff --git a/midend/python/CMakeLists.txt b/midend/python/CMakeLists.txt index b50328489..b36090b46 100644 --- a/midend/python/CMakeLists.txt +++ b/midend/python/CMakeLists.txt @@ -81,78 +81,85 @@ declare_mlir_dialect_python_bindings( # dependencies. ################################################################################ -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Bud.Pybind - MODULE_NAME _budDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.bud - SOURCES - Bindings/DialectBud.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +set(PYTHON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../lib/Bindings/Python") -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.DAP.Pybind - MODULE_NAME _dapDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.dap - SOURCES - Bindings/DialectDAP.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Bud.Pybind +# MODULE_NAME _budDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.bud +# SOURCES +# Bindings/DialectBud.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.DIP.Pybind - MODULE_NAME _dipDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.dip - SOURCES - Bindings/DialectDIP.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.DAP.Pybind +# MODULE_NAME _dapDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.dap +# SOURCES +# Bindings/DialectDAP.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Gemmini.Pybind - MODULE_NAME _gemminiDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.gemmini - SOURCES - Bindings/DialectGemmini.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.DIP.Pybind +# MODULE_NAME _dipDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.dip +# SOURCES +# Bindings/DialectDIP.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.RVV.Pybind - MODULE_NAME _rvvDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.rvv - SOURCES - Bindings/DialectRVV.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Gemmini.Pybind +# MODULE_NAME _gemminiDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.gemmini +# SOURCES +# Bindings/DialectGemmini.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Sche.Pybind - MODULE_NAME _scheDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.sche - SOURCES - Bindings/DialectSche.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.RVV.Pybind +# MODULE_NAME _rvvDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.rvv +# SOURCES +# Bindings/DialectRVV.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.VectorExp.Pybind - MODULE_NAME _vector_expDialects - ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.vector_exp - SOURCES - Bindings/DialectVectorExp.cpp - EMBED_CAPI_LINK_LIBS - BuddyMLIRCAPI -) +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.Sche.Pybind +# MODULE_NAME _scheDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.sche +# SOURCES +# Bindings/DialectSche.cpp +# EMBED_CAPI_LINK_LIBS +# BuddyMLIRCAPI +# ) -# declare_mlir_python_extension(BuddyMLIRPythonSources.Extension -# MODULE_NAME _buddyRegisterEverything -# ADD_TO_PARENT BuddyMLIRPythonSources +# declare_mlir_python_extension(BuddyMLIRPythonSources.Dialects.VectorExp.Pybind +# MODULE_NAME _vector_expDialects +# ADD_TO_PARENT BuddyMLIRPythonSources.Dialects.vector_exp # SOURCES -# Bindings/RegisterEverything.cpp +# Bindings/DialectVectorExp.cpp # EMBED_CAPI_LINK_LIBS # BuddyMLIRCAPI # ) +declare_mlir_python_extension(BuddyMLIRPythonSources.Extension + MODULE_NAME _mlirRegisterEverything + ROOT_DIR "${PYTHON_SOURCE_DIR}" + ADD_TO_PARENT BuddyMLIRPythonSources + SOURCES + RegisterEverything.cpp + PRIVATE_LINK_LIBS + LLVMSupport + EMBED_CAPI_LINK_LIBS + BuddyMLIRCAPI + MLIRCAPIConversion + MLIRCAPITransforms +) + ################################################################################ # Common CAPI dependency DSO. # All python extensions must link through one DSO which exports the CAPI, and @@ -174,8 +181,7 @@ add_mlir_python_common_capi_library(BuddyMLIRPythonCAPI DECLARED_SOURCES BuddyMLIRPythonSources MLIRPythonSources - - MLIRPythonExtension.RegisterEverything + MLIRPythonExtension.Core ) ################################################################################ @@ -187,9 +193,8 @@ add_mlir_python_modules(BuddyMLIRPythonModules INSTALL_PREFIX "python_packages/mlir_core/buddy_mlir" DECLARED_SOURCES BuddyMLIRPythonSources - - MLIRPythonExtension.RegisterEverything MLIRPythonSources + MLIRPythonExtension.Core COMMON_CAPI_LINK_LIBS BuddyMLIRPythonCAPI MLIRPythonCAPI diff --git a/midend/python/buddy_mlir/dialects/bud.py b/midend/python/buddy_mlir/dialects/bud.py index 55948f155..7cc060fdd 100644 --- a/midend/python/buddy_mlir/dialects/bud.py +++ b/midend/python/buddy_mlir/dialects/bud.py @@ -15,4 +15,3 @@ # ===--------------------------------------------------------------------------- from ._bud_ops_gen import * -from .._mlir_libs._budDialects.bud import * diff --git a/midend/python/buddy_mlir/dialects/dap.py b/midend/python/buddy_mlir/dialects/dap.py index 1e7451b2c..969d967ab 100644 --- a/midend/python/buddy_mlir/dialects/dap.py +++ b/midend/python/buddy_mlir/dialects/dap.py @@ -15,4 +15,3 @@ # ===--------------------------------------------------------------------------- from ._dap_ops_gen import * -from .._mlir_libs._dapDialects.dap import * diff --git a/midend/python/buddy_mlir/dialects/dip.py b/midend/python/buddy_mlir/dialects/dip.py index 2e288cdc1..60ee9262d 100644 --- a/midend/python/buddy_mlir/dialects/dip.py +++ b/midend/python/buddy_mlir/dialects/dip.py @@ -15,4 +15,3 @@ # ===--------------------------------------------------------------------------- from ._dip_ops_gen import * -from .._mlir_libs._dipDialects.dip import * diff --git a/midend/python/buddy_mlir/dialects/gemmini.py b/midend/python/buddy_mlir/dialects/gemmini.py index eb81d84d9..92f1a7ed9 100644 --- a/midend/python/buddy_mlir/dialects/gemmini.py +++ b/midend/python/buddy_mlir/dialects/gemmini.py @@ -14,5 +14,4 @@ # # ===--------------------------------------------------------------------------- -from ._gemmini_ops_gen import * -from .._mlir_libs._gemminiDialects.gemmini import * +from ._gemmini_ops_gen import * \ No newline at end of file diff --git a/midend/python/buddy_mlir/dialects/rvv.py b/midend/python/buddy_mlir/dialects/rvv.py index 186a10ca3..dea335547 100644 --- a/midend/python/buddy_mlir/dialects/rvv.py +++ b/midend/python/buddy_mlir/dialects/rvv.py @@ -14,5 +14,4 @@ # # ===--------------------------------------------------------------------------- -from ._rvv_ops_gen import * -from .._mlir_libs._rvvDialects.rvv import * +from ._rvv_ops_gen import * \ No newline at end of file diff --git a/midend/python/buddy_mlir/dialects/sche.py b/midend/python/buddy_mlir/dialects/sche.py index ae3a4b791..a05068567 100644 --- a/midend/python/buddy_mlir/dialects/sche.py +++ b/midend/python/buddy_mlir/dialects/sche.py @@ -15,4 +15,3 @@ # ===--------------------------------------------------------------------------- from ._sche_ops_gen import * -from .._mlir_libs._scheDialects.sche import * diff --git a/midend/python/buddy_mlir/dialects/vector_exp.py b/midend/python/buddy_mlir/dialects/vector_exp.py index 195ac7282..d448526a5 100644 --- a/midend/python/buddy_mlir/dialects/vector_exp.py +++ b/midend/python/buddy_mlir/dialects/vector_exp.py @@ -15,4 +15,3 @@ # ===--------------------------------------------------------------------------- from ._vector_exp_ops_gen import * -from .._mlir_libs._vector_expDialects.vector_exp import * diff --git a/tests/Python/test_python.py b/tests/Python/test_python.py index e8cfd7aa2..3ff34fd03 100644 --- a/tests/Python/test_python.py +++ b/tests/Python/test_python.py @@ -10,7 +10,6 @@ ) with Context(): - gemmini.register_dialect() mod = Module.parse(""" %0 = arith.constant 0 : i8 %1 = arith.constant 1 : i8