diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index a684015b0a..beac33c912 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -168,6 +168,9 @@ jobs: cmake .. \ -GNinja \ -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ + -DCMAKE_C_VISIBILITY_PRESET=hidden \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ -DAIE_COMPILER=NONE \ -DAIE_LINKER=NONE \ -DHOST_COMPILER=NONE \ diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 7548f9547d..9bdbb0414b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -49,25 +49,6 @@ declare_mlir_dialect_python_bindings( # Extensions ################################################################################ -get_target_property(CoreSources MLIRPythonExtension.Core INTERFACE_SOURCES) - -get_target_property(DialectsLinalgPybindSources MLIRPythonExtension.Dialects.Linalg.Pybind INTERFACE_SOURCES) -get_target_property(DialectsQuantPybindSources MLIRPythonExtension.Dialects.Quant.Pybind INTERFACE_SOURCES) -get_target_property(DialectsPDLPybindSources MLIRPythonExtension.Dialects.PDL.Pybind INTERFACE_SOURCES) -get_target_property(DialectsSparseTensorPybindSources MLIRPythonExtension.Dialects.SparseTensor.Pybind INTERFACE_SOURCES) -get_target_property(DialectsTransformPybindSources MLIRPythonExtension.Dialects.Transform.Pybind INTERFACE_SOURCES) - -get_target_property(AsyncDialectPassesSources MLIRPythonExtension.AsyncDialectPasses INTERFACE_SOURCES) -get_target_property(ExecutionEngineSources MLIRPythonExtension.ExecutionEngine INTERFACE_SOURCES) -get_target_property(GPUDialectPassesSources MLIRPythonExtension.GPUDialectPasses INTERFACE_SOURCES) -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) - set(LIBS LLVMSupport @@ -106,6 +87,25 @@ set(LIBS MLIRCAPITransforms ) +get_target_property(CoreSources MLIRPythonExtension.Core INTERFACE_SOURCES) + +get_target_property(DialectsLinalgPybindSources MLIRPythonExtension.Dialects.Linalg.Pybind INTERFACE_SOURCES) +get_target_property(DialectsQuantPybindSources MLIRPythonExtension.Dialects.Quant.Pybind INTERFACE_SOURCES) +get_target_property(DialectsPDLPybindSources MLIRPythonExtension.Dialects.PDL.Pybind INTERFACE_SOURCES) +get_target_property(DialectsSparseTensorPybindSources MLIRPythonExtension.Dialects.SparseTensor.Pybind INTERFACE_SOURCES) +get_target_property(DialectsTransformPybindSources MLIRPythonExtension.Dialects.Transform.Pybind INTERFACE_SOURCES) + +get_target_property(AsyncDialectPassesSources MLIRPythonExtension.AsyncDialectPasses INTERFACE_SOURCES) +get_target_property(ExecutionEngineSources MLIRPythonExtension.ExecutionEngine INTERFACE_SOURCES) +get_target_property(GPUDialectPassesSources MLIRPythonExtension.GPUDialectPasses INTERFACE_SOURCES) +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 diff --git a/utils/build-llvm-local.sh b/utils/build-llvm-local.sh index e942be98aa..100aa581a1 100755 --- a/utils/build-llvm-local.sh +++ b/utils/build-llvm-local.sh @@ -43,6 +43,9 @@ CMAKE_CONFIGS="\ -DLLVM_ENABLE_PROJECTS=mlir \ -DLLVM_TARGETS_TO_BUILD:STRING=X86;ARM;AArch64 \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ + -DCMAKE_C_VISIBILITY_PRESET=hidden \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ -DCMAKE_EXPORT_COMPILE_COMMANDS=1" if [ -x "$(command -v lld)" ]; then diff --git a/utils/build-llvm.sh b/utils/build-llvm.sh index babe2b51a6..99b8021c24 100755 --- a/utils/build-llvm.sh +++ b/utils/build-llvm.sh @@ -34,6 +34,9 @@ CMAKE_CONFIGS="\ -DLLVM_INSTALL_UTILS=ON \ -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ + -DCMAKE_C_VISIBILITY_PRESET=hidden \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ -DLLVM_ENABLE_ASSERTIONS=ON" if [ -x "$(command -v lld)" ]; then diff --git a/utils/build-mlir-aie-cross.sh b/utils/build-mlir-aie-cross.sh index 7f309d0f93..5544d75daf 100755 --- a/utils/build-mlir-aie-cross.sh +++ b/utils/build-mlir-aie-cross.sh @@ -55,6 +55,9 @@ CMAKE_CONFIGS="\ -DLLVM_ENABLE_RTTI=ON \ -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \ -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ + -DCMAKE_C_VISIBILITY_PRESET=hidden \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ -Wno-dev" if [ -x "$(command -v lld)" ]; then diff --git a/utils/build-mlir-aie.sh b/utils/build-mlir-aie.sh index f836105fc9..4db64e135d 100755 --- a/utils/build-mlir-aie.sh +++ b/utils/build-mlir-aie.sh @@ -45,6 +45,9 @@ CMAKE_CONFIGS="\ -DCMAKE_MODULE_PATH=${CMAKEMODULES_DIR}/modulesXilinx \ -DCMAKE_INSTALL_PREFIX="../${INSTALL_DIR}" \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VISIBILITY_INLINES_HIDDEN=ON \ + -DCMAKE_C_VISIBILITY_PRESET=hidden \ + -DCMAKE_CXX_VISIBILITY_PRESET=hidden \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_ENABLE_RTTI=ON \ -DAIE_RUNTIME_TARGETS=x86_64;aarch64 \