Skip to content

Reapply "[mlir] Link libraries that aren't included in libMLIR to libMLIR" #123910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mlir/cmake/modules/AddMLIR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,9 @@ endfunction()
# EXCLUDE_FROM_LIBMLIR
# Don't include this library in libMLIR.so. This option should be used
# for test libraries, executable-specific libraries, or rarely used libraries
# with large dependencies.
# with large dependencies. When using it, please link libraries included
# in libMLIR via mlir_target_link_libraries(), to ensure that the library
# does not pull in static dependencies when MLIR_LINK_MLIR_DYLIB=ON is used.
# OBJECT
# The library's object library is referenced using "obj.${name}". For this to
# work reliably, this flag ensures that the OBJECT library exists.
Expand Down
4 changes: 3 additions & 1 deletion mlir/lib/CAPI/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
set(LLVM_LINK_COMPONENTS
nativecodegen
native
orcjit
support
)

# Main API shared library.
add_mlir_upstream_c_api_library(MLIRCAPIExecutionEngine
ExecutionEngine.cpp
Expand Down
7 changes: 5 additions & 2 deletions mlir/lib/ExecutionEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ add_mlir_library(MLIRExecutionEngine
IPO
Passes
${LLVM_JIT_LISTENER_LIB}
)

LINK_LIBS PUBLIC
mlir_target_link_libraries(MLIRExecutionEngine PUBLIC
MLIRBuiltinToLLVMIRTranslation
MLIRExecutionEngineUtils
MLIRLLVMDialect
Expand Down Expand Up @@ -139,8 +140,10 @@ add_mlir_library(MLIRJitRunner
JITLink

LINK_LIBS PUBLIC
${dialect_libs}
MLIRExecutionEngine
)
mlir_target_link_libraries(MLIRJitRunner PUBLIC
${dialect_libs}
MLIRFuncDialect
MLIRFuncToLLVM
MLIRIR
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/ExecutionEngine/SparseTensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ add_mlir_library(MLIRSparseTensorRuntime
Storage.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRSparseTensorRuntime PUBLIC
MLIRSparseTensorEnums
mlir_float16_utils
)
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ add_mlir_library(MLIRTestAnalysis
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRTestAnalysis PUBLIC
MLIRAffineDialect
MLIRAnalysis
MLIRFunctionInterfaces
MLIRMemRefDialect
MLIRPass
MLIRTestDialect
)

target_include_directories(MLIRTestAnalysis
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Conversion/ConvertToSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ add_mlir_library(MLIRTestConvertToSPIRV
TestSPIRVVectorUnrolling.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTestConvertToSPIRV PUBLIC
MLIRArithDialect
MLIRFuncDialect
MLIRPass
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Conversion/FuncToLLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ add_mlir_library(MLIRTestFuncToLLVM
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRTestFuncToLLVM PUBLIC
MLIRFuncToLLVM
MLIRLLVMCommonConversion
MLIRLLVMDialect
MLIRLLVMIRTransforms
MLIRPass
MLIRTestDialect
)

target_include_directories(MLIRTestFuncToLLVM
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Conversion/MathToVCIX/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRTestMathToVCIX
TestMathToVCIXConversion.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTestMathToVCIX PUBLIC
MLIRArithDialect
MLIRFuncDialect
MLIRMathDialect
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Conversion/OneToNTypeConversion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ add_mlir_library(MLIRTestOneToNTypeConversionPass
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRTestOneToNTypeConversionPass PUBLIC
MLIRFuncDialect
MLIRFuncTransforms
MLIRIR
MLIRPass
MLIRSCFDialect
MLIRSCFTransforms
MLIRTestDialect
MLIRTransformUtils
)

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Conversion/VectorToSPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRTestVectorToSPIRV
TestVectorReductionToSPIRVDotProd.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTestVectorToSPIRV PUBLIC
MLIRVectorToSPIRV
MLIRArithDialect
MLIRFuncDialect
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Dialect/Affine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ add_mlir_library(MLIRAffineTransformsTestPasses
Core

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRAffineTransformsTestPasses PUBLIC
MLIRArithTransforms
MLIRAffineAnalysis
MLIRAffineTransforms
Expand All @@ -30,7 +33,6 @@ add_mlir_library(MLIRAffineTransformsTestPasses
MLIRSupport
MLIRMemRefDialect
MLIRTensorDialect
MLIRTestDialect
MLIRVectorUtils
)

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Arith/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRArithTestPasses
TestEmulateWideInt.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRArithTestPasses PUBLIC
MLIRArithDialect
MLIRArithTransforms
MLIRFuncDialect
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/ArmNeon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRArmNeonTestPasses
TestLowerToArmNeon.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRArmNeonTestPasses PUBLIC
MLIRArmNeonDialect
MLIRArmNeonTransforms
MLIRIR
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/ArmSME/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRArmSMETestPasses
TestLowerToArmSME.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRArmSMETestPasses PUBLIC
MLIRArithToArmSME
MLIRArmSMEToLLVM
MLIRArmSMEToSCF
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Bufferization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRBufferizationTestPasses
TestTensorCopyInsertion.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRBufferizationTestPasses PUBLIC
MLIRBufferizationDialect
MLIRBufferizationTransforms
MLIRIR
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/ControlFlow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRControlFlowTestPasses
TestAssert.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRControlFlowTestPasses PUBLIC
MLIRControlFlowToLLVM
MLIRFuncDialect
MLIRLLVMCommonConversion
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Dialect/DLTI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ add_mlir_library(MLIRDLTITestPasses
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRDLTITestPasses PUBLIC
MLIRDLTIDialect
MLIRPass
MLIRTestDialect
)

target_include_directories(MLIRDLTITestPasses
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Dialect/Func/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ add_mlir_library(MLIRFuncTestPasses
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRFuncTestPasses PUBLIC
MLIRAffineDialect
MLIRPass
MLIRFuncTransforms
MLIRTestDialect
MLIRTransformUtils
)

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ add_mlir_library(MLIRGPUTestPasses
TestGpuRewrite.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRGPUTestPasses PUBLIC
${LIBS}
)

4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/LLVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ add_mlir_library(MLIRLLVMTestPasses
TestPatterns.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRLLVMTestPasses PUBLIC
MLIRAffineToStandard
MLIRFuncDialect
MLIRFuncToLLVM
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Linalg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ add_mlir_library(MLIRLinalgTestPasses
TestPadFusion.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRLinalgTestPasses PUBLIC
MLIRAffineDialect
MLIRArithDialect
MLIRArithTransforms
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ add_mlir_library(MLIRMathTestPasses
TestPolynomialApproximation.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRMathTestPasses PUBLIC
MLIRMathTransforms
MLIRPass
MLIRTransformUtils
Expand Down
4 changes: 3 additions & 1 deletion mlir/test/lib/Dialect/MemRef/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ add_mlir_library(MLIRMemRefTestPasses
EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
MLIRTestDialect
)
mlir_target_link_libraries(MLIRMemRefTestPasses PUBLIC
MLIRPass
MLIRMemRefDialect
MLIRMemRefTransforms
MLIRTestDialect
)

target_include_directories(MLIRMemRefTestPasses
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ add_mlir_library(MLIRMeshTest
TestSimplifications.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRMeshTest PUBLIC
MLIRMeshDialect
MLIRMeshTransforms
MLIRPass
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/NVGPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRNVGPUTestPasses
TestNVGPUTransforms.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRNVGPUTestPasses PUBLIC
MLIRIR
MLIRAffineDialect
MLIRAnalysis
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/SCF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ add_mlir_library(MLIRSCFTestPasses
TestWhileOpBuilder.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRSCFTestPasses PUBLIC
MLIRMemRefDialect
MLIRPass
MLIRSCFDialect
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ add_mlir_library(MLIRSPIRVTestPasses
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRSPIRVTestPasses PUBLIC
MLIRGPUDialect
MLIRIR
MLIRPass
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Shape/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ add_mlir_library(MLIRShapeTestPasses
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Shape
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRShapeTestPasses PUBLIC
MLIRIR
MLIRPass
MLIRShapeOpsTransforms
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Tensor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ add_mlir_library(MLIRTensorTestPasses
TestTensorTransforms.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTensorTestPasses PUBLIC
MLIRArithDialect
MLIRLinalgDialect
MLIRPass
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ add_mlir_library(MLIRTestDialect
MLIRTestOpsIncGen
MLIRTestOpsSyntaxIncGen
MLIRTestOpsShardGen

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTestDialect PUBLIC
MLIRControlFlowInterfaces
MLIRDataLayoutInterfaces
MLIRDerivedAttributeOpInterface
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/TestDyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_mlir_dialect_library(MLIRTestDynDialect
TestDynDialect.cpp

EXCLUDE_FROM_LIBMLIR

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTestDynDialect PUBLIC
MLIRIR
)
4 changes: 2 additions & 2 deletions mlir/test/lib/Dialect/Tosa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ add_mlir_dialect_library(MLIRTosaTestPasses

DEPENDS
MLIRTosaPassIncGen

LINK_LIBS PUBLIC
)
mlir_target_link_libraries(MLIRTosaTestPasses PUBLIC
MLIRFuncDialect
MLIRPass
MLIRTosaDialect
Expand Down
Loading
Loading