[Mlir-commits] [llvm] [mlir] [mlir][spirv] Fix cyclical dependency in bazel (PR #132785)

Igor Wodiany llvmlistbot at llvm.org
Mon Mar 24 12:06:14 PDT 2025


IgWod-IMG wrote:

I'm not familiar with Bazel but I managed to remove the dependency of the interface on the IR:

```diff
diff --git a/mlir/include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td b/mlir/include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInte
rfaces.td
index 2b681d9367a4..fbb77a7ed2d6 100644
--- a/mlir/include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td
+++ b/mlir/include/mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.td
@@ -13,7 +13,7 @@
 #ifndef MLIR_DIALECT_SPIRV_IMAGE_INTERFACES
 #define MLIR_DIALECT_SPIRV_IMAGE_INTERFACES

-include "mlir/Dialect/SPIRV/IR/SPIRVBase.td"
+include "mlir/IR/OpBase.td"

 // -----
```

```diff
diff --git a/mlir/lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp b/mlir/lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp
index e10da60184ee..eabcfcbfba93 100644
--- a/mlir/lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp
+++ b/mlir/lib/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.cpp
@@ -6,7 +6,9 @@
 //
 //===----------------------------------------------------------------------===//

-#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/IR/OpDefinition.h"
+
+#include "mlir/Dialect/SPIRV/Interfaces/SPIRVImageInterfaces.h"

 using namespace mlir;

```

This builds and passes tests with: `cmake --build build-linux/ --target check-mlir`.  I don't have an ability to test it with Bazel, but I think it should resolve the dependency.



https://github.com/llvm/llvm-project/pull/132785


More information about the Mlir-commits mailing list