diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f4c450415..bb990fd6e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,9 +172,6 @@ add_subdirectory(include) add_subdirectory(lib) add_subdirectory(runtime_lib) add_subdirectory(aie_runtime_lib) -add_subdirectory(reference_designs) -add_subdirectory(test) -add_subdirectory(tutorials) add_subdirectory(tools) add_subdirectory(data) add_subdirectory(python) @@ -211,3 +208,9 @@ if(NOT LLVM_INSTALL_TOOLCHAIN_ONLY) endif() add_subdirectory(cmake/modules) + +# Last because each of these has its own CMakeLists.txt which reloads/re-finds LLVM, thus resettings globals. +add_subdirectory(reference_designs) +add_subdirectory(test) +add_subdirectory(tutorials) + diff --git a/python/AIEMLIRModule.cpp b/python/AIEMLIRModule.cpp index 4a8188191f..e0b22dc551 100644 --- a/python/AIEMLIRModule.cpp +++ b/python/AIEMLIRModule.cpp @@ -15,7 +15,7 @@ namespace py = pybind11; using namespace mlir::python::adaptors; -PYBIND11_MODULE(_aieMlir, m) { +PYBIND11_MODULE(_aie, m) { ::aieRegisterAllPasses(); @@ -23,7 +23,7 @@ PYBIND11_MODULE(_aieMlir, m) { AIE MLIR Python bindings -------------------------- - .. currentmodule:: _aieMlir + .. currentmodule:: _aie .. autosummary:: :toctree: _generate diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9bdbb0414b..8b3d49a520 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -19,8 +19,6 @@ declare_mlir_python_sources(AIEPythonSources ROOT_DIR "${AIE_PYTHON_ROOT_DIR}" ) -declare_mlir_python_sources(AIEPythonExtensions) - declare_mlir_python_sources(AIEPythonSources.Dialects ADD_TO_PARENT AIEPythonSources ) @@ -49,43 +47,11 @@ declare_mlir_dialect_python_bindings( # Extensions ################################################################################ -set(LIBS - LLVMSupport - - ${MLIR_DIALECT_LIBS} - ${MLIR_CONVERSION_LIBS} - ${MLIR_EXTENSION_LIBS} - ${MLIR_TRANSLATION_LIBS} - - ADF - AIE - AIETransforms - AIEX - AIEXTransforms - AIEXUtils - MLIRAIEVec - MLIRAIEVecToLLVM - MLIRAIEVecTransformOps - MLIRAIEVecTransforms - - AIECAPI - - MLIRCAPIAsync - MLIRCAPIConversion - MLIRCAPIDebug - MLIRCAPIExecutionEngine - MLIRCAPIFunc - MLIRCAPIGPU - MLIRCAPIIR - MLIRCAPIInterfaces - MLIRCAPILinalg - MLIRCAPIPDL - MLIRCAPIQuant - MLIRCAPIRegisterEverything - MLIRCAPISparseTensor - MLIRCAPITransformDialect - MLIRCAPITransforms -) +get_property(MLIR_CONVERSION_LIBS GLOBAL PROPERTY MLIR_CONVERSION_LIBS) +get_property(MLIR_DIALECT_LIBS GLOBAL PROPERTY MLIR_DIALECT_LIBS) +get_property(MLIR_EXTENSION_LIBS GLOBAL PROPERTY MLIR_EXTENSION_LIBS) +get_property(MLIR_TRANSLATION_LIBS GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) +get_property(MLIR_UPSTREAM_CAPI_LIBS GLOBAL PROPERTY MLIR_UPSTREAM_CAPI_LIBS) get_target_property(CoreSources MLIRPythonExtension.Core INTERFACE_SOURCES) @@ -101,14 +67,8 @@ get_target_property(GPUDialectPassesSources MLIRPythonExtension.GPUDialectPasses get_target_property(SparseTensorDialectPassesSources MLIRPythonExtension.SparseTensorDialectPasses INTERFACE_SOURCES) get_target_property(RegisterEverythingSources MLIRPythonExtension.RegisterEverything INTERFACE_SOURCES) -get_property(MLIR_DIALECT_LIBS GLOBAL PROPERTY MLIR_DIALECT_LIBS) -get_property(MLIR_CONVERSION_LIBS GLOBAL PROPERTY MLIR_CONVERSION_LIBS) -get_property(MLIR_EXTENSION_LIBS GLOBAL PROPERTY MLIR_EXTENSION_LIBS) -get_property(MLIR_TRANSLATION_LIBS GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) - -declare_mlir_python_extension(AIEPythonExtensionsOmni.MLIR - MODULE_NAME _aieMlirOmni - ADD_TO_PARENT AIEPythonExtensions +declare_mlir_python_extension(AIEPythonExtensions + MODULE_NAME _aie ROOT_DIR "/" SOURCES @@ -130,7 +90,13 @@ declare_mlir_python_extension(AIEPythonExtensionsOmni.MLIR ${RegisterEverythingSources} PRIVATE_LINK_LIBS - ${LIBS} + LLVMSupport + AIECAPI + ${MLIR_CONVERSION_LIBS} + ${MLIR_DIALECT_LIBS} + ${MLIR_EXTENSION_LIBS} + ${MLIR_TRANSLATION_LIBS} + ${MLIR_UPSTREAM_CAPI_LIBS} ) _flatten_mlir_python_targets(mlir_python_sources_deps MLIRPythonSources) @@ -158,8 +124,7 @@ add_mlir_python_modules(AIEPythonModules add_subdirectory(compiler) add_dependencies(AIEPythonModules AIECompilerPythonModules) -set(_extensions - _aieMlir +set(_other_extensions _mlir _mlirAsyncPasses _mlirDialectsLinalg @@ -177,21 +142,20 @@ set(_extensions file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/python/aie/_mlir_libs") -foreach(ext ${_extensions}) +foreach(ext ${_other_extensions}) add_custom_target("symlink_${ext}" COMMAND ${CMAKE_COMMAND} -E create_symlink - "_aieMlirOmni${PYTHON_MODULE_EXTENSION}" + "_aie${PYTHON_MODULE_EXTENSION}" "${ext}${PYTHON_MODULE_EXTENSION}" - DEPENDS AIEPythonExtensionsOmni.MLIR + DEPENDS AIEPythonExtensions WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/python/aie/_mlir_libs" ) add_dependencies(AIEPythonModules "symlink_${ext}") install(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink - _aieMlirOmni${PYTHON_MODULE_EXTENSION} + _aie${PYTHON_MODULE_EXTENSION} ${ext}${PYTHON_MODULE_EXTENSION} WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/python/aie/_mlir_libs )" ) - endforeach() diff --git a/python/dialects/aie.py b/python/dialects/aie.py index 2b5793a296..dd815a1577 100644 --- a/python/dialects/aie.py +++ b/python/dialects/aie.py @@ -10,12 +10,7 @@ from ._AIE_enum_gen import * from ._AIE_ops_gen import * from ._AIE_ops_gen import * -from .._mlir_libs._aieMlir import * -from .._mlir_libs._aieMlir import ( - register_dialect, - ObjectFifoType, - ObjectFifoSubviewType, -) +from .._mlir_libs._aie import * from ..dialects import arith from ..dialects import memref from ..dialects.func import * diff --git a/python/dialects/aiex.py b/python/dialects/aiex.py index 90faacf1a9..f8014f3952 100644 --- a/python/dialects/aiex.py +++ b/python/dialects/aiex.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception from ._AIEX_ops_gen import * -from .._mlir_libs._aieMlir import * +from .._mlir_libs._aie import * from ..ir import * from ..dialects import arith