[Mlir-commits] [mlir] [mlir] Fix some cmake dependencies in LLVMIR Dialect (PR #66956)

Markus Böck llvmlistbot at llvm.org
Wed Sep 20 15:06:43 PDT 2023


https://github.com/zero9178 created https://github.com/llvm/llvm-project/pull/66956

While looking into reducing needless interdependencies between upstream MLIR dialects and passes, I discovered that the ROCDL Dialect redundantely uses links in `VectorToLLVM` conversion pass when it actually requires just the LLVM Dialect. Furthermore, after a build failure, I ran `ninja -t missingdeps` which revealed that the NVVM Dialect depends on headers of the GPU dialect (https://github.com/llvm/llvm-project/blob/211c9752c8200fbb3ff7be1f6aa98037901758ce/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h#L18) without stating so in CMake. 
This causes flaky builds as it is not guaranteed that the header exists prior to the dialect being compiled.

>From b9734d3b453de286b415fddb6ad5d9e280a2b469 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20B=C3=B6ck?= <markus.boeck02 at gmail.com>
Date: Thu, 21 Sep 2023 00:03:48 +0200
Subject: [PATCH] [mlir] Fix some cmake dependencies in LLVMIR Dialect

While looking into reducing needless interdependencies between upstream MLIR dialects and passes, I discovered that the ROCDL Dialect redundantely uses links in `VectorToLLVM` conversion pass when it actually requires just the LLVM Dialect.
Furthermore, after a build failure, I ran `ninja -t missingdeps` which revealed that the NVVM Dialect depends on headers of the GPU dialect without stating so in CMake. This causes flaky builds as it is not guaranteed that the header exists prior to the dialect being compiled.
---
 mlir/lib/Dialect/LLVMIR/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
index b5e6fbd4baf6ba7..b54a1e211d08c91 100644
--- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
@@ -57,6 +57,7 @@ add_mlir_dialect_library(MLIRNVVMDialect
 
   LINK_LIBS PUBLIC
   MLIRIR
+  MLIRGPUDialect
   MLIRLLVMDialect
   MLIRSideEffectInterfaces
   )
@@ -78,6 +79,6 @@ add_mlir_dialect_library(MLIRROCDLDialect
 
   LINK_LIBS PUBLIC
   MLIRIR
+  MLIRLLVMDialect
   MLIRSideEffectInterfaces
-  MLIRVectorToLLVM
   )



More information about the Mlir-commits mailing list