[Mlir-commits] [mlir] Declare RuntimeVerifiableOpInterface for memref ops that have an imlementation (PR #145230)

Artemiy Bulavin llvmlistbot at llvm.org
Sun Jun 22 05:07:12 PDT 2025


https://github.com/abulavin created https://github.com/llvm/llvm-project/pull/145230

Previously running `-generate-runtime-verification` on an IR containing memref.reinterpret_cast would crash because its implementation of the `RuntimeVerifiableOpInterface` was removed in https://github.com/llvm/llvm-project/pull/132547 but it's associated entry in `declarePromisedInterface` was never removed.

This causes an error when you try and run `-generate-runtime-verification` on an IR containing `memref.reinterpret_cast that looks like`

```
LLVM ERROR: checking for an interface (`mlir::RuntimeVerifiableOpInterface`) that was promised by dialect 'memref' but never implemented. This is generally an indication that the dialect extension implementing the interface was never registered.
```
as reported in https://github.com/llvm/llvm-project/issues/144028.

In this PR I also added all the ops that do have implementations of this interface in `mlir/lib/Dialect/MemRef/Transforms/RuntimeOpVerification.cpp` to the `declarePromisedInterface` for consistency.

Fixes https://github.com/llvm/llvm-project/issues/144028

>From aff94d0887cefe5093e07fb94bb54e197029a025 Mon Sep 17 00:00:00 2001
From: Artemiy Bulavin <artemiyb at graphcore.ai>
Date: Sun, 22 Jun 2025 11:55:12 +0000
Subject: [PATCH] Declare RuntimeVerifiableOpInterface for memref ops that have
 an imlementation

---
 mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
index 6d0ac8a650776..2f55f5c0a7433 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
@@ -52,8 +52,9 @@ void mlir::memref::MemRefDialect::initialize() {
   declarePromisedInterface<ConvertToLLVMPatternInterface, MemRefDialect>();
   declarePromisedInterfaces<bufferization::AllocationOpInterface, AllocOp,
                             AllocaOp, ReallocOp>();
-  declarePromisedInterfaces<RuntimeVerifiableOpInterface, CastOp, ExpandShapeOp,
-                            LoadOp, ReinterpretCastOp, StoreOp, SubViewOp>();
+  declarePromisedInterfaces<RuntimeVerifiableOpInterface, AssumeAlignmentOp,
+                            AtomicRMWOp, CastOp, CopyOp, DimOp, ExpandShapeOp,
+                            GenericAtomicRMWOp, LoadOp, StoreOp, SubViewOp>();
   declarePromisedInterfaces<ValueBoundsOpInterface, AllocOp, AllocaOp, CastOp,
                             DimOp, GetGlobalOp, RankOp, SubViewOp>();
   declarePromisedInterface<DestructurableTypeInterface, MemRefType>();



More information about the Mlir-commits mailing list