From 7691b69d5b2f5e9d8b210add22926335b3541444 Mon Sep 17 00:00:00 2001 From: Jeff Niu Date: Thu, 1 Sep 2022 11:06:46 -0700 Subject: [PATCH] [mlir][cmake] Don't add dependencies on mlir-(generic-)headers Every dialect was dependent on `mlir-headers`, which was causing the build of any single MLIR dialect to pull in a bunch of extra dependencies that aren't needed. Now, MLIR dialects will need to explicitly depend on `MLIR*IncGen` targets to pull in any needed headers. This does not impact the actual `mlir-header` target. Consider the "simple" Arithmetic dialect. Before: ``` % ninja MLIRArithmeticDialect [151/812] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/JSONBackend.cpp.o ``` After: ``` % ninja MLIRArithmeticDialect [207/374] Building CXX object tools/mlir/lib/TableGen/CMakeFiles/MLIRTableGen.dir/GenInfo.cpp.o ``` (Both clean builds) Reviewed By: rriddle, jpienaar Differential Revision: https://reviews.llvm.org/D133132 --- mlir/cmake/modules/AddMLIR.cmake | 6 +++--- mlir/lib/Analysis/CMakeLists.txt | 3 --- mlir/lib/Dialect/Transform/IR/CMakeLists.txt | 1 + mlir/lib/Pass/CMakeLists.txt | 3 --- mlir/lib/Rewrite/CMakeLists.txt | 3 --- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake index 15079ee..dbcc13a 100644 --- a/mlir/cmake/modules/AddMLIR.cmake +++ b/mlir/cmake/modules/AddMLIR.cmake @@ -577,19 +577,19 @@ endfunction() # Declare the library associated with a dialect. function(add_mlir_dialect_library name) set_property(GLOBAL APPEND PROPERTY MLIR_DIALECT_LIBS ${name}) - add_mlir_library(${ARGV} DEPENDS mlir-headers) + add_mlir_library(${ARGV}) endfunction(add_mlir_dialect_library) # Declare the library associated with a conversion. function(add_mlir_conversion_library name) set_property(GLOBAL APPEND PROPERTY MLIR_CONVERSION_LIBS ${name}) - add_mlir_library(${ARGV} DEPENDS mlir-headers) + add_mlir_library(${ARGV}) endfunction(add_mlir_conversion_library) # Declare the library associated with a translation. function(add_mlir_translation_library name) set_property(GLOBAL APPEND PROPERTY MLIR_TRANSLATION_LIBS ${name}) - add_mlir_library(${ARGV} DEPENDS mlir-headers) + add_mlir_library(${ARGV}) endfunction(add_mlir_translation_library) # Verification tools to aid debugging. diff --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt index 23bcb97..6b75bac 100644 --- a/mlir/lib/Analysis/CMakeLists.txt +++ b/mlir/lib/Analysis/CMakeLists.txt @@ -34,9 +34,6 @@ add_mlir_library(MLIRAnalysis ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis - DEPENDS - mlir-headers - LINK_LIBS PUBLIC MLIRCallInterfaces MLIRControlFlowInterfaces diff --git a/mlir/lib/Dialect/Transform/IR/CMakeLists.txt b/mlir/lib/Dialect/Transform/IR/CMakeLists.txt index 3041d20..e770dc1 100644 --- a/mlir/lib/Dialect/Transform/IR/CMakeLists.txt +++ b/mlir/lib/Dialect/Transform/IR/CMakeLists.txt @@ -6,6 +6,7 @@ add_mlir_dialect_library(MLIRTransformDialect DEPENDS MLIRTransformDialectIncGen MLIRTransformInterfacesIncGen + MLIRTransformOpsIncGen LINK_LIBS PUBLIC MLIRIR diff --git a/mlir/lib/Pass/CMakeLists.txt b/mlir/lib/Pass/CMakeLists.txt index 5ca9b41..76ed4a4 100644 --- a/mlir/lib/Pass/CMakeLists.txt +++ b/mlir/lib/Pass/CMakeLists.txt @@ -10,9 +10,6 @@ add_mlir_library(MLIRPass ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass - DEPENDS - mlir-generic-headers - LINK_LIBS PUBLIC MLIRAnalysis MLIRIR diff --git a/mlir/lib/Rewrite/CMakeLists.txt b/mlir/lib/Rewrite/CMakeLists.txt index e0395be..03afe40 100644 --- a/mlir/lib/Rewrite/CMakeLists.txt +++ b/mlir/lib/Rewrite/CMakeLists.txt @@ -6,9 +6,6 @@ add_mlir_library(MLIRRewrite ADDITIONAL_HEADER_DIRS ${MLIR_MAIN_INCLUDE_DIR}/mlir/Rewrite - DEPENDS - mlir-generic-headers - LINK_LIBS PUBLIC MLIRIR MLIRPDLDialect -- 2.7.4