Skip to content

Commit 43b5085

Browse files
[mlir] NFC: fix dependence of (Tensor|Linalg|MemRef|Complex) dialects on LLVM Dialect and LLVM Core in CMake build (#104832)
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.
1 parent ea8bb4d commit 43b5085

File tree

12 files changed

+5
-30
lines changed

12 files changed

+5
-30
lines changed

mlir/lib/Conversion/AffineToStandard/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ add_mlir_conversion_library(MLIRAffineToStandard
77
DEPENDS
88
MLIRConversionPassIncGen
99

10-
LINK_COMPONENTS
11-
Core
12-
1310
LINK_LIBS PUBLIC
1411
MLIRAffineDialect
1512
MLIRAffineTransforms

mlir/lib/Conversion/ControlFlowToSCF/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ add_mlir_conversion_library(MLIRControlFlowToSCF
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/ControlFlowToSCF
66

77
DEPENDS
8-
MLIRConversionPassIncGen
9-
intrinsics_gen
10-
11-
LINK_COMPONENTS
12-
Core
8+
MLIRConversionPassIncGen
139

1410
LINK_LIBS PUBLIC
1511
MLIRAnalysis

mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h"
1717
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
1818
#include "mlir/Dialect/Func/IR/FuncOps.h"
19-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
2019
#include "mlir/Dialect/SCF/IR/SCF.h"
2120
#include "mlir/Dialect/UB/IR/UBOps.h"
2221
#include "mlir/Pass/Pass.h"

mlir/lib/Conversion/SCFToControlFlow/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ add_mlir_conversion_library(MLIRSCFToControlFlow
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/SCFToControlFlow
66

77
DEPENDS
8-
MLIRConversionPassIncGen
9-
10-
LINK_COMPONENTS
11-
Core
8+
MLIRConversionPassIncGen
129

1310
LINK_LIBS PUBLIC
1411
MLIRArithDialect

mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include "mlir/Dialect/Arith/IR/Arith.h"
1717
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
18-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
1918
#include "mlir/Dialect/SCF/IR/SCF.h"
2019
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
2120
#include "mlir/IR/Builders.h"
@@ -379,8 +378,8 @@ LogicalResult ForLowering::matchAndRewrite(ForOp forOp,
379378
// llvm.loop_annotation attribute.
380379
SmallVector<NamedAttribute> llvmAttrs;
381380
llvm::copy_if(forOp->getAttrs(), std::back_inserter(llvmAttrs),
382-
[](auto attr) {
383-
return isa<LLVM::LLVMDialect>(attr.getValue().getDialect());
381+
[](NamedAttribute attr) {
382+
return attr.getValue().getDialect().getNamespace() == "llvm";
384383
});
385384
condBranchOp->setDiscardableAttrs(llvmAttrs);
386385
// The result of the loop operation is the values of the condition block

mlir/lib/Conversion/VectorToSCF/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ add_mlir_conversion_library(MLIRVectorToSCF
44
ADDITIONAL_HEADER_DIRS
55
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToSCF
66

7-
LINK_COMPONENTS
8-
Core
9-
107
LINK_LIBS PUBLIC
118
MLIRArithDialect
12-
MLIRLLVMDialect
139
MLIRMemRefDialect
1410
MLIRTransforms
1511
MLIRVectorDialect

mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ add_mlir_dialect_library(MLIRAffineTransforms
3939
MLIRValueBoundsOpInterface
4040
MLIRVectorDialect
4141
MLIRVectorUtils
42-
MLIRVectorToLLVM
4342
)
4443

mlir/lib/Dialect/Complex/IR/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ add_mlir_dialect_library(MLIRComplexDialect
1010
MLIRComplexAttributesIncGen
1111

1212
LINK_LIBS PUBLIC
13-
MLIRArithAttrToLLVMConversion
1413
MLIRArithDialect
1514
MLIRDialect
1615
MLIRInferTypeOpInterface

mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ add_mlir_dialect_library(MLIRLinalgTransforms
6060
MLIRDestinationStyleOpInterface
6161
MLIRDialectUtils
6262
MLIRFuncDialect
63-
MLIRFuncToLLVM
6463
MLIRFuncTransforms
6564
MLIRIndexDialect
6665
MLIRInferTypeOpInterface
@@ -87,6 +86,5 @@ add_mlir_dialect_library(MLIRLinalgTransforms
8786
MLIRVectorDialect
8887
MLIRVectorTransforms
8988
MLIRVectorUtils
90-
MLIRX86VectorTransforms
9189
MLIRVectorToSCF
9290
)

mlir/lib/Dialect/MemRef/IR/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ add_mlir_dialect_library(MLIRMemRefDialect
1010
DEPENDS
1111
MLIRMemRefOpsIncGen
1212

13-
LINK_COMPONENTS
14-
Core
15-
1613
LINK_LIBS PUBLIC
1714
MLIRArithDialect
1815
MLIRArithUtils

mlir/lib/Dialect/MemRef/TransformOps/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ add_mlir_dialect_library(MLIRMemRefTransformOps
1919
MLIRNVGPUDialect
2020
MLIRTransformDialect
2121
MLIRVectorDialect
22+
MLIRVectorTransforms
2223
)

mlir/lib/Dialect/Tensor/IR/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ add_mlir_dialect_library(MLIRTensorDialect
1717
DEPENDS
1818
MLIRTensorOpsIncGen
1919

20-
LINK_COMPONENTS
21-
Core
22-
2320
LINK_LIBS PUBLIC
2421
MLIRAffineDialect
2522
MLIRArithDialect

0 commit comments

Comments
 (0)