Fix header dep (#150)

* Detect llvm-project commit change in utils/clone-mlir.sh and rebuild llvm-project
for zLinux Jenkins build bot

* Since many headers are generated and included indirectly through
other headers, there are often missing dependencies that break
parallel build. So we add header targets for KrnlOps, ONNXOps, and
MLONNXOps, and add explicit dependencies for all the relevant headers.

* fix copy-and-paste bug

Co-authored-by: Tian Jin <tjingrant@gmail.com>
This commit is contained in:
gongsu832 2020-06-08 22:38:32 -04:00 committed by GitHub
parent e2af505746
commit 43dc1a1e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 31 deletions

View File

@ -23,12 +23,15 @@ target_include_directories(OMBuilder
${ONNX_MLIR_SRC_ROOT}/third_party/onnx ${ONNX_MLIR_SRC_ROOT}/third_party/onnx
${ONNX_MLIR_SRC_ROOT}/third_party/variant ${ONNX_MLIR_SRC_ROOT}/third_party/variant
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
# If you add onnx here, it will also cause onnx to be built. However, some # If you add onnx here, it will also cause onnx to be built. However, some
# variable definitions when building onnx such as -DONNX_ML=1 -DONNX_NAMESPACE=onnx # variable definitions when building onnx such as -DONNX_ML=1 -DONNX_NAMESPACE=onnx
# will NOT be carried over when compiling FrontendDialectHelper.cpp, etc. so # will NOT be carried over when compiling FrontendDialectHelper.cpp, etc. so
# the compilation will fail. # the compilation will fail.
add_dependencies(OMBuilder OMONNXOpsInc)
add_dependencies(OMBuilder OMONNXOps OMResultTypeInferenceOpInterface) add_dependencies(OMBuilder OMONNXOps OMResultTypeInferenceOpInterface)
if (INCLUDE_ONNX_ML) if (INCLUDE_ONNX_ML)
add_dependencies(OMBuilder OMMLONNXOpsInc)
add_dependencies(OMBuilder OMMLONNXOps) add_dependencies(OMBuilder OMMLONNXOps)
endif() endif()

View File

@ -63,9 +63,11 @@ target_link_libraries(MainUtils
OMONNXRewrite OMONNXRewrite
${MLIRLibs} ${MLIRLibs}
${CMAKE_DL_LIBS}) ${CMAKE_DL_LIBS})
add_dependencies(onnx-mlir OMKrnlOpsInc OMONNXOpsInc)
if (INCLUDE_ONNX_ML) if (INCLUDE_ONNX_ML)
target_link_libraries(MainUtils OMMLONNXOps) target_link_libraries(MainUtils OMMLONNXOps)
add_dependencies(MainUtils OMMLONNXOpsInc)
endif() endif()
target_include_directories(onnx-mlir PRIVATE ${ONNX_MLIR_SRC_ROOT}) target_include_directories(onnx-mlir PRIVATE ${ONNX_MLIR_SRC_ROOT})

View File

@ -29,6 +29,7 @@ target_include_directories(OMONNXToKrnl
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
# Linking dependencies: # Header dependencies
add_dependencies(OMONNXToKrnl add_dependencies(OMONNXToKrnl OMKrnlOpsInc OMONNXOpsInc)
OMKrnlOps) # Linking dependencies
add_dependencies(OMONNXToKrnl OMKrnlOps)

View File

@ -3,6 +3,10 @@ onnx_mlir_tablegen(KrnlOps.hpp.inc -gen-op-decls)
onnx_mlir_tablegen(KrnlOps.cpp.inc -gen-op-defs) onnx_mlir_tablegen(KrnlOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(OMKrnlOpsIncGen) add_public_tablegen_target(OMKrnlOpsIncGen)
# Header dependencies target for KrnOps.hpp
add_custom_target(OMKrnlOpsInc
DEPENDS OMKrnlOpsIncGen)
add_library(OMKrnlOps add_library(OMKrnlOps
KrnlOps.hpp KrnlOps.hpp
KrnlOps.cpp KrnlOps.cpp
@ -15,4 +19,4 @@ target_include_directories(OMKrnlOps
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMKrnlOps OMKrnlOpsIncGen) add_dependencies(OMKrnlOps OMKrnlOpsInc)

View File

@ -5,6 +5,13 @@ onnx_mlir_tablegen(MLONNXOps.cpp.inc -gen-op-defs "-I${ONNX_MLIR_SRC_ROOT}/compi
set(GEN_DOC_FILE ${CMAKE_BINARY_DIR}/docs/Dialects/mlonnx.md) set(GEN_DOC_FILE ${CMAKE_BINARY_DIR}/docs/Dialects/mlonnx.md)
add_public_tablegen_target(OMMLONNXOpsIncGen) add_public_tablegen_target(OMMLONNXOpsIncGen)
# Header dependencies target for MLONNXOps.hpp
add_custom_target(OMMLONNXOpsInc
DEPENDS OMMLONNXOpsIncGen
OMPromotableConstOperandsOpInterfaceIncGen
OMResultTypeInferenceOpInterfaceIncGen
ShapeInferenceOpInterfaceIncGen)
add_library(OMMLONNXOps add_library(OMMLONNXOps
MLONNXOps.cpp MLONNXOps.cpp
MLONNXOps.hpp) MLONNXOps.hpp)
@ -13,8 +20,9 @@ target_include_directories(OMMLONNXOps
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMMLONNXOps OMMLONNXOpsIncGen) # Header dependencies
# Linking dependencies: add_dependencies(OMMLONNXOps OMMLONNXOpsInc)
# Linking dependencies
add_dependencies(OMMLONNXOps add_dependencies(OMMLONNXOps
OMPromotableConstOperandsOpInterface OMPromotableConstOperandsOpInterface
OMResultTypeInferenceOpInterface OMResultTypeInferenceOpInterface

View File

@ -4,6 +4,13 @@ onnx_mlir_tablegen(ONNXOps.cpp.inc -gen-op-defs "-I${ONNX_MLIR_SRC_ROOT}/compile
set(GEN_DOC_FILE ${CMAKE_BINARY_DIR}/docs/Dialects/onnx.md) set(GEN_DOC_FILE ${CMAKE_BINARY_DIR}/docs/Dialects/onnx.md)
add_public_tablegen_target(OMONNXOpsIncGen) add_public_tablegen_target(OMONNXOpsIncGen)
# Header dependencies target for ONNXOps.hpp
add_custom_target(OMONNXOpsInc
DEPENDS OMONNXOpsIncGen
OMPromotableConstOperandsOpInterfaceIncGen
OMResultTypeInferenceOpInterfaceIncGen
ShapeInferenceOpInterfaceIncGen)
add_library(OMONNXOps add_library(OMONNXOps
ONNXOps.cpp ONNXOps.cpp
ONNXOps.hpp ONNXOps.hpp
@ -14,9 +21,10 @@ target_include_directories(OMONNXOps
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMONNXOps OMONNXOpsIncGen)
target_link_libraries(OMONNXOps target_link_libraries(OMONNXOps
onnx) onnx)
add_dependencies(OMONNXOps OMONNXOpsIncGen)
# Linking dependencies: # Linking dependencies:
add_dependencies(OMONNXOps add_dependencies(OMONNXOps
OMPromotableConstOperandsOpInterface OMPromotableConstOperandsOpInterface

View File

@ -1,5 +1,5 @@
add_executable(onnx-mlir-opt ONNXMLIROpt.cpp) add_executable(onnx-mlir-opt ONNXMLIROpt.cpp)
add_dependencies(onnx-mlir-opt OMKrnlOpsIncGen) add_dependencies(onnx-mlir-opt OMKrnlOpsInc OMONNXOpsInc)
target_include_directories(onnx-mlir-opt PRIVATE ${ONNX_MLIR_SRC_ROOT}) target_include_directories(onnx-mlir-opt PRIVATE ${ONNX_MLIR_SRC_ROOT})
target_include_directories(onnx-mlir-opt PRIVATE ${ONNX_MLIR_BIN_ROOT}) target_include_directories(onnx-mlir-opt PRIVATE ${ONNX_MLIR_BIN_ROOT})

View File

@ -5,11 +5,10 @@ target_include_directories(OMKrnlToAffine
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
# Header dependencies
# Linking dependencies: add_dependencies(OMKrnlToAffine OMKrnlOpsInc)
add_dependencies(OMKrnlToAffine # Linking dependencies
OMKrnlOps add_dependencies(OMKrnlToAffine OMKrnlOps)
OMONNXOps)
add_library(OMKrnlToLLVM add_library(OMKrnlToLLVM
LowerToLLVM.cpp) LowerToLLVM.cpp)
@ -18,14 +17,15 @@ target_include_directories(OMKrnlToLLVM
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
# Header dependencies
add_dependencies(OMKrnlToLLVM OMKrnlOpsInc OMONNXOpsInc)
# Linking dependencies
add_dependencies(OMKrnlToLLVM OMKrnlOps OMONNXOps)
target_link_libraries(OMKrnlToLLVM target_link_libraries(OMKrnlToLLVM
onnx) onnx)
#Linking dependencies:
add_dependencies(OMKrnlToLLVM
OMKrnlOps
OMONNXOps)
add_library(OMElideKrnlGlobalConstants add_library(OMElideKrnlGlobalConstants
ElideKrnlGlobalConstants.cpp) ElideKrnlGlobalConstants.cpp)
target_include_directories(OMElideKrnlGlobalConstants target_include_directories(OMElideKrnlGlobalConstants
@ -33,8 +33,9 @@ target_include_directories(OMElideKrnlGlobalConstants
${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMElideKrnlGlobalConstants # Header dependencies
OMKrnlOps add_dependencies(OMElideKrnlGlobalConstants OMKrnlOpsInc)
OMONNXOps) # Linking dependencies
add_dependencies(OMElideKrnlGlobalConstants OMKrnlOps)
add_subdirectory(ONNX) add_subdirectory(ONNX)

View File

@ -3,8 +3,10 @@ add_library(OMAttributePromotion
target_include_directories(OMAttributePromotion target_include_directories(OMAttributePromotion
PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT} PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNF_MLIR_SRC_ROOT}) ${ONNF_MLIR_SRC_ROOT})
# Header dependencies
# Linking dependencies: add_dependencies(OMAttributePromotion
OMONNXOpsInc OMPromotableConstOperandsOpInterfaceIncGen)
# Linking dependencies
add_dependencies(OMAttributePromotion add_dependencies(OMAttributePromotion
OMPromotableConstOperandsOpInterface) OMPromotableConstOperandsOpInterface)
target_link_libraries(OMAttributePromotion target_link_libraries(OMAttributePromotion
@ -16,8 +18,11 @@ target_include_directories(OMElideConstants
PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT} PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNF_MLIR_SRC_ROOT}) ${ONNF_MLIR_SRC_ROOT})
add_dependencies(OMElideConstants # Header dependencies
OMONNXOps) add_dependencies(OMElideConstants OMONNXOpsInc)
# Linking dependencies
add_dependencies(OMElideConstants OMONNXOps)
target_link_libraries(OMElideConstants target_link_libraries(OMElideConstants
onnx) onnx)
@ -45,14 +50,16 @@ add_library(OMONNXRewrite
target_include_directories(OMONNXRewrite target_include_directories(OMONNXRewrite
PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT} PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNF_MLIR_SRC_ROOT}) ${ONNF_MLIR_SRC_ROOT})
# Header dependencies
add_dependencies(OMONNXRewrite add_dependencies(OMONNXRewrite
OMONNXOpsInc
OMONNXRewriteIncGen OMONNXRewriteIncGen
OMONNXDecomposeIncGen OMONNXDecomposeIncGen
OMONNXCombineIncGen OMONNXCombineIncGen
OMONNXConstPropIncGen) OMONNXConstPropIncGen)
# Linking dependencies:
add_dependencies(OMONNXRewrite # Linking dependencies
OMONNXOps) add_dependencies(OMONNXRewrite OMONNXOps)
target_link_libraries(OMONNXRewrite target_link_libraries(OMONNXRewrite
onnx) onnx)
@ -60,7 +67,7 @@ add_library(OMShapeInference ShapeInferencePass.cpp)
target_include_directories(OMShapeInference target_include_directories(OMShapeInference
PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT} PRIVATE ${ONNX_MLIR_SRC_ROOT} ${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT}) ${ONNX_MLIR_SRC_ROOT})
# Header dependencies
add_dependencies(OMShapeInference ShapeInferenceOpInterfaceIncGen) add_dependencies(OMShapeInference ShapeInferenceOpInterfaceIncGen)
# Linking dependencies: # Linking dependencies
add_dependencies(OMShapeInference add_dependencies(OMShapeInference OMShapeInferenceOpInterface)
OMShapeInferenceOpInterface)