[Mlir-commits] [mlir] 5869552 - [MLIR] Refactor handling of dialect libraries

Stephen Neuendorffer llvmlistbot at llvm.org
Fri Feb 28 11:39:36 PST 2020


Author: Stephen Neuendorffer
Date: 2020-02-28T11:35:16-08:00
New Revision: 5869552821b963d5848e003fb4d9674bfa50ecb7

URL: https://github.com/llvm/llvm-project/commit/5869552821b963d5848e003fb4d9674bfa50ecb7
DIFF: https://github.com/llvm/llvm-project/commit/5869552821b963d5848e003fb4d9674bfa50ecb7.diff

LOG: [MLIR] Refactor handling of dialect libraries

Instead of creating extra libraries we don't really need, collect a
list of all dialects and use that instead.

Differential Revision: https://reviews.llvm.org/D75221

Added: 
    

Modified: 
    mlir/CMakeLists.txt
    mlir/cmake/modules/AddMLIR.cmake
    mlir/examples/toy/Ch5/CMakeLists.txt
    mlir/examples/toy/Ch6/CMakeLists.txt
    mlir/examples/toy/Ch7/CMakeLists.txt
    mlir/lib/Dialect/AffineOps/CMakeLists.txt
    mlir/lib/Dialect/CMakeLists.txt
    mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
    mlir/lib/Dialect/GPU/CMakeLists.txt
    mlir/lib/Dialect/LLVMIR/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
    mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
    mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
    mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
    mlir/lib/Dialect/LoopOps/CMakeLists.txt
    mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
    mlir/lib/Dialect/OpenMP/CMakeLists.txt
    mlir/lib/Dialect/QuantOps/CMakeLists.txt
    mlir/lib/Dialect/SDBM/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
    mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
    mlir/lib/Dialect/Shape/CMakeLists.txt
    mlir/lib/Dialect/StandardOps/CMakeLists.txt
    mlir/lib/Dialect/VectorOps/CMakeLists.txt
    mlir/tools/mlir-cpu-runner/CMakeLists.txt
    mlir/tools/mlir-cuda-runner/CMakeLists.txt
    mlir/tools/mlir-opt/CMakeLists.txt
    mlir/tools/mlir-translate/CMakeLists.txt
    mlir/tools/mlir-vulkan-runner/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index ed26ddd271a7..5afb039bff35 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -8,27 +8,6 @@ set(MLIR_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
 
-function(add_mlir_dialect dialect dialect_doc_filename)
-  set(LLVM_TARGET_DEFINITIONS ${dialect}.td)
-  mlir_tablegen(${dialect}.h.inc -gen-op-decls)
-  mlir_tablegen(${dialect}.cpp.inc -gen-op-defs)
-  add_public_tablegen_target(MLIR${dialect}IncGen)
-  add_dependencies(mlir-headers MLIR${dialect}IncGen)
-
-  # Generate Dialect Documentation
-  set(LLVM_TARGET_DEFINITIONS ${dialect_doc_filename}.td)
-  tablegen(MLIR ${dialect_doc_filename}.md -gen-op-doc "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
-  set(GEN_DOC_FILE ${MLIR_BINARY_DIR}/docs/Dialects/${dialect_doc_filename}.md)
-  add_custom_command(
-          OUTPUT ${GEN_DOC_FILE}
-          COMMAND ${CMAKE_COMMAND} -E copy
-                  ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md
-                  ${GEN_DOC_FILE}
-          DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md)
-  add_custom_target(${dialect_doc_filename}DocGen DEPENDS ${GEN_DOC_FILE})
-  add_dependencies(mlir-doc ${dialect_doc_filename}DocGen)
-endfunction()
-
 include(AddMLIR)
 
 # Installing the headers and docs needs to depend on generating any public

diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 38e32ec0eadf..125a18d9c8d0 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -26,3 +26,31 @@ function(whole_archive_link target)
   endif()
   set_target_properties(${target} PROPERTIES LINK_FLAGS ${link_flags})
 endfunction(whole_archive_link)
+
+# Declare a dialect in the include directory
+function(add_mlir_dialect dialect dialect_doc_filename)
+  set(LLVM_TARGET_DEFINITIONS ${dialect}.td)
+  mlir_tablegen(${dialect}.h.inc -gen-op-decls)
+  mlir_tablegen(${dialect}.cpp.inc -gen-op-defs)
+  add_public_tablegen_target(MLIR${dialect}IncGen)
+  add_dependencies(mlir-headers MLIR${dialect}IncGen)
+
+  # Generate Dialect Documentation
+  set(LLVM_TARGET_DEFINITIONS ${dialect_doc_filename}.td)
+  tablegen(MLIR ${dialect_doc_filename}.md -gen-op-doc "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
+  set(GEN_DOC_FILE ${MLIR_BINARY_DIR}/docs/Dialects/${dialect_doc_filename}.md)
+  add_custom_command(
+          OUTPUT ${GEN_DOC_FILE}
+          COMMAND ${CMAKE_COMMAND} -E copy
+                  ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md
+                  ${GEN_DOC_FILE}
+          DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md)
+  add_custom_target(${dialect_doc_filename}DocGen DEPENDS ${GEN_DOC_FILE})
+  add_dependencies(mlir-doc ${dialect_doc_filename}DocGen)
+endfunction()
+
+# Declare the library associated with a dialect.
+function(add_mlir_dialect_library name)
+  set_property(GLOBAL APPEND PROPERTY MLIR_DIALECT_LIBS ${name})
+  add_llvm_library(${ARGV})
+endfunction(add_mlir_dialect_library)

diff  --git a/mlir/examples/toy/Ch5/CMakeLists.txt b/mlir/examples/toy/Ch5/CMakeLists.txt
index df71c35a7a77..4c2cf4978140 100644
--- a/mlir/examples/toy/Ch5/CMakeLists.txt
+++ b/mlir/examples/toy/Ch5/CMakeLists.txt
@@ -25,12 +25,12 @@ add_dependencies(toyc-ch5 MLIRCallOpInterfacesIncGen)
 include_directories(include/)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 target_link_libraries(toyc-ch5
   PRIVATE
-    MLIRAllDialects
+    ${dialect_libs}
     MLIRAnalysis
     MLIRIR
     MLIRParser
     MLIRPass
     MLIRTransforms)
-

diff  --git a/mlir/examples/toy/Ch6/CMakeLists.txt b/mlir/examples/toy/Ch6/CMakeLists.txt
index 1497cc349868..054033399614 100644
--- a/mlir/examples/toy/Ch6/CMakeLists.txt
+++ b/mlir/examples/toy/Ch6/CMakeLists.txt
@@ -27,9 +27,10 @@ add_dependencies(toyc-ch6 MLIRCallOpInterfacesIncGen)
 include_directories(include/)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 target_link_libraries(toyc-ch6
   PRIVATE
-    MLIRAllDialects
+    ${dialect_libs}
     MLIRAffineToStandard
     MLIRAnalysis
     MLIRExecutionEngine
@@ -42,4 +43,3 @@ target_link_libraries(toyc-ch6
     MLIRTargetLLVMIR
     MLIRTransforms
     )
-

diff  --git a/mlir/examples/toy/Ch7/CMakeLists.txt b/mlir/examples/toy/Ch7/CMakeLists.txt
index ece8c873786e..8f5e5f00ef92 100644
--- a/mlir/examples/toy/Ch7/CMakeLists.txt
+++ b/mlir/examples/toy/Ch7/CMakeLists.txt
@@ -27,9 +27,10 @@ add_dependencies(toyc-ch7 MLIRCallOpInterfacesIncGen)
 include_directories(include/)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/include/)
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 target_link_libraries(toyc-ch7
   PRIVATE
-    MLIRAllDialects
+    ${dialect_libs}
     MLIRAffineToStandard
     MLIRAnalysis
     MLIRExecutionEngine

diff  --git a/mlir/lib/Dialect/AffineOps/CMakeLists.txt b/mlir/lib/Dialect/AffineOps/CMakeLists.txt
index 3d07cde5d6e6..1c1c95cf3f8f 100644
--- a/mlir/lib/Dialect/AffineOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/AffineOps/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRAffineOps
+add_mlir_dialect_library(MLIRAffineOps
   AffineOps.cpp
   AffineValueMap.cpp
   EDSC/Builders.cpp

diff  --git a/mlir/lib/Dialect/CMakeLists.txt b/mlir/lib/Dialect/CMakeLists.txt
index 0542830c1660..59186ed37964 100644
--- a/mlir/lib/Dialect/CMakeLists.txt
+++ b/mlir/lib/Dialect/CMakeLists.txt
@@ -24,29 +24,3 @@ add_llvm_library(MLIRDialect
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect
   )
 target_link_libraries(MLIRDialect MLIRIR)
-
-# Create a dummy MLIRAllDialects library for the purpose
-# of having an easy tracking of all dialects when linking
-# them in tools.
-# Empty libraries aren't possible with CMake, create a dummy file.
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/all_dialects.c "typedef int make_iso_compilers_happy;\n")
-add_llvm_library(MLIRAllDialects
-  ${CMAKE_CURRENT_BINARY_DIR}/all_dialects.c
-)
-target_link_libraries(MLIRAllDialects
-  MLIRAffineOps
-  MLIRFxpMathOps
-  MLIRGPU
-  MLIRLLVMIR
-  MLIRNVVMIR
-  MLIRROCDLIR
-  MLIRLinalgOps
-  MLIRLoopOps
-  MLIROpenMP
-  MLIRQuantOps
-  MLIRSDBM
-  MLIRShape
-  MLIRSPIRV
-  MLIRStandardOps
-  MLIRVectorOps
-)

diff  --git a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
index ba9a3001154e..021cade6e091 100644
--- a/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/FxpMathOps/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRFxpMathOps
+add_mlir_dialect_library(MLIRFxpMathOps
   IR/FxpMathOps.cpp
   Transforms/LowerUniformRealMath.cpp
 

diff  --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index dec7a8bd6867..41884a9ddb66 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRGPU
+add_mlir_dialect_library(MLIRGPU
   IR/GPUDialect.cpp
   Transforms/AllReduceLowering.cpp
   Transforms/KernelOutlining.cpp

diff  --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
index 3c684767d827..b0c4eb241381 100644
--- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRLLVMIR
+add_mlir_dialect_library(MLIRLLVMIR
   IR/LLVMDialect.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -7,7 +7,7 @@ add_llvm_library(MLIRLLVMIR
 add_dependencies(MLIRLLVMIR MLIRLLVMOpsIncGen MLIRLLVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
 target_link_libraries(MLIRLLVMIR LLVMAsmParser LLVMCore LLVMSupport MLIRIR)
 
-add_llvm_library(MLIRNVVMIR
+add_mlir_dialect_library(MLIRNVVMIR
   IR/NVVMDialect.cpp
 
   ADDITIONAL_HEADER_DIRS
@@ -16,7 +16,7 @@ add_llvm_library(MLIRNVVMIR
 add_dependencies(MLIRNVVMIR MLIRNVVMOpsIncGen MLIRNVVMConversionsIncGen LLVMAsmParser LLVMCore LLVMSupport)
 target_link_libraries(MLIRNVVMIR LLVMAsmParser MLIRIR MLIRLLVMIR LLVMSupport LLVMCore)
 
-add_llvm_library(MLIRROCDLIR
+add_mlir_dialect_library(MLIRROCDLIR
   IR/ROCDLDialect.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
index d87563f31419..96698a9ef5e8 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
@@ -5,7 +5,7 @@ set(LIBS
   )
 
 
-add_llvm_library(MLIRLinalgAnalysis
+add_mlir_dialect_library(MLIRLinalgAnalysis
   DependenceAnalysis.cpp
   
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
index d6376dd80b1d..dc87d7fad224 100644
--- a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
@@ -8,7 +8,7 @@ set(LIBS
   MLIRStandardOps
   )
 
-add_llvm_library(MLIRLinalgEDSC
+add_mlir_dialect_library(MLIRLinalgEDSC
   Builders.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
index c781e1c10f80..9dba1e52bdb7 100644
--- a/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/IR/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LIBS
   MLIRStandardOps
   )
 
-add_llvm_library(MLIRLinalgOps
+add_mlir_dialect_library(MLIRLinalgOps
   LinalgOps.cpp
   LinalgTypes.cpp
 

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index d26cced0a0e5..763ef558e47c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -16,7 +16,7 @@ set(LIBS
   MLIRVectorOps
   )
 
-add_llvm_library(MLIRLinalgTransforms
+add_mlir_dialect_library(MLIRLinalgTransforms
   Fusion.cpp
   LinalgTransforms.cpp
   LinalgToLoops.cpp

diff  --git a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
index 8b98077c9a2c..07e7588d24c2 100644
--- a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
@@ -9,7 +9,7 @@ set(LIBS
   MLIRTransformUtils
   )
   
-add_llvm_library(MLIRLinalgUtils
+add_mlir_dialect_library(MLIRLinalgUtils
 
   Utils.cpp
 

diff  --git a/mlir/lib/Dialect/LoopOps/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
index 4e9ef44eebeb..98367d1c2268 100644
--- a/mlir/lib/Dialect/LoopOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
@@ -1,5 +1,5 @@
 file(GLOB globbed *.c *.cpp)
-add_llvm_library(MLIRLoopOps
+add_mlir_dialect_library(MLIRLoopOps
   ${globbed}
   EDSC/Builders.cpp
 

diff  --git a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
index 7f5b16f1feea..eb2aaf6930f2 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRLoopOpsTransforms
+add_mlir_dialect_library(MLIRLoopOpsTransforms
   ParallelLoopFusion.cpp
   ParallelLoopSpecialization.cpp
   ParallelLoopTiling.cpp

diff  --git a/mlir/lib/Dialect/OpenMP/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
index 7b88e5c132da..bf55088a7cb0 100644
--- a/mlir/lib/Dialect/OpenMP/CMakeLists.txt
+++ b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIROpenMP
+add_mlir_dialect_library(MLIROpenMP
   IR/OpenMPDialect.cpp
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Dialect/QuantOps/CMakeLists.txt b/mlir/lib/Dialect/QuantOps/CMakeLists.txt
index 483056675ef4..12cb44fd42db 100644
--- a/mlir/lib/Dialect/QuantOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/QuantOps/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRQuantOps
+add_mlir_dialect_library(MLIRQuantOps
   IR/QuantOps.cpp
   IR/QuantTypes.cpp
   IR/TypeDetail.h

diff  --git a/mlir/lib/Dialect/SDBM/CMakeLists.txt b/mlir/lib/Dialect/SDBM/CMakeLists.txt
index 36be9466c573..648d9f268c2f 100644
--- a/mlir/lib/Dialect/SDBM/CMakeLists.txt
+++ b/mlir/lib/Dialect/SDBM/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRSDBM
+add_mlir_dialect_library(MLIRSDBM
   SDBM.cpp
   SDBMExpr.cpp
 

diff  --git a/mlir/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
index 85bb7390b716..ad1bb4df2b5b 100644
--- a/mlir/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
@@ -2,7 +2,7 @@ set(LLVM_TARGET_DEFINITIONS SPIRVCanonicalization.td)
 mlir_tablegen(SPIRVCanonicalization.inc -gen-rewriters)
 add_public_tablegen_target(MLIRSPIRVCanonicalizationIncGen)
 
-add_llvm_library(MLIRSPIRV
+add_mlir_dialect_library(MLIRSPIRV
   LayoutUtils.cpp
   SPIRVCanonicalization.cpp
   SPIRVDialect.cpp

diff  --git a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
index 43c78dc99361..3d9ea7939535 100644
--- a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRSPIRVSerialization
+add_mlir_dialect_library(MLIRSPIRVSerialization
   Deserializer.cpp
   Serializer.cpp
   SPIRVBinaryUtils.cpp

diff  --git a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
index f9b5a5650bb1..e9d6492c0b1c 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRSPIRVTransforms
+add_mlir_dialect_library(MLIRSPIRVTransforms
   DecorateSPIRVCompositeTypeLayoutPass.cpp
   LowerABIAttributesPass.cpp
 

diff  --git a/mlir/lib/Dialect/Shape/CMakeLists.txt b/mlir/lib/Dialect/Shape/CMakeLists.txt
index 219a78b563df..f42323287a98 100644
--- a/mlir/lib/Dialect/Shape/CMakeLists.txt
+++ b/mlir/lib/Dialect/Shape/CMakeLists.txt
@@ -1,5 +1,5 @@
 file(GLOB globbed *.c *.cpp)
-add_llvm_library(MLIRShape
+add_mlir_dialect_library(MLIRShape
   ${globbed}
 
   ADDITIONAL_HEADER_DIRS

diff  --git a/mlir/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
index 37a63e3c1c42..c8af4702fbc1 100644
--- a/mlir/lib/Dialect/StandardOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRStandardOps
+add_mlir_dialect_library(MLIRStandardOps
   IR/Ops.cpp
   EDSC/Builders.cpp
   EDSC/Intrinsics.cpp

diff  --git a/mlir/lib/Dialect/VectorOps/CMakeLists.txt b/mlir/lib/Dialect/VectorOps/CMakeLists.txt
index 27cb10f53c20..8bdce35f71ff 100644
--- a/mlir/lib/Dialect/VectorOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/VectorOps/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_llvm_library(MLIRVectorOps
+add_mlir_dialect_library(MLIRVectorOps
   VectorOps.cpp
   VectorTransforms.cpp
   VectorUtils.cpp

diff  --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
index b0676ef7de71..ee56acd78316 100644
--- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
@@ -2,8 +2,9 @@ add_llvm_tool(mlir-cpu-runner
   mlir-cpu-runner.cpp
 )
 llvm_update_compile_flags(mlir-cpu-runner)
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 target_link_libraries(mlir-cpu-runner PRIVATE
-  MLIRAllDialects
+  ${dialect_libs}
   MLIRAnalysis
   MLIREDSC
   MLIRExecutionEngine

diff  --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
index c79d64afa80e..e9fb74025861 100644
--- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
@@ -35,29 +35,20 @@ if(MLIR_CUDA_RUNNER_ENABLED)
     ${CUDA_RUNTIME_LIBRARY}
   )
 
+  get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
   set(LIBS
+    ${dialect_libs}
     LLVMCore
     LLVMSupport
     MLIRJitRunner
-    MLIRAffineOps
     MLIRAnalysis
     MLIREDSC
     MLIRExecutionEngine
-    MLIRFxpMathOps
-    MLIRGPU
     MLIRGPUtoCUDATransforms
     MLIRGPUtoNVVMTransforms
     MLIRIR
-    MLIRLLVMIR
-    MLIRLinalgOps
     MLIRLoopToStandard
-    MLIROpenMP
     MLIRParser
-    MLIRQuantOps
-    MLIRROCDLIR
-    MLIRSPIRV
-    MLIRSPIRV
-    MLIRStandardOps
     MLIRStandardToLLVM
     MLIRSupport
     MLIRTargetLLVMIR

diff  --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index fad641cece2d..d7b96d029530 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -18,11 +18,12 @@ target_link_libraries(MLIRMlirOptMain
   ${LIB_LIBS}
 )
 
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 set(LIBS
+  ${dialect_libs}
   MLIRLoopOpsTransforms
   MLIRLoopAnalysis
   MLIRAnalysis
-  MLIRAffineOps
   MLIRAffineToStandard
   MLIRDialect
   MLIRLoopsToGPU
@@ -30,36 +31,22 @@ set(LIBS
 
   MLIRLoopToStandard
   MLIREDSC
-  MLIRFxpMathOps
-  MLIRGPU
   MLIRGPUtoCUDATransforms
   MLIRGPUtoNVVMTransforms
   MLIRGPUtoROCDLTransforms
   MLIRGPUtoSPIRVTransforms
   MLIRGPUtoVulkanTransforms
-  MLIRLinalgOps
-  MLIRLinalgAnalysis
-  MLIRLinalgEDSC
-  MLIRLinalgTransforms
-  MLIRLinalgUtils
-  MLIRLLVMIR
-  MLIRLoopOps
-  MLIRNVVMIR
-  MLIROpenMP
   MLIROptLib
   MLIRParser
   MLIRPass
   MLIRQuantizerFxpMathConfig
   MLIRQuantizerSupport
   MLIRQuantizerTransforms
-  MLIRQuantOps
-  MLIRROCDLIR
   MLIRSPIRV
   MLIRLinalgToSPIRVTransforms
   MLIRStandardToSPIRVTransforms
   MLIRSPIRVTestPasses
   MLIRSPIRVTransforms
-  MLIRStandardOps
   MLIRStandardToLLVM
   MLIRTransforms
   MLIRTransformUtils
@@ -68,7 +55,6 @@ set(LIBS
   MLIRTestPass
   MLIRTestTransforms
   MLIRSupport
-  MLIRVectorOps
   MLIRVectorToLLVM
   MLIRVectorToLoops
   MLIRIR

diff  --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt
index 4b95a953e867..d665789e5bd0 100644
--- a/mlir/tools/mlir-translate/CMakeLists.txt
+++ b/mlir/tools/mlir-translate/CMakeLists.txt
@@ -1,5 +1,6 @@
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 set(LIBS
-  MLIRAllDialects
+  ${dialect_libs}
   MLIRParser
   MLIRPass
   MLIRSPIRV

diff  --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index 0fd4bf5cd0e3..f68ddab7c7b0 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -51,31 +51,24 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
     ${Vulkan_LIBRARY}
   )
 
+  get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
   set(LIBS
+    ${dialect_libs}
     LLVMCore
     LLVMSupport
     MLIRJitRunner
-    MLIRAffineOps
     MLIRAnalysis
     MLIREDSC
     MLIRExecutionEngine
-    MLIRFxpMathOps
-    MLIRGPU
     MLIRGPUtoCUDATransforms
     MLIRGPUtoNVVMTransforms
     MLIRGPUtoSPIRVTransforms
     MLIRGPUtoVulkanTransforms
     MLIRIR
     MLIRLLVMIR
-    MLIRLinalgOps
     MLIRLoopToStandard
-    MLIROpenMP
     MLIRParser
-    MLIRQuantOps
-    MLIRROCDLIR
-    MLIRSPIRV
     MLIRSPIRVTransforms
-    MLIRStandardOps
     MLIRStandardToLLVM
     MLIRSupport
     MLIRTargetLLVMIR


        


More information about the Mlir-commits mailing list