Skip to content

[MLIR][NFC] Declare RuntimeVerifiableOpInterface for memref ops that have an implementation #145230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

abulavin
Copy link
Contributor

@abulavin abulavin commented Jun 22, 2025

Previously running -generate-runtime-verification on an IR containing memref.reinterpret_cast would crash because its implementation of the RuntimeVerifiableOpInterface was removed in #132547 but its 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 #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 #144028

@llvmbot
Copy link
Member

llvmbot commented Jun 22, 2025

@llvm/pr-subscribers-mlir-memref

Author: Artemiy Bulavin (abulavin)

Changes

Previously running -generate-runtime-verification on an IR containing memref.reinterpret_cast would crash because its implementation of the RuntimeVerifiableOpInterface was removed in #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 #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 #144028


Full diff: https://github.com/llvm/llvm-project/pull/145230.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp (+3-2)
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>();

@llvmbot
Copy link
Member

llvmbot commented Jun 22, 2025

@llvm/pr-subscribers-mlir

Author: Artemiy Bulavin (abulavin)

Changes

Previously running -generate-runtime-verification on an IR containing memref.reinterpret_cast would crash because its implementation of the RuntimeVerifiableOpInterface was removed in #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 #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 #144028


Full diff: https://github.com/llvm/llvm-project/pull/145230.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp (+3-2)
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>();

@abulavin abulavin changed the title Declare RuntimeVerifiableOpInterface for memref ops that have an imlementation Declare RuntimeVerifiableOpInterface for memref ops that have an implementation Jun 22, 2025
@abulavin abulavin changed the title Declare RuntimeVerifiableOpInterface for memref ops that have an implementation [MLIR][NFC] Declare RuntimeVerifiableOpInterface for memref ops that have an implementation Jun 22, 2025
Copy link
Contributor

@CoTinker CoTinker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@CoTinker CoTinker merged commit 26f3f24 into llvm:main Jun 23, 2025
10 checks passed
miguelcsx pushed a commit to miguelcsx/llvm-project that referenced this pull request Jun 23, 2025
…have an implementation (llvm#145230)

Previously running `-generate-runtime-verification` on an IR containing
`memref.reinterpret_cast` would crash because its implementation of the
`RuntimeVerifiableOpInterface` was removed in
llvm#132547 but its 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 llvm#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 llvm#144028
Jaddyen pushed a commit to Jaddyen/llvm-project that referenced this pull request Jun 23, 2025
…have an implementation (llvm#145230)

Previously running `-generate-runtime-verification` on an IR containing
`memref.reinterpret_cast` would crash because its implementation of the
`RuntimeVerifiableOpInterface` was removed in
llvm#132547 but its 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 llvm#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 llvm#144028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants