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/variant
${ONNX_MLIR_SRC_ROOT})
# 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
# will NOT be carried over when compiling FrontendDialectHelper.cpp, etc. so
# the compilation will fail.
add_dependencies(OMBuilder OMONNXOpsInc)
add_dependencies(OMBuilder OMONNXOps OMResultTypeInferenceOpInterface)
if (INCLUDE_ONNX_ML)
add_dependencies(OMBuilder OMMLONNXOpsInc)
add_dependencies(OMBuilder OMMLONNXOps)
endif()

View File

@ -63,9 +63,11 @@ target_link_libraries(MainUtils
OMONNXRewrite
${MLIRLibs}
${CMAKE_DL_LIBS})
add_dependencies(onnx-mlir OMKrnlOpsInc OMONNXOpsInc)
if (INCLUDE_ONNX_ML)
target_link_libraries(MainUtils OMMLONNXOps)
add_dependencies(MainUtils OMMLONNXOpsInc)
endif()
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_SRC_ROOT})
# Linking dependencies:
add_dependencies(OMONNXToKrnl
OMKrnlOps)
# Header dependencies
add_dependencies(OMONNXToKrnl OMKrnlOpsInc OMONNXOpsInc)
# 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)
add_public_tablegen_target(OMKrnlOpsIncGen)
# Header dependencies target for KrnOps.hpp
add_custom_target(OMKrnlOpsInc
DEPENDS OMKrnlOpsIncGen)
add_library(OMKrnlOps
KrnlOps.hpp
KrnlOps.cpp
@ -15,4 +19,4 @@ target_include_directories(OMKrnlOps
${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_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)
add_public_tablegen_target(OMMLONNXOpsIncGen)
# Header dependencies target for MLONNXOps.hpp
add_custom_target(OMMLONNXOpsInc
DEPENDS OMMLONNXOpsIncGen
OMPromotableConstOperandsOpInterfaceIncGen
OMResultTypeInferenceOpInterfaceIncGen
ShapeInferenceOpInterfaceIncGen)
add_library(OMMLONNXOps
MLONNXOps.cpp
MLONNXOps.hpp)
@ -13,8 +20,9 @@ target_include_directories(OMMLONNXOps
${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMMLONNXOps OMMLONNXOpsIncGen)
# Linking dependencies:
# Header dependencies
add_dependencies(OMMLONNXOps OMMLONNXOpsInc)
# Linking dependencies
add_dependencies(OMMLONNXOps
OMPromotableConstOperandsOpInterface
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)
add_public_tablegen_target(OMONNXOpsIncGen)
# Header dependencies target for ONNXOps.hpp
add_custom_target(OMONNXOpsInc
DEPENDS OMONNXOpsIncGen
OMPromotableConstOperandsOpInterfaceIncGen
OMResultTypeInferenceOpInterfaceIncGen
ShapeInferenceOpInterfaceIncGen)
add_library(OMONNXOps
ONNXOps.cpp
ONNXOps.hpp
@ -14,9 +21,10 @@ target_include_directories(OMONNXOps
${ONNX_MLIR_SRC_ROOT}
${ONNX_MLIR_BIN_ROOT}
${ONNX_MLIR_SRC_ROOT})
add_dependencies(OMONNXOps OMONNXOpsIncGen)
target_link_libraries(OMONNXOps
onnx)
add_dependencies(OMONNXOps OMONNXOpsIncGen)
# Linking dependencies:
add_dependencies(OMONNXOps
OMPromotableConstOperandsOpInterface

View File

@ -1,5 +1,5 @@
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_BIN_ROOT})

View File

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

View File

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