@@ -670,6 +670,29 @@ declare_mlir_python_extension(MLIRPythonExtension.Core
670670 MLIRCAPIFunc
671671)
672672
673+ # This extension exposes an API to register all dialects, extensions, and passes
674+ # packaged in upstream MLIR and it is used for the upstream "mlir" Python
675+ # package. Downstreams will likely want to provide their own and not depend
676+ # on this one, since it links in the world.
677+ # Note that this is not added to any top-level source target for transitive
678+ # inclusion: It must be included explicitly by downstreams if desired. Note that
679+ # this has a very large impact on what gets built/packaged.
680+ declare_mlir_python_extension(MLIRPythonExtension.RegisterEverything
681+ MODULE_NAME _mlirRegisterEverything
682+ ROOT_DIR "${PYTHON_SOURCE_DIR} "
683+ PYTHON_BINDINGS_LIBRARY nanobind
684+ SOURCES
685+ RegisterEverything.cpp
686+ PRIVATE_LINK_LIBS
687+ LLVMSupport
688+ EMBED_CAPI_LINK_LIBS
689+ MLIRCAPIConversion
690+ MLIRCAPITransforms
691+ MLIRCAPIRegisterAllPasses
692+ MLIRCAPIRegisterAllExtensions
693+ MLIRCAPIRegisterAllLLVMTranslations
694+ )
695+
673696declare_mlir_python_extension(MLIRPythonExtension.Dialects.Linalg.Pybind
674697 MODULE_NAME _mlirDialectsLinalg
675698 ADD_TO_PARENT MLIRPythonSources.Dialects.linalg
@@ -988,6 +1011,7 @@ add_mlir_python_common_capi_library(${MLIR_PYTHON_CAPI_DYLIB_NAME}
9881011 MLIRPythonCAPI.HeaderSources
9891012 DECLARED_SOURCES
9901013 MLIRPythonSources
1014+ MLIRPythonExtension.RegisterEverything
9911015 ${_ADDL_TEST_SOURCES}
9921016)
9931017
@@ -1096,6 +1120,7 @@ endif()
10961120
10971121set (_declared_sources
10981122 MLIRPythonSources
1123+ MLIRPythonExtension.RegisterEverything
10991124 MLIRPythonCAPICTypesBinding)
11001125if (NOT CMAKE_CROSSCOMPILING )
11011126 list (APPEND _declared_sources MLIRPythonExtension.Core.type_stub_gen)
0 commit comments