[Mlir-commits] [mlir] [mlir] NFC: fix dependence of (Tensor|Linalg|MemRef|Complex) dialects on LLVM Dialect and LLVM Core in CMake build (PR #104832)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Aug 19 12:03:35 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-affine
@llvm/pr-subscribers-mlir-complex
Author: Christopher Bate (christopherbate)
<details>
<summary>Changes</summary>
This change removes dependencies declared as either 'LINK_LIBS' or
'LINK_COMPONENTS' across several MLIR libraries. The removed dependencies appear
to be incorrect and may have been required in older versions of the project.
These dependencies cause many high level dialects to have transitive
dependence on the LLVM dialect and the LLVM 'Core' library ('llvm/lib/IR').
Note that if using the 'Ninja' CMake generator, one can inspect the dependencies
(including all transitive libraries) of any given MLIR target but using
the command `ninja -C <build dir> -t browse` and navigating to the library
of interest in a web browser.
---
Full diff: https://github.com/llvm/llvm-project/pull/104832.diff
11 Files Affected:
- (modified) mlir/lib/Conversion/AffineToStandard/CMakeLists.txt (-3)
- (modified) mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt (+1-5)
- (modified) mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp (-1)
- (modified) mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt (+1-4)
- (modified) mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp (+2-3)
- (modified) mlir/lib/Conversion/VectorToSCF/CMakeLists.txt (-4)
- (modified) mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt (-1)
- (modified) mlir/lib/Dialect/Complex/IR/CMakeLists.txt (-1)
- (modified) mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt (-2)
- (modified) mlir/lib/Dialect/MemRef/IR/CMakeLists.txt (-3)
- (modified) mlir/lib/Dialect/Tensor/IR/CMakeLists.txt (-3)
``````````diff
diff --git a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
index f41e3ca27ee4dd..cd8193aee8da32 100644
--- a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
@@ -7,9 +7,6 @@ add_mlir_conversion_library(MLIRAffineToStandard
DEPENDS
MLIRConversionPassIncGen
- LINK_COMPONENTS
- Core
-
LINK_LIBS PUBLIC
MLIRAffineDialect
MLIRAffineTransforms
diff --git a/mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt b/mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt
index 679eca3dfa988c..e7024dfbd5ee32 100644
--- a/mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt
+++ b/mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt
@@ -5,11 +5,7 @@ add_mlir_conversion_library(MLIRControlFlowToSCF
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/ControlFlowToSCF
DEPENDS
- MLIRConversionPassIncGen
- intrinsics_gen
-
- LINK_COMPONENTS
- Core
+ MLIRConversionPassIncGen
LINK_LIBS PUBLIC
MLIRAnalysis
diff --git a/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp b/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp
index d3ee89743da9db..1c592d665f3e4c 100644
--- a/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp
+++ b/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
-#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/UB/IR/UBOps.h"
#include "mlir/Pass/Pass.h"
diff --git a/mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt b/mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt
index 63c5199af9290c..ff64b8fcca0830 100644
--- a/mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt
+++ b/mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt
@@ -5,10 +5,7 @@ add_mlir_conversion_library(MLIRSCFToControlFlow
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/SCFToControlFlow
DEPENDS
- MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
+ MLIRConversionPassIncGen
LINK_LIBS PUBLIC
MLIRArithDialect
diff --git a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
index 2372ab5b82a772..cef96c206dda5c 100644
--- a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
+++ b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
@@ -15,7 +15,6 @@
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/IR/Builders.h"
@@ -379,8 +378,8 @@ LogicalResult ForLowering::matchAndRewrite(ForOp forOp,
// llvm.loop_annotation attribute.
SmallVector<NamedAttribute> llvmAttrs;
llvm::copy_if(forOp->getAttrs(), std::back_inserter(llvmAttrs),
- [](auto attr) {
- return isa<LLVM::LLVMDialect>(attr.getValue().getDialect());
+ [](NamedAttribute attr) {
+ return attr.getValue().getDialect().getNamespace() == "llvm";
});
condBranchOp->setDiscardableAttrs(llvmAttrs);
// The result of the loop operation is the values of the condition block
diff --git a/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt b/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt
index 83bbc4a4bc395a..0915270e453dfd 100644
--- a/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToSCF/CMakeLists.txt
@@ -4,12 +4,8 @@ add_mlir_conversion_library(MLIRVectorToSCF
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToSCF
- LINK_COMPONENTS
- Core
-
LINK_LIBS PUBLIC
MLIRArithDialect
- MLIRLLVMDialect
MLIRMemRefDialect
MLIRTransforms
MLIRVectorDialect
diff --git a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
index 60d14a373348d3..772f15335d907f 100644
--- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
@@ -39,6 +39,5 @@ add_mlir_dialect_library(MLIRAffineTransforms
MLIRValueBoundsOpInterface
MLIRVectorDialect
MLIRVectorUtils
- MLIRVectorToLLVM
)
diff --git a/mlir/lib/Dialect/Complex/IR/CMakeLists.txt b/mlir/lib/Dialect/Complex/IR/CMakeLists.txt
index 3ee0d26f3225f7..a90f34ec1684d9 100644
--- a/mlir/lib/Dialect/Complex/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Complex/IR/CMakeLists.txt
@@ -10,7 +10,6 @@ add_mlir_dialect_library(MLIRComplexDialect
MLIRComplexAttributesIncGen
LINK_LIBS PUBLIC
- MLIRArithAttrToLLVMConversion
MLIRArithDialect
MLIRDialect
MLIRInferTypeOpInterface
diff --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index a7dcc29b5b9be1..47af392def94ac 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -60,7 +60,6 @@ add_mlir_dialect_library(MLIRLinalgTransforms
MLIRDestinationStyleOpInterface
MLIRDialectUtils
MLIRFuncDialect
- MLIRFuncToLLVM
MLIRFuncTransforms
MLIRIndexDialect
MLIRInferTypeOpInterface
@@ -87,6 +86,5 @@ add_mlir_dialect_library(MLIRLinalgTransforms
MLIRVectorDialect
MLIRVectorTransforms
MLIRVectorUtils
- MLIRX86VectorTransforms
MLIRVectorToSCF
)
diff --git a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
index fd2fed28badd63..845914ebd107a2 100644
--- a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
@@ -10,9 +10,6 @@ add_mlir_dialect_library(MLIRMemRefDialect
DEPENDS
MLIRMemRefOpsIncGen
- LINK_COMPONENTS
- Core
-
LINK_LIBS PUBLIC
MLIRArithDialect
MLIRArithUtils
diff --git a/mlir/lib/Dialect/Tensor/IR/CMakeLists.txt b/mlir/lib/Dialect/Tensor/IR/CMakeLists.txt
index 549b9f10388bd4..cfdd3847761a49 100644
--- a/mlir/lib/Dialect/Tensor/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Tensor/IR/CMakeLists.txt
@@ -17,9 +17,6 @@ add_mlir_dialect_library(MLIRTensorDialect
DEPENDS
MLIRTensorOpsIncGen
- LINK_COMPONENTS
- Core
-
LINK_LIBS PUBLIC
MLIRAffineDialect
MLIRArithDialect
``````````
</details>
https://github.com/llvm/llvm-project/pull/104832
More information about the Mlir-commits
mailing list