[Mlir-commits] [mlir] 7691b69 - [mlir][cmake] Don't add dependencies on mlir-(generic-)headers

Jeff Niu llvmlistbot at llvm.org
Fri Sep 2 12:13:58 PDT 2022


Author: Jeff Niu
Date: 2022-09-02T12:13:49-07:00
New Revision: 7691b69d5b2f5e9d8b210add22926335b3541444

URL: https://github.com/llvm/llvm-project/commit/7691b69d5b2f5e9d8b210add22926335b3541444
DIFF: https://github.com/llvm/llvm-project/commit/7691b69d5b2f5e9d8b210add22926335b3541444.diff

LOG: [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

Added: 
    

Modified: 
    mlir/cmake/modules/AddMLIR.cmake
    mlir/lib/Analysis/CMakeLists.txt
    mlir/lib/Dialect/Transform/IR/CMakeLists.txt
    mlir/lib/Pass/CMakeLists.txt
    mlir/lib/Rewrite/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 15079eea3009c..dbcc13aea7815 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 23bcb97b6a2ee..6b75bacd449aa 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 3041d20a87c4c..e770dc1ebd9c7 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 5ca9b4163bb8a..76ed4a48e2007 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 e0395be6cd6f5..03afe409adf6f 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


        


More information about the Mlir-commits mailing list