[MLIR] Move from add_dependencies() to DEPENDS

add_llvm_library and add_llvm_executable may need to create new targets with
appropriate dependencies.  As a result, it is not sufficient in some
configurations (namely LLVM_BUILD_LLVM_DYLIB=on) to only call
add_dependencies().  Instead, the explicit TableGen dependencies must
be passed to add_llvm_library() or add_llvm_executable() using the DEPENDS
keyword.

Differential Revision: https://reviews.llvm.org/D74930
This commit is contained in:
Stephen Neuendorffer 2020-02-20 10:48:51 -08:00
parent 6d894afdea
commit 4594d0e943
29 changed files with 116 additions and 89 deletions

View File

@ -9,10 +9,13 @@ add_toy_chapter(toyc-ch2
parser/AST.cpp
mlir/MLIRGen.cpp
mlir/Dialect.cpp
DEPENDS
ToyCh2OpsIncGen
)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
add_dependencies(toyc-ch2 ToyCh2OpsIncGen)
target_link_libraries(toyc-ch2
PRIVATE
MLIRAnalysis

View File

@ -14,10 +14,12 @@ add_toy_chapter(toyc-ch3
mlir/MLIRGen.cpp
mlir/Dialect.cpp
mlir/ToyCombine.cpp
DEPENDS
ToyCh3OpsIncGen
ToyCh3CombineIncGen
)
add_dependencies(toyc-ch3 ToyCh3OpsIncGen)
add_dependencies(toyc-ch3 ToyCh3CombineIncGen)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)

View File

@ -15,12 +15,14 @@ add_toy_chapter(toyc-ch4
mlir/Dialect.cpp
mlir/ShapeInferencePass.cpp
mlir/ToyCombine.cpp
DEPENDS
ToyCh4OpsIncGen
ToyCh4ShapeInferenceInterfaceIncGen
ToyCh4CombineIncGen
MLIRCallOpInterfacesIncGen
)
add_dependencies(toyc-ch4 ToyCh4OpsIncGen)
add_dependencies(toyc-ch4 ToyCh4ShapeInferenceInterfaceIncGen)
add_dependencies(toyc-ch4 ToyCh4CombineIncGen)
add_dependencies(toyc-ch4 MLIRCallOpInterfacesIncGen)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)

View File

@ -16,12 +16,14 @@ add_toy_chapter(toyc-ch5
mlir/LowerToAffineLoops.cpp
mlir/ShapeInferencePass.cpp
mlir/ToyCombine.cpp
DEPENDS
ToyCh5ShapeInferenceInterfaceIncGen
ToyCh5OpsIncGen
ToyCh5CombineIncGen
MLIRCallOpInterfacesIncGen
)
add_dependencies(toyc-ch5 ToyCh5ShapeInferenceInterfaceIncGen)
add_dependencies(toyc-ch5 ToyCh5OpsIncGen)
add_dependencies(toyc-ch5 ToyCh5CombineIncGen)
add_dependencies(toyc-ch5 MLIRCallOpInterfacesIncGen)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)

View File

@ -18,12 +18,14 @@ add_toy_chapter(toyc-ch6
mlir/LowerToLLVM.cpp
mlir/ShapeInferencePass.cpp
mlir/ToyCombine.cpp
DEPENDS
ToyCh6ShapeInferenceInterfaceIncGen
ToyCh6OpsIncGen
ToyCh6CombineIncGen
MLIRCallOpInterfacesIncGen
)
add_dependencies(toyc-ch6 ToyCh6ShapeInferenceInterfaceIncGen)
add_dependencies(toyc-ch6 ToyCh6OpsIncGen)
add_dependencies(toyc-ch6 ToyCh6CombineIncGen)
add_dependencies(toyc-ch6 MLIRCallOpInterfacesIncGen)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)

View File

@ -18,12 +18,14 @@ add_toy_chapter(toyc-ch7
mlir/LowerToLLVM.cpp
mlir/ShapeInferencePass.cpp
mlir/ToyCombine.cpp
DEPENDS
ToyCh7ShapeInferenceInterfaceIncGen
ToyCh7OpsIncGen
ToyCh7CombineIncGen
MLIRCallOpInterfacesIncGen
)
add_dependencies(toyc-ch7 ToyCh7ShapeInferenceInterfaceIncGen)
add_dependencies(toyc-ch7 ToyCh7OpsIncGen)
add_dependencies(toyc-ch7 ToyCh7CombineIncGen)
add_dependencies(toyc-ch7 MLIRCallOpInterfacesIncGen)
include_directories(include/)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)

View File

@ -24,8 +24,8 @@ add_llvm_library(MLIRAnalysis
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
)
add_dependencies(MLIRAnalysis
DEPENDS
MLIRCallOpInterfacesIncGen
MLIRControlFlowInterfacesIncGen
MLIRTypeInferOpInterfaceIncGen
@ -46,8 +46,8 @@ add_llvm_library(MLIRLoopAnalysis
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
)
add_dependencies(MLIRLoopAnalysis
DEPENDS
MLIRCallOpInterfacesIncGen
MLIRControlFlowInterfacesIncGen
MLIRTypeInferOpInterfaceIncGen

View File

@ -4,10 +4,10 @@ add_public_tablegen_target(MLIRGPUToNVVMIncGen)
add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
LowerGpuOpsToNVVMOps.cpp
)
add_dependencies(MLIRGPUtoNVVMTransforms
MLIRGPUToNVVMIncGen)
DEPENDS
MLIRGPUToNVVMIncGen
)
target_link_libraries(MLIRGPUtoNVVMTransforms
PUBLIC

View File

@ -5,10 +5,10 @@ add_public_tablegen_target(MLIRGPUToSPIRVIncGen)
add_mlir_conversion_library(MLIRGPUtoSPIRVTransforms
ConvertGPUToSPIRV.cpp
ConvertGPUToSPIRVPass.cpp
)
add_dependencies(MLIRGPUtoSPIRVTransforms
MLIRGPUToSPIRVIncGen)
DEPENDS
MLIRGPUToSPIRVIncGen
)
target_link_libraries(MLIRGPUtoSPIRVTransforms
PUBLIC

View File

@ -10,10 +10,10 @@ add_mlir_conversion_library(MLIRStandardToSPIRVTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)
add_dependencies(MLIRStandardToSPIRVTransforms
MLIRStandardToSPIRVIncGen)
DEPENDS
MLIRStandardToSPIRVIncGen
)
target_link_libraries(MLIRStandardToSPIRVTransforms
PUBLIC

View File

@ -5,8 +5,8 @@ add_mlir_dialect_library(MLIRAffineOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/AffineOps
)
add_dependencies(MLIRAffineOps
DEPENDS
MLIRAffineOpsIncGen
MLIRLoopLikeInterfaceIncGen
)

View File

@ -4,6 +4,9 @@ add_mlir_dialect_library(MLIRFxpMathOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/FxpMathOps
DEPENDS
MLIRFxpMathOpsIncGen
)
target_link_libraries(MLIRFxpMathOps
@ -14,6 +17,3 @@ target_link_libraries(MLIRFxpMathOps
MLIRSupport
MLIRStandardOps
)
add_dependencies(MLIRFxpMathOps
MLIRFxpMathOpsIncGen
)

View File

@ -7,8 +7,8 @@ add_mlir_dialect_library(MLIRGPU
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/GPU
)
add_dependencies(MLIRGPU
DEPENDS
MLIRGPUOpsIncGen
)
target_link_libraries(MLIRGPU
@ -21,4 +21,5 @@ target_link_libraries(MLIRGPU
MLIRStandardOps
MLIRSupport
MLIRTransformUtils
LLVMSupport)
LLVMSupport
)

View File

@ -3,8 +3,8 @@ add_mlir_dialect_library(MLIRLLVMIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRLLVMIR
DEPENDS
MLIRControlFlowInterfacesIncGen
MLIRLLVMOpsIncGen
MLIRLLVMConversionsIncGen
@ -25,8 +25,8 @@ add_mlir_dialect_library(MLIRNVVMIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRNVVMIR
DEPENDS
MLIRNVVMOpsIncGen
MLIRNVVMConversionsIncGen
)
@ -44,8 +44,8 @@ add_mlir_dialect_library(MLIRROCDLIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/LLVMIR
)
add_dependencies(MLIRROCDLIR
DEPENDS
MLIRROCDLOpsIncGen
MLIRROCDLConversionsIncGen
)

View File

@ -7,11 +7,9 @@ add_mlir_dialect_library(MLIRLinalgTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
DEPENDS
intrinsics_gen
)
add_dependencies(MLIRLinalgTransforms
MLIRLinalgTransformPatternsIncGen
)
target_link_libraries(MLIRLinalgTransforms

View File

@ -5,8 +5,8 @@ add_mlir_dialect_library(MLIRLoopOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/LoopOps
)
add_dependencies(MLIRLoopOps
DEPENDS
MLIRLoopLikeInterfaceIncGen
MLIRLoopOpsIncGen
)

View File

@ -3,9 +3,11 @@ add_mlir_dialect_library(MLIROpenMP
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/OpenMP
)
add_dependencies(MLIROpenMP MLIROpenMPOpsIncGen)
DEPENDS
MLIROpenMPOpsIncGen
)
target_link_libraries(MLIROpenMP
PUBLIC
MLIRIR)
MLIRIR
)

View File

@ -11,8 +11,8 @@ add_mlir_dialect_library(MLIRQuantOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/QuantOps
)
add_dependencies(MLIRQuantOps
DEPENDS
MLIRQuantOpsIncGen
)
target_link_libraries(MLIRQuantOps

View File

@ -13,9 +13,7 @@ add_mlir_dialect_library(MLIRSPIRV
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
)
add_dependencies(MLIRSPIRV
MLIRControlFlowInterfacesIncGen
MLIRSPIRVAvailabilityIncGen
MLIRSPIRVCanonicalizationIncGen
@ -23,14 +21,15 @@ add_dependencies(MLIRSPIRV
MLIRSPIRVEnumsIncGen
MLIRSPIRVOpsIncGen
MLIRSPIRVOpUtilsGen
MLIRSPIRVTargetAndABIIncGen)
MLIRSPIRVTargetAndABIIncGen
)
target_link_libraries(MLIRSPIRV
PUBLIC
MLIRIR
MLIRParser
MLIRSupport
MLIRTransforms)
MLIRTransforms
)
add_subdirectory(Serialization)
add_subdirectory(Transforms)

View File

@ -6,14 +6,14 @@ add_mlir_dialect_library(MLIRSPIRVSerialization
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
DEPENDS
MLIRSPIRVSerializationGen
)
add_dependencies(MLIRSPIRVSerialization
MLIRSPIRVSerializationGen)
target_link_libraries(MLIRSPIRVSerialization
PUBLIC
MLIRIR
MLIRSPIRV
MLIRSupport
MLIRTranslation)
MLIRTranslation
)

View File

@ -5,8 +5,8 @@ add_mlir_dialect_library(MLIRStandardOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/StandardOps
)
add_dependencies(MLIRStandardOps
DEPENDS
MLIRCallOpInterfacesIncGen
MLIRControlFlowInterfacesIncGen
MLIRStandardOpsIncGen

View File

@ -6,15 +6,16 @@ add_mlir_dialect_library(MLIRVectorOps
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/VectorOps
DEPENDS
MLIRVectorOpsIncGen
MLIRVectorTransformPatternsIncGen
)
add_dependencies(MLIRVectorOps MLIRVectorOpsIncGen)
add_dependencies(MLIRVectorOps MLIRVectorTransformPatternsIncGen)
target_link_libraries(MLIRVectorOps
PUBLIC
MLIRIR
MLIRStandardOps
MLIRAffineOps
MLIRLoopOps
MLIRLoopAnalysis)
MLIRLoopAnalysis
)

View File

@ -4,12 +4,13 @@ add_llvm_library(MLIRIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
)
add_dependencies(MLIRIR
DEPENDS
MLIRCallOpInterfacesIncGen
MLIROpAsmInterfacesIncGen
)
target_link_libraries(MLIRIR
PUBLIC
MLIRSupport
LLVMSupport)
LLVMSupport
)

View File

@ -25,17 +25,20 @@ add_llvm_library(MLIRQuantizerFxpMathConfig
Configurations/FxpMathConfig.cpp
ADDITIONAL_HEADER_DIRS
)
add_dependencies(MLIRQuantizerFxpMathConfig
DEPENDS
MLIRFxpMathOpsIncGen
)
target_link_libraries(MLIRQuantizerFxpMathConfig
PUBLIC
MLIRIR
MLIRFxpMathOps
MLIRQuantOps
MLIRQuantizerSupport
MLIRStandardOps
MLIRSupport
LLVMSupport
)
# Transforms.

View File

@ -26,11 +26,12 @@ add_llvm_library(MLIRTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
DEPENDS
MLIRLoopLikeInterfaceIncGen
MLIRStandardOpsIncGen
)
add_dependencies(MLIRTransforms
MLIRLoopLikeInterfaceIncGen
MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransforms
PUBLIC
MLIRAffineOps

View File

@ -9,9 +9,11 @@ add_llvm_library(MLIRTransformUtils
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
DEPENDS
MLIRStandardOpsIncGen
)
add_dependencies(MLIRTransformUtils MLIRStandardOpsIncGen)
target_link_libraries(MLIRTransformUtils
PUBLIC
MLIRAffineOps

View File

@ -14,14 +14,15 @@ add_public_tablegen_target(MLIRTestOpsIncGen)
add_llvm_library(MLIRTestDialect
TestDialect.cpp
TestPatterns.cpp
)
add_dependencies(MLIRTestDialect
DEPENDS
MLIRControlFlowInterfacesIncGen
MLIRTestOpsIncGen
MLIRTypeInferOpInterfaceIncGen
)
target_link_libraries(MLIRTestDialect
PUBLIC
MLIRAnalysis
MLIRDialect
MLIRIR
MLIRLinalgTransforms

View File

@ -22,15 +22,18 @@ add_llvm_library(MLIRTestTransforms
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
DEPENDS
MLIRStandardOpsIncGen
MLIRTestLinalgTransformPatternsIncGen
MLIRTestVectorTransformPatternsIncGen
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../TestDialect)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
add_dependencies(MLIRTestTransforms MLIRStandardOpsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestLinalgTransformPatternsIncGen)
add_dependencies(MLIRTestTransforms MLIRTestVectorTransformPatternsIncGen)
target_link_libraries(MLIRTestTransforms
PUBLIC
MLIRAffineOps

View File

@ -69,8 +69,10 @@ if(MLIR_CUDA_RUNNER_ENABLED)
add_llvm_tool(mlir-cuda-runner
mlir-cuda-runner.cpp
)
add_dependencies(mlir-cuda-runner cuda-runtime-wrappers)
DEPENDS
cuda-runtime-wrappers
)
target_include_directories(mlir-cuda-runner
PRIVATE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)